about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/llvm
AgeCommit message (Collapse)AuthorLines
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-2/+1
2019-10-13Improve type safetybjorn3-3/+4
2019-09-06rustc_codegen_llvm: give names to non-alloca variable values.Eduard-Mihai Burtescu-0/+2
2019-08-01Use Rust integer types instead of libc's fixed-width typesgnzlbg-2/+2
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-3/+3
rustbuild Remove some random unnecessary lint `allow`s
2019-07-20Remove vector fadd/fmul reduction workaroundsNikita Popov-2/+0
The bugs that this was working around have been fixed in LLVM 9.
2019-07-15Don't add extra passes into the function pass managerNikita Popov-0/+3
Exception for specific cases like linting, additional passes should be going into the module pass manager (even if they are function passes). The separate function pass manager is only used for very early optimization passes. Rather than apparending passes to the MPM, use the OptimizerLast and EnabledOnOptLevel0 pass manager builder extension hooks, which allow adding passes directly before finalization (alias canonicalization and name-anon-globals). The main effect and purpose of this change is to add sanitizer passes at the end of the pipeline, which is where they belong. In LLVM 9 the address sanitizer can't be used as a pass in the early function pass manager, because it has a dependence on a module-level analysis pass.
2019-07-10Rollup merge of #62474 - nikic:update-llvm, r=alexcrichtonMazdak Farrokhzad-0/+3
Prepare for LLVM 9 update Main changes: * In preparation for opaque pointer types, the `byval` attribute now takes a type. As such, the argument type needs to be threaded through to the function/callsite attribute application logic. * On ARM the `+fp-only-sp` and `+d16` features have become `-fp64` and `-d32`. I've switched the target definitions to use the new names, but also added bidirectional emulation so either can be used on any LLVM version for backwards compatibility. * The datalayout can now specify function pointer alignment. In particular on ARM `Fi8` is specified, which means that function pointer alignment is independent of function alignment. I've added this to our datalayouts to match LLVM (which is something we check) and strip the fnptr alignment for older LLVM versions. * The fmul/fadd reductions now always respect the accumulator (including for unordered reductions), so we should pass the identity instead of undef. Open issues: * https://reviews.llvm.org/D62106 causes linker errors with ld.bdf due to https://sourceware.org/bugzilla/show_bug.cgi?id=24784. To avoid this I've enabled `RelaxELFRelocations`, which results in a GOTPCRELX relocation for `__tls_get_addr` and avoids the issue. However, this is likely not acceptable because relax relocations are not supported by older linker versions. We may need an LLVM option to keep using PLT for `__tls_get_addr` despite `RtLibUseGOT`. The corresponding llvm-project PR is https://github.com/rust-lang/llvm-project/pull/19. r? @ghost
2019-07-09Fix float add/mul reduction codegenNikita Popov-0/+1
The accumulator is now respected for unordered reductions.
2019-07-09Pass type to byval attributesNikita Popov-0/+2
2019-07-07Handle null from LLVMRustGetSectionNameValentin Tolmer-1/+3
2019-06-16librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C) (#61306)John Paul Adrian Glaubitz-2/+2
In order to make sure that Rust's bitflags types are passed the same way in the Rust ABI as they are in the C ABI, we need to use the attribute repr(transparent) over the repr(C) attribute for the single-field bitflags structs in in order to prevent ABI mismatches. Thanks to Michael Karcher for finding this bug.
2019-06-03add support for unchecked mathlcnr/Bastian Kauschke-0/+30
2019-04-18Remove the unused LLVMRustIsRustLLVMJosh Stone-1/+0
2019-04-06Auto merge of #59710 - alexcrichton:llvm-9-compat, r=sanxiynbors-1/+1
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-05Show better errors for LLVM IR outputJosh Stone-1/+2
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-1/+1
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-03-24make asm diagnostic instruction optionalAndy Russell-2/+2
`DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so the instruction shouldn't be blindly unwrapped.
2019-02-25librustc_codegen_llvm: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-16/+16
2019-02-23Implement ffi_returns_twice attributegnzlbg-0/+1
2019-02-18librustc_codegen_llvm => 2018Taiki Endo-4/+2
2019-02-14Rollup merge of #58378 - alexcrichton:incremental-lto, r=michaelwoeristerMazdak Farrokhzad-1/+1
rustc: Implement incremental "fat" LTO Currently the compiler will produce an error if both incremental compilation and full fat LTO is requested. With recent changes and the advent of incremental ThinLTO, however, all the hard work is already done for us and it's actually not too bad to remove this error! This commit updates the codegen backend to allow incremental full fat LTO. The semantics are that the input modules to LTO are all produce incrementally, but the final LTO step is always done unconditionally regardless of whether the inputs changed or not. The only real incremental win we could have here is if zero of the input modules changed, but that's so rare it's unlikely to be worthwhile to implement such a code path. cc #57968 cc rust-lang/cargo#6643
2019-02-12rustc: Implement incremental "fat" LTOAlex Crichton-1/+1
Currently the compiler will produce an error if both incremental compilation and full fat LTO is requested. With recent changes and the advent of incremental ThinLTO, however, all the hard work is already done for us and it's actually not too bad to remove this error! This commit updates the codegen backend to allow incremental full fat LTO. The semantics are that the input modules to LTO are all produce incrementally, but the final LTO step is always done unconditionally regardless of whether the inputs changed or not. The only real incremental win we could have here is if zero of the input modules changed, but that's so rare it's unlikely to be worthwhile to implement such a code path. cc #57968 cc rust-lang/cargo#6643
2019-02-10rustc: doc commentsAlexander Regueiro-1/+1
2019-01-26Auto merge of #55641 - nagisa:optimize-attr, r=pnkfelixbors-0/+1
Implement optimize(size) and optimize(speed) attributes This PR implements both `optimize(size)` and `optimize(speed)` attributes. While the functionality itself works fine now, this PR is not yet complete: the code might be messy in places and, most importantly, the compiletest must be improved with functionality to run tests with custom optimization levels. Otherwise the new attribute cannot be tested properly. Oh, and not all of the RFC is implemented – attribute propagation is not implemented for example. # TODO * [x] Improve compiletest so that tests can be written; * [x] Assign a proper error number (E9999 currently, no idea how to allocate a number properly); * [ ] Perhaps reduce the duplication in LLVM attribute assignment code…
2019-01-25Set the DICompileUnit emissionKindJosh Stone-2/+23
2019-01-25Rebase to the llvm-project monorepoJosh Stone-5/+17
The new git submodule src/llvm-project is a monorepo replacing src/llvm and src/tools/{clang,lld,lldb}. This also serves as a rebase for these projects to the new 8.x branch from trunk. The src/llvm-emscripten fork is unchanged for now.
2019-01-24Implement optimize(size) and optimize(speed)Simonas Kazlauskas-0/+1
2018-12-25Remove licensesMark Rousskov-40/+0
2018-12-19FIXME(52456) remove fixme and combine all extern items in one blockNiv Kaminer-26/+6
2018-12-09Bump minimum required LLVM version to 6.0Nikita Popov-2/+2
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-03Auto merge of #55010 - tromey:Bug-9224-generic-parameters, r=michaelwoeristerbors-3/+4
Add template parameter debuginfo to generic types This changes debuginfo generation to add template parameters to generic types. With this change the DWARF now has DW_TAG_template_type_param for types, not just for functions, like: <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type) <40e> DW_AT_name : (indirect string, offset: 0x375): Generic<i32> <412> DW_AT_byte_size : 4 <413> DW_AT_alignment : 4 ... <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param) <420> DW_AT_type : <0x42a> <424> DW_AT_name : (indirect string, offset: 0xa65e): T Closes #9224
2018-12-03Auto merge of #56358 - nikic:mergefunc-aliases, r=rkruppebors-0/+1
Enable -mergefunc-use-aliases If the Rust LLVM fork is used, enable the -mergefunc-use-aliases flag, which will create aliases for merged functions, rather than inserting a call from one to the other. A number of codegen tests needed to be adjusted, because functions that previously fell below the thunk limit are now being merged. Merging is prevented in various ways now. I expect that this is going to break something, somewhere, because it isn't able to deal with aliases properly, but we won't find out until we try :) This fixes #52651. r? @rkruppe
2018-11-30Enable -mergefunc-use-aliasesNikita Popov-0/+1
If the Rust LLVM fork is used, enable the -mergefunc-use-aliases flag, which will create aliases for merged functions, rather than inserting a call from one to the other. A number of codegen tests needed to be adjusted, because functions that previously fell below the thunk limit are now being merged. Merging is prevented either using -C no-prepopulate-passes, or by making the functions non-identical. I expect that this is going to break something, somewhere, because it isn't able to deal with aliases properly, but we won't find out until we try :) This fixes #52651.
2018-11-29Add template parameter debuginfo to generic typesTom Tromey-3/+4
This changes debuginfo generation to add template parameters to generic types. With this change the DWARF now has DW_TAG_template_type_param for types, not just for functions, like: <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type) <40e> DW_AT_name : (indirect string, offset: 0x375): Generic<i32> <412> DW_AT_byte_size : 4 <413> DW_AT_alignment : 4 ... <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param) <420> DW_AT_type : <0x42a> <424> DW_AT_name : (indirect string, offset: 0xa65e): T Closes #9224
2018-11-29Rename conversion util; remove duplicate util in librustc_codegen_llvm.Corey Farwell-14/+2
2018-11-16Beginning of moving all backend-agnostic code to rustc_codegen_ssaDenis Merigoux-71/+71
2018-11-16[eddyb/rebase cleanup] abstracted FuncletEduard-Mihai Burtescu-5/+0
2018-11-16Moved common.rs enumsDenis Merigoux-61/+65
2018-11-16Starting to move backend-agnostic code into codegen_utilsDenis Merigoux-11/+12
IntPredicate moved
2018-11-16Generalized some base.rs methodsDenis Merigoux-0/+24
2018-11-16Use the method form for CodegenCx everywhereDenis Merigoux-5/+5
2018-11-16Traitification of common.rs methodsDenis Merigoux-1/+1
2018-11-16New files and folders for traitsDenis Merigoux-55/+55
Moved common enums to common
2018-11-16Generalized AsmDialect for BuilderMethodsDenis Merigoux-0/+10
2018-11-16Generalized SynchronisationScope for BuilderMethodsDenis Merigoux-0/+10
2018-11-16Generalized AtomicOrdering for BuilderMethodsDenis Merigoux-0/+16
2018-11-16Generalized AtomicRmwBinOp for BuilderMethodsDenis Merigoux-0/+18
2018-11-16Generalized OperandBundleDef in BuilderMethodsDenis Merigoux-0/+5