about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/mir
AgeCommit message (Collapse)AuthorLines
2019-12-25Run RustFmtjumbatm-1/+4
2019-12-25Pass new instance instead of self.instance to simd_shuffle_indices.jumbatm-3/+3
2019-12-24x.py fmt after previous deignoreMark Rousskov-124/+85
2019-12-22Format the worldMark Rousskov-937/+898
2019-12-22Rollup merge of #66877 - skinny121:const-eval-entry-points, r=oli-obkMazdak Farrokhzad-23/+10
Add simpler entry points to const eval for common usages. I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways: - Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc. - Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants. - Evaluates a promoted constant. This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval` is normally used.
2019-12-22Add simpler entry points to const eval for common usages.Ben Lewis-23/+10
2019-12-20Rollup merge of #64588 - matthewjasper:mir-address-of, r=oli-obkMazdak Farrokhzad-21/+41
Add a raw "address of" operator * Parse and feature gate `&raw [const | mut] expr` (feature gate name is `raw_address_of`) * Add `mir::Rvalue::AddressOf` * Use the new `Rvalue` for: * the new syntax * reference to pointer casts * drop shims for slices and arrays * Stop using `mir::Rvalue::Cast` with a reference as the operand * Correctly evaluate `mir::Rvalue::{Ref, AddressOf}` in constant propagation cc @Centril @RalfJung @oli-obk @eddyb cc #64490
2019-12-18Add Rvalue::AddressOf to MIRMatthew Jasper-21/+41
This operator creates a raw pointer to a Place directly, without first creating a reference. See RFC #2582 for motivation. The Rvalue is currently unused.
2019-12-15Remove now-redundant range check on u128 -> f32 castsRobin Kruppe-36/+7
This code was added to avoid UB in LLVM 6 and earlier, but we no longer support those LLVM versions. Since https://reviews.llvm.org/D47807 (released in LLVM 7), uitofp does exactly what we need. Closes #51872
2019-12-11Auto merge of #66650 - matthewjasper:nonuniform-array-move, r=pnkfelixbors-1/+2
Remove uniform array move MIR passes This PR fixes a number of bugs caused by limitations of this pass * Projections from constant indexes weren't being canonicalized * Constant indexes from the start weren't being canonicalized (they could have different min_lengths) * It didn't apply to non-moves This PR makes the following changes to support removing this pass: * ConstantIndex of arrays are now generated in a canonical form (from the start, min_length is the actual length). * Subslices are now split when generating move paths and when checking subslices have been moved. Additionally * The parent move path of a projection from an array element is now calculated correctly closes #66502
2019-12-11Rollup merge of #67134 - oli-obk:const_prop_zst, r=wesleywiserYuki Okushi-1/+8
Ensure that we get a hard error on generic ZST constants if their bod… …y causes an error during evaluation cc #67083 (does not fix because we still need the beta backport) r? @wesleywiser cc @RalfJung
2019-12-09Make const index and subslice array projections more usefulMatthew Jasper-1/+2
* `min_length` is now exact for const index elements. * const index elements are always from the start. * make array `Subslice` `PlaceElems` count both `from` and `to` from the start.
2019-12-08Rollup merge of #66991 - Nashenas88:body_cache_cleanup, r=eddybMazdak Farrokhzad-3/+3
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-08Rollup merge of #66325 - BartMassey:master, r=joshtriplettMazdak Farrokhzad-1/+1
Change unused_labels from allow to warn Fixes #66324, making the unused_labels lint warn instead of allow by default. I'm told @rust-lang/lang will need to review this, and perhaps will want to do a crater run.
2019-12-08Ensure that we get a hard error on generic ZST constants if their body ↵Oliver Scherer-1/+8
causes an error during evaluation
2019-12-07Auto merge of #65881 - anp:implicit-caller-location, r=eddyb,oli-obkbors-12/+50
Implement #[track_caller] attribute. (RFC 2091 4/N) Implements the `#[track_caller]` attribute in both const and codegen contexts. The const implementation walks up the stack to find the nearest untracked callsite. The codegen implementation adds an implicit argument to tracked function calls, and populates it with either a call to the previously-landed intrinsic or if the caller has `#[track_caller]` with a copy of the location passed to the current function. Also includes a little cleanup and a few comments in the other caller location areas. [Depends on: 65664](https://github.com/rust-lang/rust/pull/65664) [RFC 2091 text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md) [Tracking issue](https://github.com/rust-lang/rust/issues/47809) [Tracking doc](https://paper.dropbox.com/doc/track_rfc_2091_impl-notes--Anf1NwnIb0xcRv31YLIadyj0Ag-rwCdRc2fi2yvRZ7syGZ9q#:uid=863513134494965680023183&h2=TODO-actually-pass-location-to)
2019-12-06Address review feedback.Adam Perry-4/+4
2019-12-06Caller location is propagated via immediates rather than memory.Adam Perry-8/+13
2019-12-05Pass a location to #[track_caller] functions in codegen_call_terminator.Adam Perry-4/+29
2019-12-05Add field to FunctionCx for passing caller location.Adam Perry-8/+16
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-2/+2
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-06use abort instead of unreachableRalf Jung-1/+9
2019-12-05commentsRalf Jung-2/+5
2019-12-05codegen: mark invalid SetDiscriminant unreachableRalf Jung-2/+3
2019-12-03rustc: take a PolyFnSig instead of an FnSig in FnAbi::of_fn_ptr.Eduard-Mihai Burtescu-17/+13
2019-12-03rustc: rename FnAbi::new to FnAbi::of_fn_ptr.Eduard-Mihai Burtescu-1/+1
2019-12-03rustc: compute FnAbi's for virtual calls through FnAbi::of_instance.Eduard-Mihai Burtescu-22/+26
2019-12-03rustc_codegen_ssa: use FnAbi::of_instance wherever possible.Eduard-Mihai Burtescu-5/+2
2019-12-03rustc_codegen_ssa: clean up lifetimes on TerminatorCodegenHelper's methods.Eduard-Mihai Burtescu-14/+13
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-28/+29
body.
2019-12-03rustc: expose the mir::Body reference lifetime from mir::ReadOnlyBodyCache ↵Eduard-Mihai Burtescu-7/+7
(#64736 fallout).
2019-12-02Fix issues caused during rebasingPaul Daniel Faria-1/+1
2019-12-02Remove files created during conflict resolutionPaul Daniel Faria-1696/+0
2019-12-02Fix typos caused during rebasePaul Daniel Faria-2/+1698
2019-12-02Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, ↵Paul Daniel Faria-7/+7
rename all body_cache back to body
2019-12-02Remove BodyCache.body and rely on Deref as much as possible for ↵Paul Daniel Faria-11/+13
ReadOnlyBodyCache
2019-12-02Undo minor changes that weren't needed, fix one lifetime typoPaul Daniel Faria-30/+30
2019-12-02Fix compilation errors created during rebasePaul Daniel Faria-2/+2
2019-12-02Fix tidy errorsPaul Daniel Faria-1/+5
2019-12-02Simplify BodyCache impl and fix all remaining type errors in librustc_mir ↵Paul Daniel Faria-52/+51
(lifetime errors still exist)
2019-12-02Account for new maybe_sideeffect helper that requires predecessorsPaul Daniel Faria-45/+45
2019-12-02Convert &mut to & since the reference didn't need to be mutablePaul Daniel Faria-2/+2
2019-12-02Revert back to using FunctionCx's BodyPaul Daniel Faria-147/+118
2019-12-02Add Body back as field of FunctionCx, but under a different lifetimePaul Daniel Faria-49/+46
2019-12-02Improved BodyCache body impl so it only returns a sharable ref, add new ↵Paul Daniel Faria-6/+7
body_mut method, fix visit macros, simplify usage in codegen_ssa analyzer
2019-12-02Remove Body from FunctionCx, pass it along during librustc_codegen_ssaPaul Daniel Faria-157/+182
2019-12-02Simplify Cache wrapper to single type, impl Deref on it, fix all compilation ↵Paul Daniel Faria-34/+42
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