summary refs log tree commit diff
path: root/src/librustc_mir/build/expr
AgeCommit message (Collapse)AuthorLines
2016-03-31librustc_mir: use bug!(), span_bug!()Benjamin Herr-3/+4
2016-03-27rustc: move cfg, infer, traits and ty from middle to top-level.Eduard Burtescu-1/+1
2016-03-23introduce "call-site-scope" as the outermost scopeNiko Matsakis-1/+1
also, when exiting a scope, assign the final goto terminator with the target scope's id
2016-03-23rewrite drop codeNiko Matsakis-1/+2
This was triggered by me wanting to address a use of DUMMY_SP, but actually I'm not sure what would be a better span -- I guess the span for the function as a whole.
2016-03-23add span/scope-id to terminatorNiko Matsakis-11/+38
2016-03-23extend Terminator into a struct so it can have additional fieldsNiko Matsakis-12/+12
2016-03-23track the innermost scope for every stmtNiko Matsakis-12/+17
2016-03-23record a scope for each `VarDecl`Niko Matsakis-6/+6
2016-03-17hir, mir: Separate HIR expressions / MIR operands from InlineAsm.Eduard Burtescu-2/+14
2016-03-17mir: Ignore noop casts (e.g. when `as` used for coercion).Eduard Burtescu-2/+7
2016-03-09Track fn type and lifetime parameters in TyFnDef.Eduard Burtescu-1/+1
2016-03-09Split TyBareFn into TyFnDef and TyFnPtr.Eli Friedman-1/+3
There's a lot of stuff wrong with the representation of these types: TyFnDef doesn't actually uniquely identify a function, TyFnPtr is used to represent method calls, TyFnDef in the sub-expression of a cast isn't correctly reified, and probably some other stuff I haven't discovered yet. Splitting them seems like the right first step, though.
2016-02-20address review commentsAriel Ben-Yehuda-0/+4
2016-02-20store the normalized types of field accessesAriel Ben-Yehuda-18/+15
Fixes #31504
2016-02-07[MIR] Fix the destination of implicit else branchSimonas Kazlauskas-1/+1
2016-02-04Convert Drop statement into terminatorSimonas Kazlauskas-1/+1
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-11/+5
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-04Synthesize calls to box_free language itemSimonas Kazlauskas-18/+11
This gets rid of Drop(Free, _) MIR construct by synthesizing a call to language item which takes care of dropping instead.
2016-01-29[MIR] Fix type of temporary for `box EXPR`Oliver Schneider-4/+3
Previously the code would fail to dereference the temporary.
2016-01-21[MIR] use mir::repr::Constant in ExprKind::Repeat, close #29789Florian Hahn-1/+0
2016-01-19[MIR] Reintroduce the unit temporarySimonas Kazlauskas-21/+29
An attempt to make loop body destination be optional, author implemented a pretty self contained change and deemed it to be (much) uglier than the alternative of just keeping the unit temporary. Having the temporary created lazily also has a nice property of not figuring in the MIR of functions which do not use loops of any sort.
2016-01-07[MIR] Set dest ∀ expr with optional valueSimonas Kazlauskas-6/+25
Assign a default unit value to the destinations of block expressions without trailing expression, return expressions without return value (i.e. `return;`) and conditionals without else clause.
2016-01-06[MIR] Get rid of that nasty unit_ty temporary lvalSimonas Kazlauskas-2/+3
2016-01-06panic/panic_bounds_check to destructure tysSimonas Kazlauskas-1/+1
Not any more beautiful.
2016-01-06Merge Call and DivergingCall diffs into CallKindSimonas Kazlauskas-10/+15
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 the Panic block terminatorSimonas Kazlauskas-2/+2
2016-01-06Add Resume Terminator which corresponds to resumeSimonas Kazlauskas-2/+2
Diverge should eventually go away
2016-01-06Generate DivergingCall terminatorSimonas Kazlauskas-10/+19
This simplifies CFG greatly for some cases :)
2016-01-06Split Call into Call and DivergingCallSimonas Kazlauskas-6/+5
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: Make Mir take ownership of InlineAsm values.Michael Woerister-1/+1
2015-12-10MIR: Refactor mir::Terminator to use tuples instead of a fixed-size arrays.Michael Woerister-7/+7
2015-11-30Move the core MIR datastructures to librustc.Michael Woerister-11/+11
This is done mostly so that we can refer to MIR types in csearch and other metadata related area.
2015-11-24Remove the GraphExtents, the design of which seems bogus. They carriedNiko Matsakis-2/+2
the right information, but it's hard to maintain in the face of optimizations, and in the form that the analyses probably actually want.
2015-11-12Auto merge of #29616 - nagisa:mir-repeat, r=nikomatsakisbors-2/+2
r? @nikomatsakis I went ahead and replaced repeat count with a `Constant`, because it cannot be non-constant to the best of my knowledge.
2015-11-10use Constant for repetition count in mir::RepeatSimonas Kazlauskas-2/+2
2015-11-05remove excess string allocationSteve Klabnik-1/+1
&format!("...") is the same as "" if we're not doing any interpolation, and doesn't allocate an intermediate String.
2015-11-03Change Call operands to be, well, OperandsNiko Matsakis-2/+2
2015-11-03Convert from using named fields to always using indicesNiko Matsakis-3/+6
2015-11-03Change ShallowDrop to Free, so that it matches what trans will doNiko Matsakis-1/+1
2015-10-07Partially format librustc_mir with rustfmt.Ms2ger-64/+28
This commit contains some of the changes proposed by a rustfmt invocation, chosen based on the fairly non-deterministic metric of how much I liked the change. I expect we will run rustfmt on this crate again later, probably accepting more of its changes. For now, this is already an improvement over the status-quo.
2015-10-06strip out the hair trait and use concrete types insteadNiko Matsakis-31/+33
2015-10-04switch to using constvals for constants, instead of having constantNiko Matsakis-90/+13
trees in MIR
2015-09-24Remove the deprecated box(PLACE) syntax.Eduard Burtescu-1/+1
2015-09-17Remove hir::ExprParenNick Cameron-35/+9
2015-09-06convert TODOs to FIXMEsNiko Matsakis-1/+3
2015-09-06add MIR code (unused thus far)Niko Matsakis-0/+1081