about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2019-12-06Auto merge of #65195 - varkor:to_option, r=Centrilbors-10/+3
Rename `bool::then_*` to `bool::to_option_*` and use where appropriate Name change following https://github.com/rust-lang/rfcs/pull/2757. Also try it out throughout the compiler in places I think makes the code more readable.
2019-12-07Rollup merge of #67033 - cuviper:ValueName2, r=rkruppeYuki Okushi-35/+39
Migrate to LLVM{Get,Set}ValueName2 The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated strings, but the `2` variants use explicit lengths, which fits better with Rust strings and slices. We now use these in new helper functions `llvm::{get,set}_value_name` that convert to/from `&[u8]`. Closes #64223. r? @rkruppe
2019-12-06Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methodsSimon Sapin-1/+28
As discussed in https://github.com/rust-lang/rust/issues/10184 Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range.
2019-12-06Rename to `then_some` and `then`varkor-1/+1
2019-12-06Use `to_option` in various placesvarkor-10/+3
2019-12-05Auto merge of #66952 - 0dvictor:print, r=rkruppebors-10/+6
Use Module::print() instead of a PrintModulePass llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.
2019-12-04Migrate to LLVM{Get,Set}ValueName2Josh Stone-35/+39
The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated strings, but the `2` variants use explicit lengths, which fits better with Rust strings and slices. We now use these in new helper functions `llvm::{get,set}_value_name` that convert to/from `&[u8]`.
2019-12-04Auto merge of #65947 - eddyb:fn-abi, r=oli-obk,nagisabors-124/+75
rustc: split FnAbi's into definitions/direct calls ("of_instance") and indirect calls ("of_fn_ptr"). After this PR: * `InstanceDef::Virtual` is only used for "direct" virtual calls, and shims around those calls use `InstanceDef::ReifyShim` (i.e. for `<dyn Trait as Trait>::f as fn(_)`) * this could easily be done for intrinsics as well, to allow their reification, but I didn't do it * `FnAbi::of_instance` is **always** used for declaring/defining an `fn`, and for direct calls to an `fn` * this is great for e.g. https://github.com/rust-lang/rust/pull/65881 (`#[track_caller]`), which can introduce the "caller location" argument into "codegen signatures" by only changing `FnAbi::of_instance`, after this PR * `FnAbi::of_fn_ptr` is used primarily for indirect calls, i.e. to `fn` pointers * *not* virtual calls (which use `FnAbi::of_instance` with `InstanceDef::Virtual`) * there's also a couple uses where the `rustc_codegen_llvm` needs to declare (i.e. FFI-import) an LLVM function that has no Rust declaration available at all * at least one of them could probably be a "weak lang item" instead As there are many steps, this PR is best reviewed commit by commit - some of which arguably should be in their own PRs, I may have gotten carried away a bit. cc @nagisa @rkruppe @oli-obk @anp
2019-12-03Rollup merge of #66973 - cuviper:min-llvm7, r=alexcrichtonMazdak Farrokhzad-26/+5
Update the minimum external LLVM to 7 LLVM 7 is over a year old, which should be plenty for compatibility. The last LLVM 6 holdout was llvm-emscripten, which went away in #65501. I've also included a fix for LLVM 8 lacking `MemorySanitizerOptions`, which was broken by #66522.
2019-12-03Rollup merge of #66957 - parthsane:pvs/ftx_lld_linker, r=alexcrichtonMazdak Farrokhzad-2/+4
Change Linker for x86_64-fortanix-unknown-sgx target to rust-lld Changed linker for `x86_64-fortanix-unknown-sgx` target to `rust-lld` This change needed the RelaxELFRelocations flag to be set for it to work correctly r? @jethrogb
2019-12-03Move cgu_reuse_tracker to librustc_sessionMark Rousskov-1/+2
2019-12-03rustc_target: add abi::call::Conv::Rust distinct from Conv::C.Eduard-Mihai Burtescu-9/+8
2019-12-03rustc_codegen_llvm: privatize as much of attributes::* as possible.Eduard-Mihai Burtescu-4/+4
2019-12-03rustc_codegen_llvm: take an Instance in attributes::from_fn_attrs.Eduard-Mihai Burtescu-36/+24
2019-12-03rustc_codegen_llvm: rewrite debuginfo::get_function_signature to use FnAbi.Eduard-Mihai Burtescu-33/+12
2019-12-03rustc: take a PolyFnSig instead of an FnSig in FnAbi::of_fn_ptr.Eduard-Mihai Burtescu-8/+4
2019-12-03rustc: rename FnAbi::new to FnAbi::of_fn_ptr.Eduard-Mihai Burtescu-3/+3
2019-12-03rustc: compute FnAbi's for virtual calls through FnAbi::of_instance.Eduard-Mihai Burtescu-2/+2
2019-12-03rustc_codegen_ssa: use FnAbi::of_instance wherever possible.Eduard-Mihai Burtescu-23/+29
2019-12-03rustc_codegen_llvm: move NoReturn attribute to apply_attrs_llfn.Eduard-Mihai Burtescu-7/+5
2019-12-03rustc_codegen_ssa: take a FnAbi instead of a FnSig in declare_fn.Eduard-Mihai Burtescu-37/+42
2019-12-03rustc_codegen_ssa: remove define_fn and define_internal_fn.Eduard-Mihai Burtescu-23/+3
2019-12-03Change linker for x86_64-fortanix-unknown-sgx to rust-lldParth Sane-2/+4
For SGX, the relocation using the relocation table is done by the code in rust/src/libstd/sys/sgx/abi/reloc.rs and this code should not require relocation. Setting RelaxELFRelocations flag if allows this to happen, hence adding a Target Option for it.
2019-12-02Update the minimum external LLVM to 7Josh Stone-26/+5
LLVM 7 is over a year old, which should be plenty for compatibility. The last LLVM 6 holdout was llvm-emscripten, which went away in #65501. I've also included a fix for LLVM 8 lacking `MemorySanitizerOptions`, which was broken by #66522.
2019-12-02Use Module::print() instead of a PrintModulePassVictor Ding-10/+6
llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.
2019-12-02Rollup merge of #66918 - makotokato:aarch32-crc-crypto, r=petrochenkovMazdak Farrokhzad-0/+2
Add crc and crypto to target feature whitelist on arm aarch32 (ARMv8 32-bit) supports crc and crypto.
2019-12-01rustc_plugin: Remove support for plugins adding LLVM passesVadim Petrochenkov-14/+0
2019-11-30Rollup merge of #66895 - Centril:rustc_feature, r=oli-obkMazdak Farrokhzad-1/+2
Feature gating *declarations* => new crate `rustc_feature` This PR moves the data-oriented parts of feature gating into its own crate, `rustc_feature`. The parts consist of some data types as well as `accepted`, `active`, `removed`, and `builtin_attrs`. Feature gate checking itself remains in `syntax::feature_gate::check`. The parts which define how to emit feature gate errors could probably be moved to `rustc_errors` or to the new `rustc_session` crate introduced in #66878. The visitor itself could probably be moved as a pass in `rustc_passes` depending on how the dependency edges work out. The PR also contains some drive-by cleanup of feature gate checking. As such, the PR probably best read commit-by-commit. r? @oli-obk cc @petrochenkov cc @Mark-Simulacrum
2019-11-30Add crc and crypto to target feature whitelist on armMakoto Kato-0/+2
2019-11-30move UnstableFeatures -> rustc_featureMazdak Farrokhzad-1/+2
2019-11-29Use LLVMAddAnalysisPasses instead of Rust's wrapperVictor Ding-5/+6
LLVM exposes a C API `LLVMAddAnalysisPasses` and hence Rust's own wrapper `LLVMRustAddAnalysisPasses` is not needed anymore.
2019-11-27Rollup merge of #66534 - immunant:multiple_global_decls, r=eddybTyler Mandry-3/+5
Allow global references via ForeignItem and Item for the same symbol name during LLVM codegen Combining CGUs can result in code that references a static variable through both an Item and a ForeignItem with the same name. We don't care that the global was already created by a ForeignItem reference when we see the Item reference, as long as the LLVM types of the ForeignItem and Item match. Fixes #66464
2019-11-27rustc: move debug info from LocalDecl and UpvarDecl into a dedicated ↵Eduard-Mihai Burtescu-24/+82
VarDebugInfo.
2019-11-26Rollup merge of #66719 - Mark-Simulacrum:int-normalization, r=CentrilTyler Mandry-4/+4
Store pointer width as u32 on Config This removes the dependency on IntTy, UintTy from Session. It's not obviously a win, but it seems a bit odd to store the AST IntTy/UintTy in Session, rather we store the pointer width as an integer and add normalization methods to IntTy and UintTy.
2019-11-24Store ptr_width as u32 on ConfigMark Rousskov-4/+4
This removes the dependency on IntTy, UintTy from Session.
2019-11-22Create sanitizer passes in a separate functionTomasz Miąsko-20/+26
2019-11-22Add support for tracking origins of uninitialized memoryTomasz Miąsko-2/+2
2019-11-22Add support for sanitizer recoveryTomasz Miąsko-2/+1
2019-11-22Move sanitizer passes creation from ssa to llvmTomasz Miąsko-4/+30
2019-11-21Applied suggestions from code review.Alexander Regueiro-15/+15
2019-11-21Aggregation of drive-by cosmetic changes.Alexander Regueiro-136/+132
2019-11-21Rollup merge of #66515 - Centril:cheaper-inline-asm, r=oli-obkMazdak Farrokhzad-1/+1
Reduce size of `hir::Expr` by boxing more of `hir::InlineAsm` r? @oli-obk
2019-11-21Rollup merge of #66468 - RalfJung:simd-cleanup, r=oli-obkMazdak Farrokhzad-13/+14
Cleanup Miri SIMD intrinsics r? @oli-obk @eddyb Cc @gnzlbg
2019-11-21reduce size of hir::ExprKindMazdak Farrokhzad-1/+1
2019-11-18Allow different global references to the same nameStephen Crane-3/+5
Combining CGUs can result in code that references a static variable through both an Item and a ForeignItem with the same name. We don't care that the global was already created by a ForeignItem reference when we see the Item reference, as long as the LLVM types of the ForeignItem and Item match. Fixes #66464
2019-11-18Generate DWARF address ranges for faster lookupsJosh Stone-0/+3
This adds a new option `-Zgenerate-arange-section`, enabled by default, corresponding to LLVM's `-generate-arange-section`. This creates a `.debug_aranges` section with DWARF address ranges, which some tools depend on to optimize address lookups (elfutils [22288], [25173]). This only has effect when debuginfo is enabled, and the additional data is small compared to the other debug sections. For example, libstd.so with full debuginfo is about 11MB, with just 61kB in aranges. [22288]: https://sourceware.org/bugzilla/show_bug.cgi?id=22288 [25173]: https://sourceware.org/bugzilla/show_bug.cgi?id=25173 Closes #45246.
2019-11-16avoid some castsRalf Jung-9/+6
2019-11-16make simd_size return a u64Ralf Jung-9/+13
2019-11-14Auto merge of #66378 - rkruppe:revert-pr-65134, r=pnkfelixbors-2/+3
Revert #65134 To stop giving people on nightly reasons to `allow(improper_ctypes)` while tweaks to the lint are being prepared. cc #66220
2019-11-13Revert "Auto merge of #65134 - ↵Robin Kruppe-2/+3
davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, r=rkruppe" This reverts commit 3f0e16473de5ec010f44290a8c3ea1d90e0ad7a2, reversing changes made to 61a551b4939ec1d5596e585351038b8fbd0124ba.