about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/mir/mod.rs
AgeCommit message (Collapse)AuthorLines
2020-07-22[AVR] Correctly set the pointer address space when constructing pointers to ↵Dylan McKay-1/+4
functions This patch extends the existing `type_i8p` method so that it requires an explicit address space to be specified. Before this patch, the `type_i8p` method implcitily assumed the default address space, which is not a safe transformation on all targets, namely AVR. The Rust compiler already has support for tracking the "instruction address space" on a per-target basis. This patch extends the code generation routines so that an address space must always be specified. In my estimation, around 15% of the callers of `type_i8p` produced invalid code on AVR due to the loss of address space prior to LLVM final code generation. This would lead to unavoidable assertion errors relating to invalid bitcasts. With this patch, the address space is always either 1) explicitly set to the instruction address space because the logic is dealing with functions which must be placed there, or 2) explicitly set to the default address space 0 because the logic can only operate on data space pointers and thus we keep the existing semantics of assuming the default, "data" address space.
2020-04-26Rollup merge of #71392 - ecstatic-morse:body-predecessor-cache-arc, ↵Dylan DPC-1/+1
r=nikomatsakis Don't hold the predecessor cache lock longer than necessary #71044 returns a `LockGuard` with the predecessor cache to callers of `Body::predecessors`. As a result, the lock around the predecessor cache could be held for an arbitrarily long time. This PR uses reference counting for ownership of the predecessor cache, meaning the lock is only ever held within `PredecessorCache::compute`. Checking this API for potential sources of deadlock is much easier now, since we no longer have to consider its consumers, only its internals. This required removing `predecessors_for`, since there is no equivalent to `LockGuard::map` for `Arc` and `Rc`. I believe this could be emulated with `owning_ref::{Arc,Rc}Ref`, but I don't think it's necessary. Also, we continue to return an opaque type from `Body::predecessors` with the lifetime of the `Body`, not `'static`. This depends on #71044. Only the last two commits are new. r? @nikomatsakis
2020-04-23Rename uneval_consts to required_constsSantiago Pastorino-1/+1
2020-04-23Evaluate unevaluated MIR constants in codegen_mirSantiago Pastorino-0/+14
2020-04-22Remove `predecessors_for`Dylan MacKenzie-1/+1
There is no `Arc::map` equivalent to `LockGuard::map`
2020-04-22Use `Body` everywhereDylan MacKenzie-7/+6
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-4/+4
2020-03-27Rename TyLayout to TyAndLayout.Ana-Maria Mihalache-2/+2
2020-03-12codegen/mir: support polymorphic `InstanceDef`sDavid Wood-6/+11
This commit modifies the use of `subst_and_normalize_erasing_regions` on parts of the MIR bodies returned from `instance_mir`, so that `InstanceDef::CloneShim` and `InstanceDef::DropGlue` (where there is a type) do not perform substitutions. This avoids double substitutions and enables polymorphic `InstanceDef`s. Signed-off-by: David Wood <david@davidtw.co>
2020-02-08rustc_codegen_ssa: remove unnecessary source_locations_enabled.Eduard-Mihai Burtescu-7/+0
2020-02-03rustc_codegen_ssa: convert mir::VarDebugInfo into a custom PerLocalVarDebugInfo.Eduard-Mihai Burtescu-5/+8
2019-12-22Format the worldMark Rousskov-151/+165
2019-12-08Rollup merge of #66991 - Nashenas88:body_cache_cleanup, r=eddybMazdak Farrokhzad-2/+2
Cleanup BodyCache After this PR: - `BodyCache` is renamed to `BodyAndCache` - `ReadOnlyBodyCache` is renamed to `ReadOnlyBodyAndCache` - `ReadOnlyBodyAndCache::body` fn is removed and all calls to it are replaced by a deref (possible due to fix of its `Deref` imp in #65947) cc @eddyb @oli-obk
2019-12-06Address review feedback.Adam Perry-2/+2
2019-12-06Caller location is propagated via immediates rather than memory.Adam Perry-4/+11
2019-12-05Pass a location to #[track_caller] functions in codegen_call_terminator.Adam Perry-4/+17
2019-12-05Add field to FunctionCx for passing caller location.Adam Perry-0/+4
2019-12-05rustc_codegen_ssa: Fix line accidentally reverted during rebasePaul Daniel Faria-1/+1
2019-12-05rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded ↵Paul Daniel Faria-1/+1
Index impl, remove body fn rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
2019-12-03rustc: compute FnAbi's for virtual calls through FnAbi::of_instance.Eduard-Mihai Burtescu-1/+1
2019-12-03rustc_codegen_ssa: use FnAbi::of_instance wherever possible.Eduard-Mihai Burtescu-5/+2
2019-12-03rustc_codegen_ssa: make codegen_instance a simple wrapper for codegen_mir.Eduard-Mihai Burtescu-3/+6
2019-12-03rustc_codegen_ssa: use &'tcx mir::Body<'tcx> instead of &'a ... for the MIR ↵Eduard-Mihai Burtescu-7/+7
body.
2019-12-02Fix issues caused during rebasingPaul Daniel Faria-1/+1
2019-12-02Remove BodyCache.body and rely on Deref as much as possible for ↵Paul Daniel Faria-1/+1
ReadOnlyBodyCache
2019-12-02Undo minor changes that weren't needed, fix one lifetime typoPaul Daniel Faria-3/+4
2019-12-02Fix compilation errors created during rebasePaul Daniel Faria-1/+1
2019-12-02Simplify BodyCache impl and fix all remaining type errors in librustc_mir ↵Paul Daniel Faria-9/+8
(lifetime errors still exist)
2019-12-02Account for new maybe_sideeffect helper that requires predecessorsPaul Daniel Faria-9/+10
2019-12-02Convert &mut to & since the reference didn't need to be mutablePaul Daniel Faria-1/+1
2019-12-02Revert back to using FunctionCx's BodyPaul Daniel Faria-6/+5
2019-12-02Add Body back as field of FunctionCx, but under a different lifetimePaul Daniel Faria-6/+6
2019-12-02Remove Body from FunctionCx, pass it along during librustc_codegen_ssaPaul Daniel Faria-14/+14
2019-12-02Simplify Cache wrapper to single type, impl Deref on it, fix all compilation ↵Paul Daniel Faria-8/+8
errors in librustc_codegen_ssa
2019-12-02Move predecessors cache invalidation back to basic_blocks_mut, add a couple ↵Paul Daniel Faria-1/+1
more ensure_predecessors to prevent panics
2019-12-02Stop invalidating predecessors cache when accessing unique basic block, ↵Paul Daniel Faria-1/+1
invalidate cache when accessing unique terminator
2019-11-27rustc: move debug info from LocalDecl and UpvarDecl into a dedicated ↵Eduard-Mihai Burtescu-1/+3
VarDebugInfo.
2019-11-03rustc: rename {Fn,Arg}TypeExt to {Fn,Arg}AbiExt.Eduard-Mihai Burtescu-1/+1
2019-11-03rustc_target: rename {Fn,Arg}Type to {Fn,Arg}Abi.Eduard-Mihai Burtescu-10/+10
2019-10-31rustc_codegen_ssa: introduce MIR VarDebugInfo, but only for codegen.Eduard-Mihai Burtescu-0/+2
2019-10-31rustc_codegen_ssa: move debuginfo scopes into FunctionDebugContext.Eduard-Mihai Burtescu-8/+7
2019-10-31rustc_codegen_ssa: move all set_var_name calls to mir::debuginfo.Eduard-Mihai Burtescu-39/+5
2019-10-31rustc_codegen_ssa: move local variable debuginfo to mir::debuginfo.Eduard-Mihai Burtescu-233/+30
2019-10-31rustc_codegen_ssa: move debuginfo-related things to a new mir::debuginfo module.Eduard-Mihai Burtescu-61/+4
2019-10-13s/FuncId/Functionbjorn3-2/+2
2019-10-13Introduce FuncId backend typebjorn3-2/+2
2019-10-10Auto merge of #59546 - sfanxiang:interminable-ub, r=nagisabors-0/+2
Add llvm.sideeffect to potential infinite loops and recursions LLVM assumes that a thread will eventually cause side effect. This is not true in Rust if a loop or recursion does nothing in its body, causing undefined behavior even in common cases like `loop {}`. Inserting llvm.sideeffect fixes the undefined behavior. As a micro-optimization, only insert llvm.sideeffect when jumping back in blocks or calling a function. A patch for LLVM is expected to allow empty non-terminate code by default and fix this issue from LLVM side. https://github.com/rust-lang/rust/issues/28728 **UPDATE:** [Mentoring instructions here](https://github.com/rust-lang/rust/pull/59546#issuecomment-515072429) to unstall this PR
2019-10-04clean up GeneratorSubstscsmoe-1/+1
2019-10-04Rollup merge of #64817 - csmoe:closure, r=nikomatsakisMazdak Farrokhzad-1/+2
Replace ClosureSubsts with SubstsRef Addresses https://github.com/rust-lang/rust/issues/42340 part 3 https://github.com/rust-lang/rust/pull/59312 might benefit from this clean up. r? @nikomatsakis
2019-10-03generate ClosureSubsts from SubstsRefcsmoe-1/+1