about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-1/+1
2020-05-22Rollup merge of #72435 - petrochenkov:cratetypesopt, r=Mark-SimulacrumRalf Jung-41/+9
rustllvm: Fix warnings about unused function parameters And then perform corresponding cleanups on Rust side. Fixes https://github.com/rust-lang/rust/issues/72427
2020-05-22Rollup merge of #72376 - wesleywiser:record_cgu_name, r=Mark-SimulacrumRalf Jung-1/+1
[self-profling] Record the cgu name when doing codegen for a module
2020-05-22Rollup merge of #72438 - vertexclique:vcq/aarch64-tme-features, r=AmanieuRalf Jung-0/+1
Enable ARM TME (Transactional Memory Extensions) Enables ARM TME coming up with LLVM 10. Related ARM TME intrinsics are included by the merge of #67900. Enables: https://github.com/rust-lang/stdarch/pull/855
2020-05-22Rollup merge of #72309 - petrochenkov:linkunspec, r=matthewjasperRalf Jung-2/+2
Some renaming and minor refactoring for `NativeLibraryKind`
2020-05-21Enable ARM TME (Transactional Memory Extensions)Mahmut Bulut-0/+1
2020-05-21rustllvm: Fix warnings about unused function parametersVadim Petrochenkov-41/+9
2020-05-21Auto merge of #71718 - NeoRaider:ffi_const_pure, r=Amanieubors-0/+6
Experimentally add `ffi_const` and `ffi_pure` extern fn attributes Add FFI function attributes corresponding to clang/gcc/... `const` and `pure`. Rebased version of #58327 by @gnzlbg with the following changes: - Switched back from the `c_ffi_const` and `c_ffi_pure` naming to `ffi_const` and `ffi_pure`, as I agree with https://github.com/rust-lang/rust/pull/58327#issuecomment-462718772 and this nicely aligns with `ffi_returns_twice` - (Hopefully) took care of all of @hanna-kruppe's change requests in the original PR r? @hanna-kruppe
2020-05-21Rollup merge of #72397 - petrochenkov:tiny, r=AmanieuRalf Jung-1/+1
llvm: Expose tiny code model to users This model is relevant to embedded AArch64 targets and was added to LLVM relatively recently (https://reviews.llvm.org/D49673, mid 2018), so rustc frontend didn't provide access to it with `-C code-model`. The gcc analogue is [`-mcmodel=tiny`](https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html). (This is one of the options that are passed directly to LLVM without being interpreted by rustc.) Follow up to https://github.com/rust-lang/rust/pull/72248.
2020-05-21Auto merge of #70705 - lcnr:generic_discriminant, r=nikomatsakisbors-3/+9
Use `T`'s discriminant type in `mem::Discriminant<T>` instead of `u64`. fixes #70509 Adds the lang-item `discriminant_kind`. Updates the function signature of `intrinsics::discriminant_value`. Adds the *probably permanently unstable* trait `DiscriminantKind`. `mem::Discriminant` should now be smaller in some cases. r? @ghost
2020-05-20llvm: Expose tiny code model to usersVadim Petrochenkov-1/+1
2020-05-20Rename some types describing native librariesVadim Petrochenkov-2/+2
NativeLibrary(Kind) -> NativeLib(Kind) NativeStatic -> StaticBundle NativeStaticNobundle -> StaticNoBundle NativeFramework -> Framework NativeRawDylib -> RawDylib NativeUnknown -> Unspecified
2020-05-20[self-profling] Record the cgu name when doing codegen for a moduleWesley Wiser-1/+1
2020-05-20Implement `#[ffi_const]` and `#[ffi_pure]` function attributesMatthias Schiffer-0/+6
Introduce function attribute corresponding to the `const`/`pure` attributes supported by GCC, clang and other compilers. Based on the work of gnzlbg <gonzalobg88@gmail.com>.
2020-05-19update codegen of `discriminant_value`Bastian Kauschke-3/+9
2020-05-18Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_astAmanieu d'Antras-0/+1
2020-05-18Implement att_syntax optionAmanieu d'Antras-1/+5
2020-05-18Work around more LLVM limitationsAmanieu d'Antras-1/+76
2020-05-18Add support for high byte registers on x86Amanieu d'Antras-0/+3
2020-05-18Implement asm! codegenAmanieu d'Antras-15/+465
2020-05-18Add RISC-V target featuresAmanieu d'Antras-0/+11
2020-05-17Auto merge of #72248 - petrochenkov:codemodel, r=Amanieubors-26/+15
Cleanup and document `-C code-model` r? @Amanieu
2020-05-16rustc_target: Stop using "string typing" for code modelsVadim Petrochenkov-26/+15
Introduce `enum CodeModel` instead.
2020-05-14Consistently use LLVM lifetime markers during codegenTomasz Miąsko-11/+5
Ensure that inliner inserts lifetime markers if they have been emitted during codegen. Otherwise if allocas from inlined functions are merged together, lifetime markers from one function might invalidate load & stores performed by the other one.
2020-05-09Rollup merge of #71555 - cjgillot:nameless, r=matthewjasperRalf Jung-6/+4
Remove ast::{Ident, Name} reexports. The reexport of `Symbol` into `Name` confused me.
2020-05-09Rollup merge of #71508 - oli-obk:alloc_map_unlock, r=RalfJungRalf Jung-6/+4
Simplify the `tcx.alloc_map` API This PR changes all functions that require manually locking the `alloc_map` to functions on `TyCtxt` that lock the map internally. In the same step we make the `TyCtxt::alloc_map` field private. r? @RalfJung
2020-05-09Rollup merge of #71234 - maurer:init-array, r=cuviperRalf Jung-0/+9
rustllvm: Use .init_array rather than .ctors LLVM TargetMachines default to using the (now-legacy) .ctors representation of init functions. Mixing .ctors and .init_array representations can cause issues when linking with lld. This happens in practice for: * Our profiling runtime which is currently implicitly built with .init_array since it is built by clang, which sets this field. * External C/C++ code that may be linked into the same process. Fixes: #71233
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-6/+4
2020-05-08Create a convenience wrapper for `get_global_alloc(id).unwrap()`Oliver Scherer-5/+4
2020-05-08Simplify the `tcx.alloc_map` APIOliver Scherer-2/+1
2020-05-08Simplify bitcode embedding - either None or FullTom Karpiniec-5/+3
2020-05-07Provide configurable LLVM cmdline section via target specTom Karpiniec-6/+8
The App Store performs certain sanity checks on bitcode, including that an acceptable set of command line arguments was used when compiling a given module. For Rust code to be distributed on the app store with bitcode rustc must pretend to have the same command line arguments.
2020-05-05Rollup merge of #69984 - lenary:lenary/force-uwtables, r=hanna-kruppeDylan DPC-5/+2
Add Option to Force Unwind Tables When panic != unwind, `nounwind` is added to all functions for a target. This can cause issues when a panic happens with RUST_BACKTRACE=1, as there needs to be a way to reconstruct the backtrace. There are three possible sources of this information: forcing frame pointers (for which an option exists already), debug info (for which an option exists), or unwind tables. Especially for embedded devices, forcing frame pointers can have code size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads). In production code, it can be the case that debug info is not kept, so it is useful to provide this third option, unwind tables, that users can use to reconstruct the call stack. Reconstructing this stack is harder than with frame pointers, but it is still possible. --- This came up in discussion on #69890, and turned out to be a fairly simple addition. r? @hanna-kruppe
2020-05-04Correctly handle UEFI targets as Windows-like when emitting sections for ↵Isaac Woods-1/+3
LLVM bitcode
2020-05-04Add Option to Force Unwind TablesSam Elliott-5/+2
When panic != unwind, `nounwind` is added to all functions for a target. This can cause issues when a panic happens with RUST_BACKTRACE=1, as there needs to be a way to reconstruct the backtrace. There are three possible sources of this information: forcing frame pointers (for which an option exists already), debug info (for which an option exists), or unwind tables. Especially for embedded devices, forcing frame pointers can have code size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads). In code, it can be the case that debug info is not kept, so it is useful to provide this third option, unwind tables, that users can use to reconstruct the call stack. Reconstructing this stack is harder than with frame pointers, but it is still possible. This commit adds a compiler option which allows a user to force the addition of unwind tables. Unwind tables cannot be disabled on targets that require them for correctness, or when using `-C panic=unwind`.
2020-05-02Rollup merge of #71787 - tshepang:rustdoc-warnings, r=varkorDylan DPC-3/+4
fix rustdoc warnings
2020-05-02cleanup: `config::CrateType` -> `CrateType`Vadim Petrochenkov-11/+9
2020-05-02fix rustdoc warningsTshepang Lekhonkhobe-3/+4
2020-05-01Auto merge of #70674 - cjgillot:query-arena-all, r=matthewjasperbors-10/+7
Have the per-query caches store the results on arenas This PR leverages the cache for each query to serve as storage area for the query results. It introduces a new cache `ArenaCache`, which moves the result to an arena, and only stores the reference in the hash map. This allows to remove a sizeable part of the usage of the global `TyCtxt` arena. I only migrated queries that already used arenas before.
2020-04-30Add a convenience function for testing whether a static is `#[thread_local]`Oliver Scherer-0/+1
2020-04-30Auto merge of #70175 - Amanieu:remove_nlp, r=pnkfelixbors-2/+6
Remove -Z no-landing-pads flag Since #67502, `-Z no-landing-pads` will cause all attempted unwinds to abort since we don't generate a `try` / `catch`. This previously worked because `__rust_try` was located in libpanic_unwind which is always compiled with `-C panic=unwind`, but `__rust_try` is now directly inline into the crate that uses `catch_unwind`. As such, `-Z no-landing-pads` is now mostly useless and people should use `-C panic=abort` instead.
2020-04-29Auto merge of #71528 - alexcrichton:no-more-bitcode, r=nnethercotebors-177/+90
Store LLVM bitcode in object files, not compressed This commit is an attempted resurrection of #70458 where LLVM bitcode emitted by rustc into rlibs is stored into object file sections rather than in a separate file. The main rationale for doing this is that when rustc emits bitcode it will no longer use a custom compression scheme which makes it both easier to interoperate with existing tools and also cuts down on compile time since this compression isn't happening. The blocker for this in #70458 turned out to be that native linkers didn't handle the new sections well, causing the sections to either trigger bugs in the linker or actually end up in the final linked artifact. This commit attempts to address these issues by ensuring that native linkers ignore the new sections by inserting custom flags with module-level inline assembly. Note that this does not currently change the API of the compiler at all. The pre-existing `-C bitcode-in-rlib` flag is co-opted to indicate whether the bitcode should be present in the object file or not. Finally, note that an important consequence of this commit, which is also one of its primary purposes, is to enable rustc's `-Clto` bitcode loading to load rlibs produced with `-Clinker-plugin-lto`. The goal here is that when you're building with LTO Cargo will tell rustc to skip codegen of all intermediate crates and only generate LLVM IR. Today rustc will generate both object code and LLVM IR, but the object code is later simply thrown away, wastefully.
2020-04-29Use .init_array rather than .ctorsMatthew Maurer-0/+9
LLVM TargetMachines default to using the (now-legacy) .ctors representation of init functions. Mixing .ctors and .init_array representations can cause issues when linking with lld. This happens in practice for: * Our profiling runtime which is currently implicitly built with .init_array since it is built by clang, which sets this field. * External C/C++ code that may be linked into the same process. To support legacy systems which may use .ctors, targets may now specify that they use .ctors via the use_ctors attribute which defaults to false. For debugging and manual control, -Z use-ctors-section=yes/no will allow manual override. Fixes: #71233
2020-04-29Store LLVM bitcode in object files, not compressedAlex Crichton-177/+90
This commit is an attempted resurrection of #70458 where LLVM bitcode emitted by rustc into rlibs is stored into object file sections rather than in a separate file. The main rationale for doing this is that when rustc emits bitcode it will no longer use a custom compression scheme which makes it both easier to interoperate with existing tools and also cuts down on compile time since this compression isn't happening. The blocker for this in #70458 turned out to be that native linkers didn't handle the new sections well, causing the sections to either trigger bugs in the linker or actually end up in the final linked artifact. This commit attempts to address these issues by ensuring that native linkers ignore the new sections by inserting custom flags with module-level inline assembly. Note that this does not currently change the API of the compiler at all. The pre-existing `-C bitcode-in-rlib` flag is co-opted to indicate whether the bitcode should be present in the object file or not. Finally, note that an important consequence of this commit, which is also one of its primary purposes, is to enable rustc's `-Clto` bitcode loading to load rlibs produced with `-Clinker-plugin-lto`. The goal here is that when you're building with LTO Cargo will tell rustc to skip codegen of all intermediate crates and only generate LLVM IR. Today rustc will generate both object code and LLVM IR, but the object code is later simply thrown away, wastefully.
2020-04-29Remove Session::no_landing_pads()Amanieu d'Antras-2/+6
2020-04-28Move a few queries to using an arena.Camille GILLOT-1/+1
2020-04-28Use the query system to allocate.Camille GILLOT-9/+6
2020-04-28Auto merge of #71292 - marmeladema:queries-local-def-id, r=eddybbors-1/+1
Convert more queries to use `LocalDefId` This PR is based on commits in https://github.com/rust-lang/rust/pull/71215 and should partially solve #70853
2020-04-27Change return type of `entry_fn` query to return a `LocalDefId`marmeladema-1/+1
2020-04-26rustc_target: Stop using "string typing" for TLS modelsVadim Petrochenkov-23/+9
Introduce `enum TlsModel` instead.