about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2018-09-11stabalize infer outlives requirements (RFC 2093).toidiu-1/+0
Co-authored-by: nikomatsakis
2018-09-11renamed is_nil to is_unitkenta7777-3/+3
2018-09-11Revert "renamed is_nil to is_unit"kenta7777-3/+3
This reverts commit 6f685ffad42a2d12dd1fad5ccb0471e7fa260826.
2018-09-10add the `AscribeUserType` statement kindNiko Matsakis-1/+1
Make it have the semantics of subtype.
2018-09-10renamed mk_nil to mk_unitkenta7777-1/+1
2018-09-10renamed is_nil to is_unitkenta7777-3/+3
2018-09-09Auto merge of #53998 - eddyb:issue-53728, r=oli-obkbors-12/+19
rustc_codegen_llvm: don't assume offsets are always aligned. Fixes #53728 by taking into account not just overall type alignment and the field's alignment when determining whether a field is aligned or not ("packed"), but also the field's offset within the type. Previously, rustc assumed that the offset was always at least as aligned as `min(struct.align, field.align)`. However, there's no real reason to have that assumption, and it obviously can't always be true after we implement `#[repr(align(N), pack(K))]`. There's also a case today where that assumption is not true, involving niche discriminants in enums: Suppose that we have the code in #53728: ```Rust #[repr(u16)] enum DeviceKind { Nil = 0, } #[repr(packed)] struct DeviceInfo { endianness: u8, device_kind: DeviceKind, } struct Wrapper { device_info: DeviceInfo, data: u32 } ``` Observe the layout of `Option<Wrapper>`. It has an alignment of 4 because of the `u32`. `device_info.device_kind` is a good niche field to use, which means the enum ends up with this layout: ``` size = 8 align = 4 fields = [ { offset=1, type=u16 } // discriminant, .<Some>.device_info.device_kind ] ``` And here we have an discriminant with alignment 2 (`u16`) but offset 1.
2018-09-08Auto merge of #53705 - ms2300:tmp, r=oli-obkbors-1/+1
#53576 Renaming TyAnon -> TyOpaque Fixes #53576
2018-09-07make field always private, add `From` implsNiko Matsakis-3/+1
2018-09-06rustc_codegen_llvm: don't assume offsets are always aligned.Eduard-Mihai Burtescu-12/+19
2018-09-05Auto merge of #53962 - michaelwoerister:close-thinlto-file-descriptors, ↵bors-4/+4
r=alexcrichton ThinLTO: Don't keep files open after mmaping them. Fixes #53947. r? @alexcrichton
2018-09-05Changing TyAnon -> TyOpaque and relevant functionsms2300-1/+1
2018-09-05Auto merge of #53878 - alexcrichton:wasm-atomics-feature, r=eddybbors-4/+14
rustc: Prepare the `atomics` feature for wasm This commit adds a few changes for atomic instructions on the `wasm32-unknown-unknown` target. Atomic instructions are not yet stable in WebAssembly itself but there are multiple implementations and LLVM has support for the proposed instruction set, so let's work on exposing it! Here there are a few inclusions: * The `atomics` feature was whitelisted for LLVM, allowing code in Rust to enable/disable/gate on this. * The `singlethread` option is turned off for wasm when the `atomics` feature is enabled. This means that by default wasm won't be lowering with atomics, but when atomics are enabled globally we'll turn off single-threaded mode to actually codegen atomics. This probably isn't what we'll want in the long term but for now it should work. * Finally the maximum atomic width is increased to 64 to reflect the current wasm spec.
2018-09-05ThinLTO: Don't keep files open after mmaping them (because it's not needed).Michael Woerister-4/+4
2018-09-05Allow for opting out of ThinLTO and clean up LTO related cli flag handling.Michael Woerister-8/+4
2018-09-03Auto merge of #53926 - japaric:arm-features, r=alexcrichtonbors-0/+4
whitelist some ARM features required for rust-lang-nursery/stdsimd#557 r? @gnzlbg or @alexcrichton
2018-09-03whitelist some ARM featuresJorge Aparicio-0/+4
2018-09-03incr.ThinLTO: Do some cleanup and add some logging.Michael Woerister-62/+57
2018-08-31rustc: Prepare the `atomics` feature for wasmAlex Crichton-4/+14
This commit adds a few changes for atomic instructions on the `wasm32-unknown-unknown` target. Atomic instructions are not yet stable in WebAssembly itself but there are multiple implementations and LLVM has support for the proposed instruction set, so let's work on exposing it! Here there are a few inclusions: * The `atomics` feature was whitelisted for LLVM, allowing code in Rust to enable/disable/gate on this. * The `singlethread` option is turned off for wasm when the `atomics` feature is enabled. This means that by default wasm won't be lowering with atomics, but when atomics are enabled globally we'll turn off single-threaded mode to actually codegen atomics. This probably isn't what we'll want in the long term but for now it should work. * Finally the maximum atomic width is increased to 64 to reflect the current wasm spec.
2018-08-31Always add all modules to the global ThinLTO module analysis when compiling ↵Michael Woerister-359/+159
incrementally.
2018-08-31Support local ThinLTO with incremental compilation.Michael Woerister-256/+608
2018-08-31Make codegen not be a query (since it's not a real query anyway).Michael Woerister-13/+22
2018-08-31Persist ThinLTO import data in incr. comp. session directory.Michael Woerister-4/+137
2018-08-31Provide a way of accessing the ThinLTO module import map in rustc.Michael Woerister-0/+9
2018-08-30Rollup merge of #53472 - eddyb:fx-pls, r=pnkfelixPietro Albini-4/+4
Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc. Most of the compiler uses the `Fx` hasher but some places ended up with the default one.
2018-08-29Auto merge of #53642 - alexcrichton:fix-target-cpu-native, r=arielb1bors-3/+25
Fix warnings about the `native` target-cpu This fixes a regression from #53031 where specifying `-C target-cpu=native` is printing a lot of warnings from LLVM about `native` being an unknown CPU. It turns out that `native` is indeed an unknown CPU and we have to perform a mapping to an actual CPU name, but this mapping is only performed in one location rather than all locations we inform LLVM about the target CPU. This commit centralizes the mapping of `native` to LLVM's value of the native CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's never `native`. Closes #53322
2018-08-29Auto merge of #53671 - RalfJung:miri-refactor, r=oli-obkbors-4/+4
Miri engine cleanup * Unify the two maps in memory to store the allocation and its kind together. * Share the handling of statics between CTFE and miri: The miri engine always uses "lazy" `AllocType::Static` when encountering a static. Acessing that static invokes CTFE (no matter the machine). The machine only has any influence when writing to a static, which CTFE outright rejects (but miri makes a copy-on-write). * Add an `AllocId` to by-ref consts so miri can use them as operands without making copies. * Move responsibilities around for the `eval_fn_call` machine hook: The hook just has to find the MIR (or entirely take care of everything); pushing the new stack frame is taken care of by the miri engine. * Expose the intrinsics and lang items implemented by CTFE so miri does not have to reimplement them. * Allow Machine to hook into foreign statics (used by miri to get rid of some other hacks). * Clean up function calling. * Switch const sanity check to work on operands, not mplaces. * Move const_eval out of rustc_mir::interpret, to make sure that it does not access private implementation details. In particular, we can finally make `eval_operand` take `&self`. :-) Should be merged after https://github.com/rust-lang/rust/pull/53609, across which I will rebase.
2018-08-28Fix warnings about the `native` target-cpuAlex Crichton-3/+25
This fixes a regression from #53031 where specifying `-C target-cpu=native` is printing a lot of warnings from LLVM about `native` being an unknown CPU. It turns out that `native` is indeed an unknown CPU and we have to perform a mapping to an actual CPU name, but this mapping is only performed in one location rather than all locations we inform LLVM about the target CPU. This commit centralizes the mapping of `native` to LLVM's value of the native CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's never `native`. Closes #53322
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-4/+4
2018-08-27Rename hir::map::NodeKind to hir::Nodevarkor-8/+8
2018-08-27Remove path prefixes from NodeKindvarkor-7/+8
2018-08-27Rename hir::map::Node to hir::map::NodeKindvarkor-6/+6
2018-08-27Auto merge of #53441 - toidiu:ak-fix53419, r=nikomatsakisbors-0/+1
fix for late-bound regions Fix for https://github.com/rust-lang/rust/issues/53419 r? @nikomatsakis
2018-08-27Miri Memory WorkRalf Jung-4/+4
* Unify the two maps in memory to store the allocation and its kind together. * Share the handling of statics between CTFE and miri: The miri engine always uses "lazy" `AllocType::Static` when encountering a static. Acessing that static invokes CTFE (no matter the machine). The machine only has any influence when writing to a static, which CTFE outright rejects (but miri makes a copy-on-write). * Add an `AllocId` to by-ref consts so miri can use them as operands without making copies. * Move responsibilities around for the `eval_fn_call` machine hook: The hook just has to find the MIR (or entirely take care of everything); pushing the new stack frame is taken care of by the miri engine. * Expose the intrinsics and lang items implemented by CTFE so miri does not have to reimplement them.
2018-08-24Auto merge of #53225 - nikomatsakis:nll-type-annot, r=pnkfelixbors-1/+1
MIR: support user-given type annotations on fns, structs, and enums This branch adds tooling to track user-given type annotations on functions, structs, and enum variant expressions. The user-given types are passed onto NLL which then enforces them. cc #47184 — not a complete fix, as there are more cases to cover r? @eddyb cc @rust-lang/wg-compiler-nll
2018-08-24check that adding infer-outlives requirement to all crates worksNiko Matsakis-0/+1
2018-08-24support user-given types in adtsNiko Matsakis-1/+1
2018-08-23Fix an AMDGPU related load bit range metadata assertion.Richard Diamond-0/+8
2018-08-23AMDGPU ignores `noinline` when it slaps `alwaysinline` everywhere.Richard Diamond-5/+10
Allow target specs to disable that attribute.
2018-08-23use String::new() instead of String::from(""), "".to_string(), "".to_owned() ↵Matthias Krüger-2/+2
or "".into()
2018-08-22Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str}varkor-102/+102
2018-08-22Remove Ty prefix from Ty{Foreign|Param}varkor-6/+6
2018-08-22Remove Ty prefix from ↵varkor-107/+107
Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-08-22Rename ty::TyVariants to ty::TyKindvarkor-1/+1
2018-08-22miri/CTFE refactorRalf Jung-3/+4
* Value gets renamed to Operand, so that now interpret::{Place, Operand} are the "dynamic" versions of mir::{Place, Operand}. * Operand and Place share the data for their "stuff is in memory"-base in a new type, MemPlace. This also makes it possible to give some more precise types in other areas. Both Operand and MemPlace have methods available to project into fields (and other kinds of projections) without causing further allocations. * The type for "a Scalar or a ScalarPair" is called Value, and again used to give some more precise types. * All of these have versions with an attached layout, so that we can more often drag the layout along instead of recomputing it. This lets us get rid of `PlaceExtra::Downcast`. MPlaceTy and PlaceTy can only be constructed in place.rs, making sure the layout is handled properly. (The same should eventually be done for ValTy and OpTy.) * All the high-level functions to write typed memory take a Place, and live in place.rs. All the high-level typed functions to read typed memory take an Operand, and live in operands.rs.
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-3/+3
Fix typos found by codespell.
2018-08-21Rollup merge of #53465 - bjorn3:remove_link_meta_struct, r=varkorkennytm-19/+14
Remove LinkMeta struct Fixes #53291
2018-08-20Auto merge of #52101 - japaric:linker-flavor, r=alexcrichtonbors-36/+88
try to infer linker flavor from linker name and vice versa This is a second take on PR #50359 that implements the logic proposed in https://github.com/rust-lang/rust/pull/50359#pullrequestreview-116663121 With this change it would become possible to link `thumb*` binaries using GNU's LD on stable as `-C linker=arm-none-eabi-ld` would be enough to change both the linker and the linker flavor from their default values of `arm-none-eabi-gcc` and `gcc`. To link `thumb*` binaries using rustc's LLD on stable `-Z linker-flavor` would need to be stabilized as `-C linker=rust-lld -Z linker-flavor=ld.lld` are both required to change the linker and the linker flavor, but this PR doesn't propose that. We would probably need some sort of stability guarantee around `rust-lld`'s name and availability to make linking with rustc's LLD truly stable. With this change it would also be possible to link `thumb*` binaries using a system installed LLD on stable using the `-C linker=ld.lld` flag (provided that `ld.lld` is a symlink to the system installed LLD). r? @alexcrichton
2018-08-19fix: preserve msvc linker fallback logicJorge Aparicio-1/+3
2018-08-19mv codemap() source_map()Donato Sciarra-4/+4