about summary refs log tree commit diff
path: root/src/librustc_trans/base.rs
AgeCommit message (Collapse)AuthorLines
2018-05-17Rename trans to codegen everywhere.Irina Popa-1411/+0
2018-05-13Introduce OperandValue::nontemporal_store and use it in the intrinsicsAnthony Ramine-6/+13
We use a new MemFlags bitflags type to merge some store code paths.
2018-05-13Introduce OperandValue::volatile_store and use it in the intrinsicsAnthony Ramine-4/+6
Fixes #50371.
2018-05-11Add a query to convert from ConstValue to AllocationJohn Kåre Alsaker-6/+7
2018-05-11Introduce ConstValue and use it instead of miri's Value for constant valuesJohn Kåre Alsaker-15/+3
2018-05-08Insert fields from TypeAndMut into TyRef to allow layout optimizationJohn Kåre Alsaker-3/+3
2018-04-27Rename InternedString to LocalInternedString and introduce a new thread-safe ↵John Kåre Alsaker-1/+1
InternedString
2018-04-26Rename rustc_back::target to rustc_target::spec.Irina Popa-1/+1
2018-04-21rustc: Always emit `uwtable` on AndroidAlex Crichton-1/+1
Long ago (#40549) we enabled the `uwtable` attribute on Windows by default (even with `-C panic=abort`) to allow unwinding binaries for [stack unwinding information][winstack]. It looks like this same issue is [plaguing][arm1] Gecko's Android platforms [as well][arm2]. This commit applies the same fix as #40549 except that this time it's applied for all Android targets. Generating a `-C panic=abort` binary for `armv7-linux-androideabi` before this commit generated a number of `cantunwind` functions (detected with `readelf -u`) but after this commit they all list appropriate unwind information. Closes #49867 [winstack]: https://bugzilla.mozilla.org/show_bug.cgi?id=1302078 [arm1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1453220 [arm2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1451741
2018-04-12Auto merge of #49558 - Zoxc:sync-misc, r=michaelwoeristerbors-9/+9
Even more thread-safety changes r? @michaelwoerister
2018-04-10Make Session.injected_allocator and Session.allocator_kind thread-safeJohn Kåre Alsaker-1/+1
2018-04-10Make Session.crate_types thread-safeJohn Kåre Alsaker-3/+3
2018-04-10Combine Session.entry_fn and Session.entry_type and make them thread-safeJohn Kåre Alsaker-5/+5
2018-04-09Use cmp::Reverse instead of subtractionvarkor-2/+3
2018-04-09Convert sort_by_key to sort_by_cached_keyvarkor-1/+1
2018-04-07Auto merge of #49672 - alexcrichton:fix-another-std-core-cycle, ↵bors-0/+8
r=michaelwoerister Fix another circular deps link args issue It turns out that the support in #49316 wasn't enough to handle all cases notably the example in #48661. The underlying bug was connected to panic=abort where lang items were listed in the `missing_lang_items` sets but didn't actually exist anywhere. This caused the linker backend to deduce that start-group/end-group wasn't needed because not all items were defined. Instead the missing lang items that don't actually need to have a definition are filtered out and not considered for the start-group/end-group arguments Closes #48661
2018-04-06Fix ICE with `main`'s return type containing lifetimesShotaro Yamada-4/+8
2018-04-04Fix another circulare deps link args issueAlex Crichton-0/+8
It turns out that the support in #49316 wasn't enough to handle all cases notably the example in #48661. The underlying bug was connected to panic=abort where lang items were listed in the `missing_lang_items` sets but didn't actually exist anywhere. This caused the linker backend to deduce that start-group/end-group wasn't needed because not all items were defined. Instead the missing lang items that don't actually need to have a definition are filtered out and not considered for the start-group/end-group arguments Closes #48661
2018-03-29rustc: Group linked libraries where neededAlex Crichton-0/+10
This commit fixes a longstanding issue with the compiler with circular dependencies between libcore and libstd. The `core` crate requires at least one symbol, the ability to unwind. The `std` crate is the crate which actually defines this symbol, but the `std` crate also depends on the `core` crate. This circular dependency is in general disallowed in Rust as crates cannot have cycles amongst them. A special exception is made just for core/std, but this is also unfortunately incompatible with how GNU linkers work. GNU linkers will process undefined symbols in a left-to-right fashion, only actually linking an rlib like libstd if there are any symbols used from it. This strategy is incompatible with circular dependencies because if we otherwise don't use symbols from libstd we don't discover that we needed it until we're later processing libcore's symbols! To fix this GNU linkers support the `--start-group` and `--end-group` options which indicate "libraries between these markers may have circular dependencies amongst them. The linker invocation has been updated to automatically pass these arguments when we're invoking a GNU linker and automatically calculate where the arguments need to go (around libstd and libcore) Closes #18807 Closes #47074
2018-03-28Auto merge of #49019 - phil-opp:target-spec, r=pnkfelixbors-1/+2
Introduce a TargetTriple enum to support absolute target paths This PR replaces target triple strings with a `TargetTriple` enum, which represents either a target triple or a path to a JSON target file. The path variant is used if the `--target` argument has a `.json` extension, else the target triple variant is used. The motivation of this PR is support for absolute target paths to avoid the need for setting the `RUST_TARGET_PATH` environment variable (see rust-lang/cargo#4905 for more information). For places where some kind of triple is needed (e.g. in the sysroot folder), we use the file name (without extension). For compatibility, we keep the old behavior of searching for a file named `$(target_triple).json` in `RUST_TARGET_PATH` for non-official target triples.
2018-03-26Introduce a TargetTriple enum to support absolute target pathsPhilipp Oppermann-1/+2
2018-03-25try to fix the build on older LLVM versions.Emilio Cobos Álvarez-0/+7
2018-03-22rustc: Add a `#[wasm_import_module]` attributeAlex Crichton-4/+48
This commit adds a new attribute to the Rust compiler specific to the wasm target (and no other targets). The `#[wasm_import_module]` attribute is used to specify the module that a name is imported from, and is used like so: #[wasm_import_module = "./foo.js"] extern { fn some_js_function(); } Here the import of the symbol `some_js_function` is tagged with the `./foo.js` module in the wasm output file. Wasm-the-format includes two fields on all imports, a module and a field. The field is the symbol name (`some_js_function` above) and the module has historically unconditionally been `"env"`. I'm not sure if this `"env"` convention has asm.js or LLVM roots, but regardless we'd like the ability to configure it! The proposed ES module integration with wasm (aka a wasm module is "just another ES module") requires that the import module of wasm imports is interpreted as an ES module import, meaning that you'll need to encode paths, NPM packages, etc. As a result, we'll need this to be something other than `"env"`! Unfortunately neither our version of LLVM nor LLD supports custom import modules (aka anything not `"env"`). My hope is that by the time LLVM 7 is released both will have support, but in the meantime this commit adds some primitive encoding/decoding of wasm files to the compiler. This way rustc postprocesses the wasm module that LLVM emits to ensure it's got all the imports we'd like to have in it. Eventually I'd ideally like to unconditionally require this attribute to be placed on all `extern { ... }` blocks. For now though it seemed prudent to add it as an unstable attribute, so for now it's not required (as that'd force usage of a feature gate). Hopefully it doesn't take too long to "stabilize" this! cc rust-lang-nursery/rust-wasm#29
2018-03-22rustc: Add a `#[wasm_custom_section]` attributeAlex Crichton-0/+66
This commit is an implementation of adding custom sections to wasm artifacts in rustc. The intention here is to expose the ability of the wasm binary format to contain custom sections with arbitrary user-defined data. Currently neither our version of LLVM nor LLD supports this so the implementation is currently custom to rustc itself. The implementation here is to attach a `#[wasm_custom_section = "foo"]` attribute to any `const` which has a type like `[u8; N]`. Other types of constants aren't supported yet but may be added one day! This should hopefully be enough to get off the ground with *some* custom section support. The current semantics are that any constant tagged with `#[wasm_custom_section]` section will be *appended* to the corresponding section in the final output wasm artifact (and this affects dependencies linked in as well, not just the final crate). This means that whatever is interpreting the contents must be able to interpret binary-concatenated sections (or each constant needs to be in its own custom section). To test this change the existing `run-make` test suite was moved to a `run-make-fulldeps` folder and a new `run-make` test suite was added which applies to all targets by default. This test suite currently only has one test which only runs for the wasm target (using a node.js script to use `WebAssembly` in JS to parse the wasm output).
2018-03-13transition various normalization functions to the new methodsNiko Matsakis-1/+1
In particular: - `fully_normalize_monormophic_ty` => `normalize_erasing_regions` - `normalize_associated_type_in_env` => `normalize_erasing_regions` - `fully_normalize_associated_types_in` => `normalize_erasing_regions` - `erase_late_bound_regions_and_normalize` => `normalize_erasing_late_bound_regions`
2018-03-09Move PROFQ_CHAN to a Session fieldJohn Kåre Alsaker-7/+6
2018-03-08Report errors in statics during collecting instead of translatingOliver Schneider-0/+2
2018-03-08Nuke ConstInt and Const*sizeOliver Schneider-8/+0
2018-03-08Produce instead of pointersOliver Schneider-1/+1
2018-03-06Add linkage to TransFnAttrsWesley Wiser-1/+0
Part of #47320
2018-03-06Don't show crate metadata symbol as exported symbol to downstream crates.Michael Woerister-2/+2
2018-03-06Clean up handling of symbol export information.Michael Woerister-7/+5
2018-02-19Rename is_translated_fn query to is_translated_item and make it support statics.Michael Woerister-2/+3
2018-01-25Rollup merge of #47415 - varkor:cgu-partition-heuristic, r=michaelwoeristerAlex Crichton-5/+3
Add CGU size heuristic for partitioning This addresses the concern of #47316 by estimating CGU size based on the size of its MIR. Looking at the size estimate differences for a small selection of crates, this heuristic produces different orderings, which should more accurately reflect optimisation time. (Fixes #47316.) r? @michaelwoerister
2018-01-19Allow runtime switching between trans backendsbjorn3-52/+3
2018-01-19Update comments about the partitioning inefficiencyvarkor-3/+1
2018-01-19Refactor CodegenUnit size estimatesvarkor-2/+2
2018-01-14rustc_trans: rename bcx to bx.Eduard-Mihai Burtescu-54/+54
2018-01-14rustc_trans: rename ccx to cx.Eduard-Mihai Burtescu-98/+98
2018-01-14rustc_trans: rename CrateContext to CodegenCx.Eduard-Mihai Burtescu-9/+9
2018-01-14rustc_trans: access fields directly on CrateContext.Eduard-Mihai Burtescu-26/+26
2018-01-14rustc_trans: collapse {Local,Shared}CrateContext.Eduard-Mihai Burtescu-12/+9
2018-01-04Auto merge of #46916 - michaelwoerister:generate-dead-code-plz, r=alexcrichtonbors-1/+7
Generate code for unused const- and inline-fns if -Clink-dead-code is specified. Fixes https://github.com/rust-lang/rust/issues/46467. r? @alexcrichton
2018-01-04Generate code for const- and inline-fns if -Clink-dead-code is specified.Michael Woerister-1/+7
2018-01-01Update crates and submodules to pull doc fixesMalo Jaffré-1/+1
Update `rand` crate to `0.3.19`. Update `log` crate to `0.3.9` and `0.4.1`. Update `parking_lot_core` crate to `0.2.9`. Upgrade all flate2 dependencies to `1.0.1`. - Update `rust-installer` submodule.
2017-12-26Don't use `process::exit` as it is an `unreachable` on wasm32Bastian Köcher-10/+2
2017-12-26Fixes compile bug caused by upstream changesBastian Köcher-1/+1
2017-12-26Implements RFC 1937: `?` in `main`Bastian Köcher-9/+25
This is the first part of the RFC 1937 that supports new `Termination` trait in the rust `main` function.
2017-12-22Auto merge of #46842 - michaelwoerister:fingerprint-vec, r=nikomatsakisbors-3/+2
incr.comp.: Use an array instead of a hashmap for storing result hashes. Doing so should result in some of the core tracking components being faster. r? @nikomatsakis
2017-12-20Rollup merge of #46751 - michaelwoerister:c-incremental, r=alexcrichtonkennytm-1/+1
incr.comp.: Add `-C incremental` in addition to `-Z incremental` This PR adds a stable commandline option for invoking incremental compilation. r? @alexcrichton