about summary refs log tree commit diff
path: root/src/rustllvm
AgeCommit message (Collapse)AuthorLines
2020-02-12Add support for new pass managerNikita Popov-1/+243
The new pass manager can be enabled using -Z new-llvm-pass-manager=on.
2020-02-12Use IRBuilder to create memsetNikita Popov-0/+8
To avoid creating memsets with outdated signature. For some reason SROA chokes on this when using NewPM.
2020-02-12Properly use the darwin archive format on Apple targetsAnthony Ramine-0/+3
See https://github.com/servo/servo/issues/25550.
2020-02-01Add support for enabling the LLVM time-trace featureWesley Wiser-0/+18
I found this helpful while investigating an LLVM performance issue. Passing `-Z llvm-time-trace` causes a `llvm_timings.json` file to be created. This file can be inspected in either the Chrome Profiler tools or with any other compatible tool like SpeedScope. More information on the LLVM feature: - https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/ - https://reviews.llvm.org/rL357340
2020-01-27Detect use-after-scope bugs with AddressSanitizerTomasz Miąsko-1/+2
Enable use-after-scope checks by default when using AddressSanitizer. They allow to detect incorrect use of stack objects after their scope have already ended. The detection is based on LLVM lifetime intrinsics. To facilitate the use of this functionality, the lifetime intrinsics are now emitted regardless of optimization level if enabled sanitizer makes use of them.
2020-01-07Switch to using MaybeAlign APIsNikita Popov-0/+14
The integer versions are deprecated
2020-01-07Handle switch to Expected<StringRef> for section nameNikita Popov-0/+8
2020-01-07Pass isDefined parameter to createGlobalVariableExpression()Nikita Popov-0/+3
2020-01-07Don't handle removed FlagBlockByrefStructNikita Popov-0/+2
2020-01-07Update thinLTOInternalizeAndPromoteInIndex() usageNikita Popov-0/+10
2020-01-07Handle removal of llvm::make_unique()Nikita Popov-2/+17
2020-01-07CodeGenFileType moved outside TargetMachineNikita Popov-0/+13
2020-01-07Explicitly include InitializePasses.hNikita Popov-0/+1
2019-12-07Rollup merge of #67033 - cuviper:ValueName2, r=rkruppeYuki Okushi-4/+6
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-05Auto merge of #66952 - 0dvictor:print, r=rkruppebors-40/+3
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-4/+6
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-03Rollup merge of #66973 - cuviper:min-llvm7, r=alexcrichtonMazdak Farrokhzad-50/+3
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-03Change linker for x86_64-fortanix-unknown-sgx to rust-lldParth Sane-1/+3
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-50/+3
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-40/+3
llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.
2019-11-29Use LLVMAddAnalysisPasses instead of Rust's wrapperVictor Ding-11/+0
LLVM exposes a C API `LLVMAddAnalysisPasses` and hence Rust's own wrapper `LLVMRustAddAnalysisPasses` is not needed anymore.
2019-11-27Rollup merge of #66761 - yuyoyuppe:rust_llvm_minor_fix, r=alexcrichtonTyler Mandry-1/+1
Use LLVMDisposePassManager instead of raw delete in rustllvm LLVM has a dedicated API call which wraps the destructor invocation for the PassManager. Rust invokes it [otherwhere](https://github.com/rust-lang/rust/blob/d63b24ffcc48f44ef09e0369e6516d6f2dec3520/src/librustc_codegen_llvm/back/write.rs#L446-L447), but not in the `LLVMRustWriteOutputFile`. Since `LLVMDisposePassManager` might be extended to perform additional cleanup actions in the future, this change replaces raw destructor invocation with that API call.
2019-11-25Use LLVMDisposePassManager instead of raw delete in rustllvmyuyoyuppe-1/+1
2019-11-22Retain compatibility with LLVM 6, 7, 8 and 9Tomasz Miąsko-4/+21
2019-11-22Move sanitizer passes creation from ssa to llvmTomasz Miąsko-0/+26
2019-11-06Rollup merge of #66062 - smaeul:patch/pic-level, r=estebankMazdak Farrokhzad-0/+4
Configure LLVM module PIC level As of LLVM 9, this is required for 32-bit PowerPC to properly generate PLT references. Previously, only BigPIC was supported; now LLVM supports both BigPIC and SmallPIC, and there is no default value provided.
2019-11-05Rollup merge of #65953 - keystone-enclave:llvm_abiname, r=alexcrichtonPietro Albini-1/+2
Allow specifying LLVM's MCTargetOptions::ABIName in target specification files This addresses #65024, as it allows RISC-V target specification files to set `"llvm-abiname": "lp64d"`. Other languages (read: C) usually expose this codegen parameter under a compiler argument like `-mabi=<XYZ>`.
2019-11-03Configure LLVM module PIC levelSamuel Holland-0/+4
As of LLVM 9, this is required for 32-bit PowerPC to properly generate PLT references. Previously, only BigPIC was supported; now LLVM supports both BigPIC and SmallPIC, and there is no default value provided.
2019-11-02Add FFI bindings for Module::getInstructionCount()Simon Heath-0/+8
Just to make it useable for profiling and such inside rustc itself. It was vaguely useful in https://wiki.alopex.li/WhereRustcSpendsItsTime and I figured I might as well upstream it; I may or may not ever get around to doing more with it (hopefully I will), but it may be useful for others.
2019-10-29Allow specifying key "llvm-abiname" in target specificationGui Andrade-1/+2
This addresses #65024, as it allows RISC-V target specification files to set "llvm-abiname": "lp64d". In general, it is useful for the programmer to be able to set this codegen parameter, which other languages usually expose under a compiler argument like "-mabi=<XYZ>".
2019-07-20Don't link mcjit/interpreter LLVM componentsNikita Popov-6/+0
2019-07-15Don't add extra passes into the function pass managerNikita Popov-0/+17
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-13Update CPU printing for SubtargetSubTypeKVNikita Popov-4/+4
CPUs now use SubtargetSubTypeKV rather than SubtargetFeatureKV and no longer have a description.
2019-07-09Pass type to byval attributesNikita Popov-0/+22
2019-07-09Pass GUIDPreservedSymbols to thinLTOResolvePrevailingInIndex()Nikita Popov-1/+4
2019-04-26Limit internalization in LLVM 8 ThinLTOJosh Stone-1/+4
2019-04-18Remove the unused LLVMRustIsRustLLVMJosh Stone-8/+0
2019-04-06Auto merge of #59710 - alexcrichton:llvm-9-compat, r=sanxiynbors-20/+39
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-2/+9
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-20/+39
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-27replace llvm-rebuild-trigger with commit hashAndy Russell-4/+0
2019-03-18Rebase LLVM to 8.0.0 finalJosh Stone-1/+1
2019-02-23Implement ffi_returns_twice attributegnzlbg-0/+3
2019-02-12rustc: Implement incremental "fat" LTOAlex Crichton-4/+4
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-01-26Auto merge of #55641 - nagisa:optimize-attr, r=pnkfelixbors-0/+3
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-9/+93
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/+3
2018-12-25Remove licensesMark Rousskov-50/+0
2018-12-17Auto merge of #56642 - nikic:llvm-6, r=alexcrichtonbors-37/+3
Bump minimum required LLVM version to 6.0 Based on the discussion in #55842, while the overall position of Rust wrt LLVM continues to be contentious, there does seem to be a consensus that there is no need for continued support of LLVM 5. This PR bumps our version requirement to LLVM 6.0 and makes Travis run against that. I hope that this is going to unblock #52694. If I understand correctly, while this issue still exists in LLVM 6, Ubuntu has backported the relevant patch. r? @alexcrichton