summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2016-02-23[MIR] Change SimplifyCfg pass to use bitvecSimonas Kazlauskas-63/+34
BitVector is much more space efficient.
2016-02-20address review commentsAriel Ben-Yehuda-15/+37
2016-02-20use the FulfillmentContext and InferCtxt more correctlyAriel Ben-Yehuda-64/+101
2016-02-20type-check lvaluesAriel Ben-Yehuda-10/+217
2016-02-20fix a few remaining bugs - make check runs!Ariel Ben-Yehuda-0/+8
2016-02-20store the normalized types of field accessesAriel Ben-Yehuda-0/+1
Fixes #31504
2016-02-20introduce an early pass to clear dead blocksAriel Ben-Yehuda-8/+63
this makes the the MIR assignment pass complete successfully
2016-02-19begin implementing mir-typeckAriel Ben-Yehuda-0/+342
2016-02-17MSVC SEH in MIR is implemented hereSimonas Kazlauskas-1/+3
2016-02-11Add a no-landing-pads MIR passSimonas Kazlauskas-0/+48
The pass removes the unwind branch of each terminator, thus moving the responsibility of handling the -Z no-landing-pads flag to a small self-contained pass… instead of polluting the translator.
2016-02-09refactor `MirPass` to always require a tcxOliver Schneider-20/+16
2016-02-09make `MirMap` a struct instead of a type alias for `NodeMap`Oliver Schneider-2/+2
2016-02-06Reuse MIR visitors for EraseRegions passSimonas Kazlauskas-157/+67
2016-02-04Convert Drop statement into terminatorSimonas Kazlauskas-3/+3
The structure of the old translator as well as MIR assumed that drop glue cannot possibly panic and translated the drops accordingly. However, in presence of `Drop::drop` this assumption can be trivially shown to be untrue. As such, the Rust code like the following would never print number 2: ```rust struct Droppable(u32); impl Drop for Droppable { fn drop(&mut self) { if self.0 == 1 { panic!("Droppable(1)") } else { println!("{}", self.0) } } } fn main() { let x = Droppable(2); let y = Droppable(1); } ``` While the behaviour is allowed according to the language rules (we allow drops to not run), that’s a very counter-intuitive behaviour. We fix this in MIR by allowing `Drop` to have a target to take on divergence and connect the drops in such a way so the leftover drops are executed when some drop unwinds. Note, that this commit still does not implement the translator part of changes necessary for the grand scheme of things to fully work, so the actual observed behaviour does not change yet. Coming soon™. See #14875.
2016-02-04Remove the CallKindSimonas Kazlauskas-2/+2
We used to have CallKind only because there was a requirement to have all successors in a contiguous memory block. Now that the requirement is gone, remove the CallKind and instead just have the necessary information inline. Awesome!
2016-02-04Change successor{,_mut} to return a VecSimonas Kazlauskas-1/+1
This helps to avoid the unpleasant restriction of being unable to have multiple successors in non-contiguous block of memory.
2016-02-04Synthesize calls to box_free language itemSimonas Kazlauskas-1/+1
This gets rid of Drop(Free, _) MIR construct by synthesizing a call to language item which takes care of dropping instead.
2016-01-21Add Debug impl and erase region for TypedConstValFlorian Hahn-1/+2
2016-01-21Introduce and use TypedConstVal for RepeatFlorian Hahn-2/+1
2016-01-08Change destination accessor to return referencesSimonas Kazlauskas-1/+1
Previously it was returning a value, mostly for the two reasons: * Cloning Lvalue is very cheap most of the time (i.e. when Lvalue is not a Projection); * There’s users who want &mut lvalue and there’s users who want &lvalue. Returning a value allows to make either one easier when pattern matching (i.e. Some(ref dest) or Some(ref mut dest)). However, I’m now convinced this is an invalid approach. Namely the users which want a mutable reference may modify the Lvalue in-place, but the changes won’t be reflected in the final MIR, since the Lvalue modified is merely a clone. Instead, we have two accessors `destination` and `destination_mut` which return a reference to the destination in desired mode.
2016-01-06Merge Call and DivergingCall diffs into CallKindSimonas Kazlauskas-7/+3
This merges two separate Call terminators and uses a separate CallKind sub-enum instead. A little bit unrelatedly, copying into destination value for a certain kind of invoke, is also implemented here. See the associated comment in code for various details that arise with this implementation.
2016-01-06Remove diverge terminatorSimonas Kazlauskas-19/+12
Unreachable terminator can be contained all within the trans.
2016-01-06Remove the Panic block terminatorSimonas Kazlauskas-2/+1
2016-01-06Add Resume Terminator which corresponds to resumeSimonas Kazlauskas-0/+1
Diverge should eventually go away
2016-01-06Split Call into Call and DivergingCallSimonas Kazlauskas-13/+8
DivergingCall is different enough from the regular converging Call to warrant the split. This also inlines CallData struct and creates a new CallTargets enum in order to have a way to differentiate between calls that do not have an associated cleanup block. Note, that this patch still does not produce DivergingCall terminator anywhere. Look for that in the next patches.
2015-12-10MIR: Refactor mir::Terminator to use tuples instead of a fixed-size arrays.Michael Woerister-4/+7
2015-11-30Move the core MIR datastructures to librustc.Michael Woerister-4/+4
This is done mostly so that we can refer to MIR types in csearch and other metadata related area.
2015-11-18MIR: Add pass that erases all regions right before transMichael Woerister-4/+239
2015-11-12Add a MIR pass to simplify the control flow graphBjörn Steinbrink-0/+204
For now, this pass does some easy transformations, like eliminating empty blocks that just jump to another block, some trivial conversion of If terminators into Gotos and removal of dead blocks.