summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/mir
AgeCommit message (Collapse)AuthorLines
2019-05-20Introduce `LocalInternedString::intern`.Nicholas Nethercote-5/+5
`LocalInternedString::intern(x)` is preferable to `Symbol::intern(x).as_str()`, because the former involves one call to `with_interner` while the latter involves two.
2019-05-17Rollup merge of #60862 - spastorino:get-ty-from-local_decls, r=oli-obkMazdak Farrokhzad-3/+2
Get ty from local_decls instead of using Place r? @oli-obk This is from one of your review on Place 2.0
2019-05-16Auto merge of #60693 - saleemjaffer:refactor_fntype_stuff, r=eddybbors-9/+9
refactor some `FnType` stuff to `rustc::ty::layout` Does work in the direction of #56166.
2019-05-15Get ty from local_decls instead of using PlaceSantiago Pastorino-3/+2
2019-05-14removes `AbiMethods`Saleem Jaffer-9/+9
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-3/+3
2019-05-04Auto merge of #59897 - tmandry:variantful-generators, r=eddybbors-23/+49
Multi-variant layouts for generators This allows generators to overlap fields using variants, but doesn't do any such overlapping yet. It creates one variant for every state of the generator (unresumed, returned, panicked, plus one for every yield), and puts every stored local in each of the yield-point variants. Required for optimizing generator layouts (#52924). There was quite a lot of refactoring needed for this change. I've done my best in later commits to eliminate assumptions in the code that only certain kinds of types are multi-variant, and to centralize knowledge of the inner mechanics of generators in as few places as possible. This change also emits debuginfo about the fields contained in each variant, as well as preserving debuginfo about stored locals while running in the generator. Also, fixes #59972. Future work: - Use this change for an optimization pass that actually overlaps locals within the generator struct (#52924) - In the type layout fields, don't include locals that are uninitialized for a particular variant, so miri and UB sanitizers can check our memory (see https://github.com/rust-lang/rust/issues/59972#issuecomment-483058172) - Preserve debuginfo scopes across generator yield points
2019-05-03Split out debuginfo from type info in MIR GeneratorLayoutTyler Mandry-3/+5
2019-05-01Add `ConstValue::Placeholder`varkor-0/+1
2019-05-01Auto merge of #60195 - varkor:commontypes-to-common, r=eddybbors-1/+1
Split `CommonTypes` into `CommonTypes` and `CommonLifetimes` The so-called "`CommonTypes`" contains more than just types. r? @eddyb
2019-04-26Remove region from borrow place contextsMatthew Jasper-6/+6
2019-04-26Remove BasicBlock parameter from mir visitor methodsMatthew Jasper-4/+2
2019-04-25Update existing usagesvarkor-1/+1
2019-04-25Preserve visibility scopes in stored generator localsTyler Mandry-9/+17
Unfortunately, this didn't have quite the effect I was hoping for. Locals still appear visible at every point in the function, regardless of scopes. I suspect all the rewriting of the MIR we do for the generator transform makes these scopes less useful. I didn't observe any regressions in behavior, but it's possible that this change is wrong without additional changes to the MIR.
2019-04-25Generalize discriminant info calls for generators and ADTsTyler Mandry-18/+9
2019-04-25Support variantful generatorsTyler Mandry-13/+36
This allows generators to overlap fields using variants.
2019-04-25Give GeneratorLayout a list of fields for each variantTyler Mandry-2/+4
But don't really use it yet.
2019-04-23rustc: dissuade compiler developers from misusing upvar debuginfo.Eduard-Mihai Burtescu-5/+6
2019-04-23rustc_codegen_ssa: rename debuginfo_upvar_decls_ops_sequence to ↵Eduard-Mihai Burtescu-1/+1
debuginfo_upvar_ops_sequence.
2019-04-20Auto merge of #59987 - saleemjaffer:refactor_adjust_castkinds, r=oli-obkbors-8/+8
Refactor Adjust and CastKind fixes rust-lang#59588
2019-04-15basic refactor. Adding PointerCast enumSaleem Jaffer-8/+8
2019-04-11Add discr_index to multi-variant layoutsTyler Mandry-6/+8
We relax the assumption that the discriminant is always field 0, in preparations for layouts like generators where this is not going to be the case.
2019-04-04Rollup merge of #59639 - cuviper:ignore-uninhabited, r=eddybMazdak Farrokhzad-0/+7
Never return uninhabited values at all Functions with uninhabited return values are already marked `noreturn`, but we were still generating return instructions for this. When running with `-C passes=lint`, LLVM prints: Unusual: Return statement in function with noreturn attribute The LLVM manual makes a stronger statement about `noreturn` though: > This produces undefined behavior at runtime if the function ever does dynamically return. We now emit an `abort` anywhere that would have tried to return an uninhabited value. Fixes #48227 cc #7463 #48229 r? @eddyb
2019-04-03Never return uninhabited values at allJosh Stone-0/+7
Functions with uninhabited return values are already marked `noreturn`, but we were still generating return instructions for this. When running with `-C passes=lint`, LLVM prints: Unusual: Return statement in function with noreturn attribute The LLVM manual makes a stronger statement about `noreturn` though: > This produces undefined behavior at runtime if the function ever does dynamically return. We now emit an `abort` anywhere that would have tried to return an uninhabited value.
2019-04-03Rollup merge of #59630 - nnethercote:shrink-mir-Statement, r=pnkfelixMazdak Farrokhzad-6/+6
Shrink `mir::Statement`. The `InlineAsm` variant is extremely rare, and `mir::Statement` often contributes significantly to peak memory usage.
2019-04-03Rollup merge of #59514 - tmandry:remove-adt-def-from-projection-elem, r=eddybMazdak Farrokhzad-7/+7
Remove adt_def from projections and downcasts in MIR As part of optimizing generator layouts in MIR, we'd like to allow downcasting generators to variants which do not have a corresponding `def_id`, since they are created by the compiler. This refactor hopes to allow that, without regressing perf. r? @eddyb
2019-04-03Shrink `mir::Statement`.Nicholas Nethercote-6/+6
The `InlineAsm` variant is extremely rare, and `mir::Statement` often contributes significantly to peak memory usage.
2019-04-02Remove adt_def from PlaceTy and make it a structTyler Mandry-7/+7
2019-04-02renames EvalErrorKind to InterpErrorkenta7777-3/+3
2019-03-31Auto merge of #59577 - dlrobertson:fix_58881, r=nagisabors-13/+2
Fix LLVM IR generated for C-variadic arguments It is possible to create malformed LLVM IR given variadic arguments that are aggregate types. This occurs due to improper tracking of the current argument in the functions list of arguments. Fixes: #58881
2019-03-31Fix LLVM IR generated for C-variadic argumentsDan Robertson-13/+2
It is possible to create malformed LLVM IR given variadic arguments that are aggregate types. This occurs due to improper tracking of the current argument in the functions list of arguments.
2019-03-31Rollup merge of #59580 - taiki-e:coerce-closure, r=oli-obkMazdak Farrokhzad-1/+1
Allow closure to unsafe fn coercion Closes #57883
2019-03-31Rollup merge of #59519 - eddyb:layout-variants-refactor, r=oli-obkMazdak Farrokhzad-18/+21
rustc_target: factor out common fields of non-Single Variants. @tmandry and I were discussing ways to generalize the current variants/discriminant layout to allow more fields in the "`enum`" (or another multi-variant types, such as potentially generator state, in the future), shared by all variants, than just the tag/niche discriminant. This refactor should make it easier to extend multi-variant layouts, as nothing is duplicating anymore between "tagged enums" and "niche-filling enums". r? @oli-obk
2019-04-01Allow closure to unsafe fn coercionTaiki Endo-1/+1
2019-03-30Remove redundant importsFabian Drinck-1/+0
2019-03-29Use ExactSizeIterator + TrustedLen instead of num_cases arg for switchbjorn3-1/+0
2019-03-29Add a method for emiting a switch.bjorn3-10/+7
2019-03-29Remove type_variadic_func and typ_array from cg_ssabjorn3-25/+4
2019-03-29Move get_param and set_value_namebjorn3-7/+7
2019-03-29[WIP] Make some debug info methods take &mut FunctionDebugContextbjorn3-9/+5
declare_local still takes &FunctionDebugContext, because of borrowck errors
2019-03-29Remove internal mutability from source_locations_enabledbjorn3-1/+1
2019-03-29Remove param_substs from FunctionCxbjorn3-9/+3
2019-03-29Remove const_{cstr,str_slice,get_elt,get_real} and is_const_real methods ↵bjorn3-33/+20
from cg_ssa This introduces the static_panic_msg trait method to StaticBuilderMethods.
2019-03-29Miscbjorn3-2/+3
2019-03-29Use Builder instead of CodegenCx for OperandRef and LocalRefbjorn3-24/+27
2019-03-29`eval_mir_constant` doesn't need a builder parambjorn3-6/+5
2019-03-29Don't use c_uint in cg_ssabjorn3-7/+6
2019-03-29rustc_target: factor out common fields of non-Single Variants.Eduard-Mihai Burtescu-18/+21
2019-03-23adding mir::StaticKind enum for static and promotedSaleem Jaffer-9/+17
2019-03-21review fixesSaleem Jaffer-4/+4