about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2019-04-19Rollup merge of #60097 - cuviper:llvm8-mergefunc-use-aliases, r=rkruppeMazdak Farrokhzad-2/+1
Use -mergefunc-use-aliases for any LLVM >= 8 This functionality is not specific to Rust's LLVM, but any starting in LLVM 8.0, as noted in <https://github.com/rust-lang/rust/pull/56358#discussion_r237702197>. cc @nikic r? @rkruppe
2019-04-19Rollup merge of #60060 - mtak-:rtm-x86-feature, r=petrochenkovMazdak Farrokhzad-0/+1
whitelist RTM x86 target cpu feature This PR adds support for intels restricted transactional memory cpu feature. I mostly copied what was done for the [movbe](https://github.com/rust-lang/rust/pull/57999) feature. https://github.com/rust-lang-nursery/stdsimd/issues/718
2019-04-18Remove the unused LLVMRustIsRustLLVMJosh Stone-1/+0
2019-04-18Use -mergefunc-use-aliases for any LLVM >= 8Josh Stone-1/+1
2019-04-17whitelist rtm x86 cpu featuretyler-0/+1
2019-04-17Rename modulesYuki OKUSHI-1/+1
2019-04-17Rename diagnostics to error_codesYuki OKUSHI-0/+0
2019-04-14Rollup merge of #59874 - michaelwoerister:pgo-updates-1, r=cramertjMazdak Farrokhzad-8/+18
Clean up handling of `-Z pgo-gen` commandline option. This PR adapts the `-Z pgo-gen` flag to how Clang and GCC handle the corresponding `-fprofile-generate` flag. In particular, the flag now optionally takes a directory to place the profiling data in and allows to omit the argument (instead of having to pass an empty string).
2019-04-14Rollup merge of #59812 - michaelwoerister:profile-gen-msvc-imp, r=alexcrichtonMazdak Farrokhzad-1/+17
Exclude profiler-generated symbols from MSVC __imp_-symbol workaround. LLVM's profiling instrumentation adds a few symbols that are used by the profiler runtime. Since these show up as globals in the LLVM IR, the compiler generates `dllimport`-related `__imp_` stubs for them. This can lead to linker errors because the instrumentation symbols have weak linkage or are in a comdat section, but the `__imp_` stubs aren't. Instead of trying to replicate the linkage/comdat setup for the stubs, this PR just excludes the profiler-related symbols from stub-generation since they aren't supposed to be referenced via `__declspec(dllimport)` anywhere anyway. r? @alexcrichton EDIT: I considered making this more general, i.e. inferring from the symbol name if it is a Rust symbol or not. But then I figured out that that would yield false negatives for `#[no_mangle]` et al, so I went with a blacklist approach.
2019-04-12Use measureme in self-profilerWesley Wiser-23/+16
Related to #58372 Related to #58967
2019-04-11Add discr_index to multi-variant layoutsTyler Mandry-31/+39
We relax the assumption that the discriminant is always field 0, in preparations for layouts like generators where this is not going to be the case.
2019-04-11describe_enum_variant: Reduce code duplicationTyler Mandry-12/+10
2019-04-11Clean up handling of -Zpgo-gen commandline option.Michael Woerister-8/+18
2019-04-09Exclude profiler-generated symbols from MSVC __imp_-symbol workaround.Michael Woerister-1/+17
2019-04-07Auto merge of #58739 - matthewjasper:more-restrictive-tpb, r=pnkfelixbors-1/+2
More restrictive 2 phase borrows - take 2 Signal lint diagnostic `mutable_borrow_reservation_conflict` when borrow-check finds a 2-phase borrow's reservation overlapping with a shared borrow. (pnkfelix updated description) cc #56254 , #59159 blocks PR #59114 r? @pnkfelix cc @RalfJung @nikomatsakis
2019-04-06Auto merge of #59710 - alexcrichton:llvm-9-compat, r=sanxiynbors-7/+6
rustc: Start implementing compat with LLVM 9 This commit doesn't actually migrate to LLVM 9, but it brings our own C++ bindings in line with LLVM 9 and able to compile against tip of tree. The changes made were: * The `MainSubprogram` flag for debuginfo moved between flag types. * Iteration of archive members was tweaked slightly and we have to construct the two iterators before constructing the returned `RustArchiveIterator` value. * The `getOrInsertFunction` binding now returns a wrapper which we use `getCallee()` on to get the value we're interested in.
2019-04-06Auto merge of #59744 - cuviper:output-errors, r=sanxiynbors-11/+17
Show better errors for LLVM IR output I was trying to output LLVM IR directly to the console: $ rustc hello.rs --emit=llvm-ir -o /dev/stdout LLVM ERROR: IO failure on output stream: Bad file descriptor Now `LLVMRustPrintModule` returns an error, and we print: error: failed to write LLVM IR to /dev/stdout.hello.7rcbfp3g-cgu.0.rcgu.ll: Permission denied ... which is more informative.
2019-04-05Show better errors for LLVM IR outputJosh Stone-11/+17
I was trying to output LLVM IR directly to the console: $ rustc hello.rs --emit=llvm-ir -o /dev/stdout LLVM ERROR: IO failure on output stream: Bad file descriptor Now `LLVMRustPrintModule` returns an error, and we print: error: failed to write LLVM IR to /dev/stdout.hello.7rcbfp3g-cgu.0.rcgu.ll: Permission denied ... which is more informative.
2019-04-05rustc: Start implementing compat with LLVM 9Alex Crichton-7/+6
This commit doesn't actually migrate to LLVM 9, but it brings our own C++ bindings in line with LLVM 9 and able to compile against tip of tree. The changes made were: * The `MainSubprogram` flag for debuginfo moved between flag types. * Iteration of archive members was tweaked slightly and we have to construct the two iterators before constructing the returned `RustArchiveIterator` value. * The `getOrInsertFunction` binding now returns a wrapper which we use `getCallee()` on to get the value we're interested in.
2019-04-04Fix cases of conflicting two-phase borrowsMatthew Jasper-1/+2
2019-04-04Remove invalid assertion back::link::from add_upstream_rust_crates().Michael Woerister-4/+0
2019-04-02Rollup merge of #59446 - Aaron1011:fix/debuginfo-overflow, r=oli-obkMazdak Farrokhzad-17/+111
Fix stack overflow when generating debuginfo for 'recursive' type By using 'impl trait', it's possible to create a self-referential type as follows: fn foo() -> impl Copy { foo } This is a function which returns itself. Normally, the signature of this function would be impossible to write - it would look like 'fn foo() -> fn() -> fn() ...' e.g. a function which returns a function, which returns a function... Using 'impl trait' allows us to avoid writing this infinitely long type. While it's useless for practical purposes, it does compile and run However, issues arise when we try to generate llvm debuginfo for such a type. All 'impl trait' types (e.g. ty::Opaque) are resolved when we generate debuginfo, which can lead to us recursing back to the original 'fn' type when we try to process its return type. To resolve this, I've modified debuginfo generation to account for these kinds of weird types. Unfortunately, there's no 'correct' debuginfo that we can generate - 'impl trait' does not exist in debuginfo, and this kind of recursive type is impossible to directly represent. To ensure that we emit *something*, this commit emits dummy debuginfo/type names whenever it encounters a self-reference. In practice, this should never happen - it's just to ensure that we can emit some kind of debuginfo, even if it's not particularly meaningful Fixes #58463
2019-04-01Fix typoAaron Hill-1/+1
2019-04-01Rollup merge of #58507 - Zoxc:time-extended, r=michaelwoeristerMazdak Farrokhzad-2/+2
Add a -Z time option which prints only passes which runs once This ensures `-Z time-passes` fits on my screen =P r? @michaelwoerister
2019-03-31Only track 'visited' state for function typesAaron Hill-18/+31
2019-03-31Fix typosAaron Hill-4/+2
2019-03-31Fix inverted panic checkAaron Hill-1/+1
2019-03-31Fix stack overflow when generating debuginfo for 'recursive' typeAaron Hill-17/+100
By using 'impl trait', it's possible to create a self-referential type as follows: fn foo() -> impl Copy { foo } This is a function which returns itself. Normally, the signature of this function would be impossible to write - it would look like 'fn foo() -> fn() -> fn() ...' e.g. a function which returns a function, which returns a function... Using 'impl trait' allows us to avoid writing this infinitely long type. While it's useless for practical purposes, it does compile and run However, issues arise when we try to generate llvm debuginfo for such a type. All 'impl trait' types (e.g. ty::Opaque) are resolved when we generate debuginfo, which can lead to us recursing back to the original 'fn' type when we try to process its return type. To resolve this, I've modified debuginfo generation to account for these kinds of weird types. Unfortunately, there's no 'correct' debuginfo that we can generate - 'impl trait' does not exist in debuginfo, and this kind of recursive type is impossible to directly represent. To ensure that we emit *something*, this commit emits dummy debuginfo/type names whenever it encounters a self-reference. In practice, this should never happen - it's just to ensure that we can emit some kind of debuginfo, even if it's not particularly meaningful Fixes #58463
2019-03-31Rollup merge of #59519 - eddyb:layout-variants-refactor, r=oli-obkMazdak Farrokhzad-21/+55
rustc_target: factor out common fields of non-Single Variants. @tmandry and I were discussing ways to generalize the current variants/discriminant layout to allow more fields in the "`enum`" (or another multi-variant types, such as potentially generator state, in the future), shared by all variants, than just the tag/niche discriminant. This refactor should make it easier to extend multi-variant layouts, as nothing is duplicating anymore between "tagged enums" and "niche-filling enums". r? @oli-obk
2019-03-31Rollup merge of #59506 - JohnTitor:improve-mcount, r=nagisaMazdak Farrokhzad-1/+7
Use platform dependent mcount function close #59097 This pull-request is based on #57244 and [here](https://github.com/llvm-mirror/clang/search?q=MCountName&unscoped_MCountName). r? @nagisa
2019-03-30Remove redundant importsFabian Drinck-1/+0
2019-03-30Rollup merge of #59380 - philipc:thinlto-variant, r=michaelwoeristerMazdak Farrokhzad-1/+17
Fix invalid DWARF for enums when using ThinLTO We were setting the same identifier for both the DW_TAG_structure_type and the DW_TAG_variant_part. This becomes a problem when using ThinLTO becauses it uses the identifier as a key for a map of types that is used to delete duplicates based on the ODR, so one of them is deleted as a duplicate, resulting in invalid DWARF. The DW_TAG_variant_part isn't a standalone type, so it doesn't need an identifier. Fix by omitting its identifier. ODR uniquing is [enabled here](https://github.com/rust-lang/rust/blob/f21dee2c6179276321a88a63300dce74ff707e92/src/rustllvm/PassWrapper.cpp#L1101).
2019-03-30Use CStringYuki OKUSHI-5/+3
2019-03-30Use target_mcountYuki OKUSHI-24/+4
2019-03-29Use ExactSizeIterator + TrustedLen instead of num_cases arg for switchbjorn3-3/+4
2019-03-29Add a method for emiting a switch.bjorn3-8/+9
2019-03-29Remove inline_asm_call from cg_ssabjorn3-43/+47
`count_insn` is no longer called for inline asm, because it is private to builder.rs
2019-03-29Remove type_variadic_func and typ_array from cg_ssabjorn3-39/+68
2019-03-29Remove a lot of methods from *TypeMethodsbjorn3-36/+84
2019-03-29Remove scalar_lltypes from cg_ssabjorn3-6/+0
2019-03-29Move get_param and set_value_namebjorn3-26/+34
2019-03-29Remove a lot of methods from BuilderMethodsbjorn3-213/+213
2019-03-29[WIP] Make some debug info methods take &mut FunctionDebugContextbjorn3-2/+2
declare_local still takes &FunctionDebugContext, because of borrowck errors
2019-03-29Remove internal mutability from source_locations_enabledbjorn3-4/+4
2019-03-29Remove const_{cstr,str_slice,get_elt,get_real} and is_const_real methods ↵bjorn3-66/+97
from cg_ssa This introduces the static_panic_msg trait method to StaticBuilderMethods.
2019-03-29Remove const_{fat_ptr,array,vector,bytes} from cg_ssabjorn3-26/+28
2019-03-29Miscbjorn3-1/+1
2019-03-29Add a commentbjorn3-0/+1
2019-03-29Use Builder instead of CodegenCx for OperandRef and LocalRefbjorn3-1/+1
2019-03-29Don't use c_uint in cg_ssabjorn3-2/+2