about summary refs log tree commit diff
path: root/src/librustc_trans/trans
AgeCommit message (Collapse)AuthorLines
2016-03-27rustc_trans: move the contents of the trans module to top-level.Eduard Burtescu-34547/+0
2016-03-27rustc: move cfg, infer, traits and ty from middle to top-level.Eduard Burtescu-105/+104
2016-03-27rustc: move middle::subst into middle::ty.Eduard Burtescu-24/+24
2016-03-26Fix removal of function attributes on ARMBjörn Steinbrink-25/+6
We use a 64bit integer to pass the set of attributes that is to be removed, but the called C function expects a 32bit integer. On most platforms this doesn't cause any problems other than being unable to unset some attributes, but on ARM even the lower 32bit aren't handled correctly because the 64bit value is passed in different registers, so the C function actually sees random garbage. So we need to fix the relevant functions to use 32bit integers instead. Additionally we need an implementation that actually accepts 64bit integers because some attributes can only be unset that way. Fixes #32360
2016-03-26Rollup merge of #32469 - nikomatsakis:shared-cgu, r=eddybManish Goregaokar-3/+3
make available monomorphizations shared by CGU The current setup means that all generics are local to a codegen-unit, which means massive duplication.
2016-03-25rip out link guardsNiko Matsakis-142/+0
As discussed in https://github.com/rust-lang/rust/pull/32293#issuecomment-200597130, adding link guards are a heuristic that is causing undue complications: - the link guards inject extra public symbols, which is not always OK. - link guards as implemented could be a non-trivial performance hit, because no attempt is made to "de-duplicate" the dependency graph, so at worst you have O(N!) calls to the link guard functions. Nonetheless, link guards are very helpful in detecting errors, so it may be worth adding them back in some modified form in the future.
2016-03-25Correections due to refactoring .Niko Matsakis-12/+15
2016-03-25unit-test symbol-names and item-pathsNiko Matsakis-0/+88
2016-03-25add krate_attrs accessorNiko Matsakis-4/+1
makes better edges in dep graph
2016-03-25store krate information more uniformlyNiko Matsakis-16/+8
make DefPath store krate and enable uniform access to crate_name/crate_disambiguator
2016-03-25Add a "link-guard" to avoid accidentally linking to a wrong dylib at runtime.Michael Woerister-0/+141
We want to prevent compiling something against one version of a dynamic library and then, at runtime accidentally using a different version of the dynamic library. With the old symbol-naming scheme this could not happen because every symbol had the SVH in it and you'd get an error by the dynamic linker when using the wrong version of a dylib. With the new naming scheme this isn't the case any more, so this patch adds the "link-guard" to prevent this error case. This is implemented as follows: - In every crate that we compile, we emit a function called "__rustc_link_guard_<crate-name>_<crate-svh>" - The body of this function contains calls to the "__rustc_link_guard" functions of all dependencies. - An executable contains a call to it's own "__rustc_link_guard" function. As a consequence the "__rustc_link_guard" function call graph mirrors the crate graph and the dynamic linker will fail if a wrong dylib is loaded somewhere because its "__rustc_link_guard" function will contain a different SVH in its name.
2016-03-25Use new symbol names for items of various kinds.Michael Woerister-8/+9
2016-03-25Use new symbol naming scheme for object shims.Michael Woerister-2/+3
2016-03-25Use new symbol naming scheme for fn-once-shims.Michael Woerister-2/+3
2016-03-25Use new symbol naming scheme for fn-pointer-shims.Michael Woerister-3/+5
2016-03-25Make drop glue use new symbol naming scheme.Michael Woerister-2/+7
2016-03-25Make closures use stable symbol names.Michael Woerister-3/+2
2016-03-25Make monomorphized functions use stable symbol names.Michael Woerister-19/+12
2016-03-25Add missing entries for enum variants in trans::CrateContext::external_srcs.Michael Woerister-0/+2
2016-03-24Auto merge of #32428 - nikomatsakis:scopes-in-mir, r=nagisabors-9/+9
Scopes in mir This PR adds scopes to MIR. There is a tree of scopes (each represented by a `ScopeId`). Every statement, variable, and terminator now has an associated scope and span. It also adds a `-Z dump-mir` switch one can use to conveniently examine the MIR as optimizations proceed. The intention is two-fold. First, to support MIR debug-info. This PR does not attempt to modify trans to make use of the scope information, however. Second, in a more temporary capacity, to support the goal of moving regionck and borowck into the MIR. To that end, the PR also constructs a "scope auxiliary" table storing the extent of each span (this is kept separate from the main MIR, since it contains node-ids) and the dom/post-dom of the region in the graph where the scope occurs. When we move to non-lexical lifetimes, I expect this auxiliary information to be discarded, but that is still some ways in the future (requires, at minimum, an RFC, and there are some thorny details to work out -- though I've got an in-progress draft). Right now, I'm just dropping this auxiliary information after it is constructed. I was debating for some time whether to add some sort of sanity tests, but decided to just open this PR instead, because I couldn't figure out what such a test would look like (and we don't have independent tests for this today beyond the regionck and borrowck tests). I'd prefer not to store the auxiliary data into any kind of "per-fn" map. Rather, I'd prefer that we do regionck/borrowck/whatever-else immediately after construction -- that is, we build the MIR for fn X and immediately thereafter do extended correctness checking on it. This will reduce peak memory usage and also ensure that the auxiliary data doesn't exist once optimizations begin. It also clarifies the transition point where static checks are complete and MIR can be more freely optimized. cc @rust-lang/compiler @nagisa
2016-03-24make available monomorphizations shared by CGUNiko Matsakis-3/+3
The current setup means that all generics are local to a codegen-unit, which means massive duplication.
2016-03-24remove `empty_substs_for_node_id`Niko Matsakis-11/+3
2016-03-24remove ErasedRegions from substitutionsNiko Matsakis-64/+79
This hack has long since outlived its usefulness; the transition to trans passing around full substitutions is basically done. Instead of `ErasedRegions`, just supply substitutions with a suitable number of `'static` entries, and invoke `erase_regions` when needed (the latter of which we already do).
2016-03-23Address nit: Remove `ScopedDataVec` newtypeNiko Matsakis-1/+0
2016-03-23extend Terminator into a struct so it can have additional fieldsNiko Matsakis-9/+10
2016-03-23Auto merge of #32454 - eddyb:rollup, r=eddybbors-1/+1
Rollup of 11 pull requests - Successful merges: #32404, #32420, #32423, #32425, #32429, #32430, #32431, #32434, #32437, #32441, #32443 - Failed merges:
2016-03-23Rollup merge of #32430 - sanxiyn:const-trans, r=arielb1Eduard-Mihai Burtescu-1/+1
Fix const trans Fix #30615. The idea was that when there are N autoderefs, first do N-1 derefs and check for autoref. If there is autoref, done, if not, do one more deref. But when N is zero, doing one more deref is wrong.
2016-03-23Auto merge of #32390 - japaric:untry, r=pnkfelixbors-35/+35
convert 99.9% of `try!`s to `?`s The first commit is an automated conversion using the [untry] tool and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [untry]: https://github.com/japaric/untry cc @rust-lang/lang @alexcrichton @brson
2016-03-23Auto merge of #32410 - Ticki:master, r=eddybbors-0/+14
Add support for naked functions See https://github.com/rust-lang/rfcs/pull/1201#issuecomment-199442239 This PR adds `#[naked]` for marking naked functions.
2016-03-22fix alignmentJorge Aparicio-1/+1
2016-03-22try! -> ?Jorge Aparicio-35/+35
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-23Fix const transSeo Sanghyeon-1/+1
Const was dereferenced when autoderefs is zero.
2016-03-22Auto merge of #32156 - pnkfelix:borrowck-on-mir-move-analysis, r=nikomatsakisbors-2/+6
Move analysis for MIR borrowck This PR adds code for doing MIR-based gathering of the moves in a `fn` and the dataflow to determine where uninitialized locations flow to, analogous to how the same thing is done in `borrowck`. It also adds a couple attributes to print out graphviz visualizations of the analyzed MIR that includes the dataflow analysis results. cc @nikomatsakis
2016-03-21Add support for naked functionsTicki-0/+14
2016-03-21Switch libgraphviz from type params to associated types for Node/Edge.Felix S. Klock II-2/+6
2016-03-21Fix tupling of fn args for rust-call ABI functionsBjörn Steinbrink-0/+1
Fixes #32389
2016-03-20Auto merge of #32010 - devonhollowood:non-c-like-enum-repr, r=Aatchbors-5/+14
Add tests for #26114 First step in fixing #26114
2016-03-19Auto merge of #32244 - Amanieu:compare_exchange_result, r=alexcrichtonbors-15/+12
Change compare_exchange to return a Result<T, T> As per the discussion in #31767 I also changed the feature name from `extended_compare_and_swap` to `compare_exchange`. r? @alexcrichton
2016-03-19Change compare_exchange to return a Result<T, T>Amanieu d'Antras-15/+12
2016-03-19Rollup merge of #32347 - Amanieu:volatile_fat_ptr, r=eddybEduard-Mihai Burtescu-8/+13
Fix volatile stores of fat pointers This was previously causing an LLVM assertion. r? @eddyb
2016-03-19Fix volatile stores of fat pointersAmanieu d'Antras-8/+13
2016-03-18Add intrinsics for float arithmetic with `fast` flag enabledUlrik Sverdrup-0/+143
`fast` a.k.a UnsafeAlgebra is the flag for enabling all "unsafe" (according to llvm) float optimizations. See LangRef for more information http://llvm.org/docs/LangRef.html#fast-math-flags Providing these operations with less precise associativity rules (for example) is useful to numerical applications. For example, the summation loop: let sum = 0.; for element in data { sum += *element; } Using the default floating point semantics, this loop expresses the floats must be added in a sequence, one after another. This constraint is usually completely unintended, and it means that no autovectorization is possible.
2016-03-18trans: Don't ignore zero-sized struct arguments on x86_64-pc-windows-gnu.Eduard Burtescu-4/+17
2016-03-18trans: Decide whether to load volatile_store's argument based on its ArgType.Eduard Burtescu-3/+3
2016-03-18trans: Pass newtypes of immediates as their inner-most type again.Eduard Burtescu-2/+18
2016-03-17mir: Don't memset allocas of types that do not require drop.Eduard Burtescu-1/+3
2016-03-17mir: Store immediates used for indirect arguments in an alloca.Eduard Burtescu-1/+1
2016-03-17trans: Do not depend on having Expr's around for generic_simd_intrinsic.Eduard Burtescu-11/+15
2016-03-17const_eval: Take just one set of substitutions in lookup_const_by_id.Eduard Burtescu-14/+8
2016-03-17mir: Use usize instead of u32 for indexing slices.Eduard Burtescu-3/+3