summaryrefslogtreecommitdiff
path: root/compiler/rustc_llvm/llvm-wrapper
Commit message (Collapse)AuthorAgeFilesLines
...
* | | RustWrapper: adapt for LLVM API change of fatal_error_handler_tKrasimir Georgiev2021-10-051-0/+4
|/ / | | | | | | | | | | | | | | | | No functional changes intended. The LLVM commit https://github.com/llvm/llvm-project/commit/e463b69736da8b0a950ecd937cf990401bdfcdeb changed an argument of fatal_error_handler_t from std::string to char*. This adapts RustWrapper accordingly.
* | PassWrapper: handle function rename from upstream D36850Augie Fackler2021-09-271-0/+4
| | | | | | | | | | | | | | | | | | | | thinLTOResolvePrevailingInModule became thinLTOFinalizeInModule and gained the ability to propagate noRecurse and noUnwind function attributes. I ran codegen tests with it both on and off, as the upstream patch uses it in both modes, and the tests pass both ways. Given that, it seemed reasonable to go ahead and let the propagation be enabled in rustc, and see what happens. See https://reviews.llvm.org/D36850 for more examples of how the new version of the function gets used.
* | Use correct pipeline for LTO at O0Nikita Popov2021-09-251-1/+4
| | | | | | | | | | | | Unlike the pre-link piplines, the LTO pipelines do support O0, and using them is required to avoid leaving behind undefined references for the linker.
* | Rollup merge of #89041 - sticnarf:sticnarf/fat-lto-dwarf, r=nagisathe84722021-09-221-2/+2
|\ \ | |/ |/| | | | | | | | | | | Work around invalid DWARF bugs for fat LTO This PR applies the same workaround in #46772 to fat LTO. It seems to fix the bug reported in https://github.com/rust-lang/rust/issues/66118#issuecomment-917434036.
| * Work around invalid DWARF bugs for fat LTOYilin Chen2021-09-171-2/+2
| | | | | | | | Signed-off-by: Yilin Chen <sticnarf@gmail.com>
* | compiler/rustc_llvm: Enable M68k LLVM targetJohn Paul Adrian Glaubitz2021-09-171-0/+7
|/
* PassWrapper: these two lines shouldn't have been ifdef'dAugie Fackler2021-09-161-2/+2
|
* PassWrapper: handle separate Module*SanitizerPassAugie Fackler2021-09-161-0/+8
| | | | | | | | | | Change ab41eef9aca3 in LLVM split MemorySanitizerPass into MemorySanitizerPass for functions and ModuleMemorySanitizerPass for modules. There's a related change for ThreadSanitizerPass, and in here since we're using a ModulePassManager I only add the module flavor of the pass on LLVM 14. r? @nikic cc @nagisa
* RustWrapper: remove some uses of AttrBuilderAugie Fackler2021-09-081-19/+6
| | | | | Turns out we can also use Attribute::get*() methods here, and avoid the AttrBuilder and an extra helper method here.
* RustWrapper: just use the *AtIndex funcs directlyAugie Fackler2021-09-071-36/+3
| | | | | Otherwise we're kind of reimplementing the inverse of the well-named methods, and that's not a direction we want to go.
* RustWrapper: avoid deleted unclear attribute methodsAugie Fackler2021-09-071-18/+70
| | | | | | | | | | | | These were deleted in https://reviews.llvm.org/D108614, and in C++ I definitely see the argument for their removal. I didn't try and propagate the changes up into higher layers of rustc in this change because my initial goal was to get rustc working against LLVM HEAD promptly, but I'm happy to follow up with some refactoring to make the API on the Rust side match the LLVM API more directly (though the way the enum works in Rust makes the API less scary IMO). r? @nagisa cc @nikic
* RustWrapper: adapt to LLVM change 0f45c16f2caaAugie Fackler2021-08-261-14/+9
| | | | | | | The above-mentioned commit (part of the LLVM 14 development cycle) removes a method that rustc uses somewhat extensively. We mostly switch to lower-level methods that exist in all versions of LLVM we use, so no new ifdef logic is required in most cases.
* Rollup merge of #88164 - durin42:llvm-14-san-opts, r=nikicGuillaume Gomez2021-08-221-0/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | PassWrapper: adapt for LLVM 14 changes These API changes appear to have all taken place in https://reviews.llvm.org/D105007, which moved HWAddressSanitizerPass and AddressSanitizerPass to only accept their options type as a ctor argument instead of the sequence of bools etc. This required a couple of parameter additions, which I made match the default prior to the mentioned upstream LLVM change. This patch restores rustc to building (though not quite passing all tests, I've mailed other patches for those issues) against LLVM HEAD.
| * PassWrapper: adapt for LLVM 14 changesAugie Fackler2021-08-191-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | These API changes appear to have all taken place in https://reviews.llvm.org/D105007, which moved HWAddressSanitizerPass and AddressSanitizerPass to only accept their options type as a ctor argument instead of the sequence of bools etc. This required a couple of parameter additions, which I made match the default prior to the mentioned upstream LLVM change. This patch restores rustc to building (though not quite passing all tests, I've mailed other patches for those issues) against LLVM HEAD.
* | Handle SrcMgr diagnosticsNikita Popov2021-08-161-3/+17
|/ | | | | | This is how InlineAsm diagnostics with source information are reported now. Previously a separate InlineAsm diagnostic handler was used.
* Auto merge of #87798 - durin42:llvm-14, r=nikicbors2021-08-081-27/+31
|\ | | | | | | | | | | | | PassWrapper: handle move of OptimizationLevel class out of PassBuilder This is the first build break of the LLVM 14 cycle, and was caused by https://reviews.llvm.org/D107025. Mercifully an easy fix.
| * PassWrapper: handle move of OptimizationLevel class out of PassBuilderAugie Fackler2021-08-061-27/+31
| | | | | | | | | | This is the first build break of the LLVM 14 cycle, and was caused by https://reviews.llvm.org/D107025. Mercifully an easy fix.
* | Prepare call/invoke for opaque pointersJosh Stone2021-08-051-7/+7
|/ | | | | | Rather than relying on `getPointerElementType()` from LLVM function pointers, we now pass the function type explicitly when building `call` or `invoke` instructions.
* Replace LLVMConstInBoundsGEP with LLVMConstInBoundsGEP2*Tomasz Miąsko2021-08-041-0/+10
| | | | | | A custom reimplementation of LLVMConstInBoundsGEP2 is used, since the LLVM contains a declaration of LLVMConstInBoundsGEP2 but not the implementation.
* Pass type when creating atomic loadNikita Popov2021-07-091-4/+3
| | | | | Instead of determining it from the pointer type, explicitly pass the type to load.
* Add first cut of functionality for #58713: support for #[link(kind = ↵Richard Cobbe2021-06-041-0/+52
| | | | | | | | "raw-dylib")]. This does not yet support #[link_name] attributes on functions, the #[link_ordinal] attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or stdcall functions on 32-bit x86.
* rustc: Store metadata-in-rlibs in object filesAlex Crichton2021-06-041-35/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit updates how rustc compiler metadata is stored in rlibs. Previously metadata was stored as a raw file that has the same format as `--emit metadata`. After this commit, however, the metadata is encoded into a small object file which has one section which is the contents of the metadata. The motivation for this commit is to fix a common case where #83730 arises. The problem is that when rustc crates a `dylib` crate type it needs to include entire rlib files into the dylib, so it passes `--whole-archive` (or the equivalent) to the linker. The problem with this, though, is that the linker will attempt to read all files in the archive. If the metadata file were left as-is (today) then the linker would generate an error saying it can't read the file. The previous solution was to alter the rlib just before linking, creating a new archive in a temporary directory which has the metadata file removed. This problem from before this commit is now removed if the metadata file is stored in an object file that the linker can read. The only caveat we have to take care of is to ensure that the linker never actually includes the contents of the object file into the final output. We apply similar tricks as the `.llvmbc` bytecode sections to do this. This involved changing the metadata loading code a bit, namely updating some of the LLVM C APIs used to use non-deprecated ones and fiddling with the lifetimes a bit to get everything to work out. Otherwise though this isn't intended to be a functional change really, only that metadata is stored differently in archives now. This should end up fixing #83730 because by default dylibs will no longer have their rlib dependencies "altered" meaning that split-debuginfo will continue to have valid paths pointing at the original rlibs. (note that we still "alter" rlibs if LTO is enabled to remove Rust object files and we also "alter" for the #[link(cfg)] feature, but that's rarely used). Closes #83730
* Auto merge of #85416 - durin42:llvm-catchup-may-2021, r=nagisabors2021-05-211-1/+12
|\ | | | | | | | | | | | | | | | | PassWrapper: update for LLVM change D102093 In https://reviews.llvm.org/D102093 lots of things stopped taking the DebugLogging boolean parameter. Mercifully we appear to always set DebugPassManager to false, so I don't think we're losing anything by not passing this parameter.
| * PassWrapper: update for LLVM change D102093Augie Fackler2021-05-171-1/+12
| | | | | | | | | | | | | | In https://reviews.llvm.org/D102093 lots of things stopped taking the DebugLogging boolean parameter. Mercifully we appear to always set DebugPassManager to false, so I don't think we're losing anything by not passing this parameter.
* | Support -C passes in NewPMNikita Popov2021-05-081-2/+12
| | | | | | | | | | And report an error if parsing the additional pass pipeline fails. Threading through the error accounts for most of the changes here.
* | Explicitly register GCOV profiling pass as wellNikita Popov2021-05-081-1/+11
| |
* | Explicitly register instrprof passNikita Popov2021-05-081-1/+11
|/ | | | | Don't use "passes" for this purpose, explicitly insert it into the correct place in the pipeline instead.
* Replace llvm::sys::fs::F_None with llvm::sys::fs::OF_NoneFangrui Song2021-04-291-3/+3
| | | | | The former is deprecated. OF_None has been available in LLVM since 2018-06.
* RustWrapper: work around unification of diagnostic handlersAugie Fackler2021-04-221-1/+11
| | | | | | | | | This lets me build against llvm/main as of March 23rd, 2021. I'm not entirely sure this is _correct_, but it appears to be functionally identical to what was done in LLVM: existing callsites of setInlineAsmDiagnosticHandler were moved to SetDiagnosticHandler() on the context object, which we already set up in both places that we called setInlineAsmDiagnosticHandler().
* Don't set `fast`(-math) for certain simd opsSimonas Kazlauskas2021-04-171-2/+4
| | | | | | | | | | | | `fast-math` implies things like functions not being able to accept as an argument or return as a result, say, `inf` which made these functions confusingly named or behaving incorrectly, depending on how you interpret it. Since the time when these intrinsics have been implemented the intrinsics user's (stdsimd) approach has changed significantly and so now it is required that these intrinsics operate normally rather than in "whatever" way. Fixes #84268
* Categorize and explain target features supportMatt Ickstadt2021-04-091-18/+15
|
* Manually set dso_local when its valid to do soSimonas Kazlauskas2021-04-031-0/+4
| | | | | | | | | | | | | | | | This should have no real effect in most cases, as e.g. `hidden` visibility already implies `dso_local` (or at least LLVM IR does not preserve the `dso_local` setting if the item is already `hidden`), but it should fix `-Crelocation-model=static` and improve codegen in executables. Note that this PR does not exhaustively port the logic in [clang]. Only the obviously correct portion and what is necessary to fix a regression from LLVM 12 that relates to `-Crelocation_model=static`. Fixes #83335 [clang]: https://github.com/llvm/llvm-project/blob/3001d080c813da20b329303bf8f45451480e5905/clang/lib/CodeGen/CodeGenModule.cpp#L945-L1039
* Auto merge of #83387 - cuviper:min-llvm-10, r=nagisabors2021-03-253-83/+0
|\ | | | | | | | | | | Update the minimum external LLVM to 10 r? `@nikic`
| * Update the minimum external LLVM to 10Josh Stone2021-03-223-83/+0
| |
* | LLVMWrapper: attractive nuisance macrosAugie Fackler2021-03-241-7/+0
| | | | | | | | | | | | | | THis came up in the review of #83425: it's hard to imagine a use of LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble when a point release gets created, so let's just discard them to prevent the issue.
* | cleanup: add some comments per review feedbackAugie Fackler2021-03-222-0/+6
| |
* | fix: I meant LLVM version 13, not 12Augie Fackler2021-03-193-3/+3
| |
* | llvm-wrapper: pass std::string instead of StringRefAugie Fackler2021-03-161-0/+7
| | | | | | | | | | LLVM change 5fbd1a333aa1a0b70903d036b98ea56c51ae5224 modified this function to want std::string instead of StringRef, which is easily done.
* | llvm-wrapper: add alignment argument to CreateAtomicCmpXchgAugie Fackler2021-03-161-0/+6
| | | | | | | | | | | | As far as I can tell what we've been getting is llvm::MaybeAlign(), so just use that for now. This is required sometime after 24539f1ef2471d07bd87f833cb0288fc0f251f4b.
* | llvm-wrapper: adapt to function signature change of ↵Augie Fackler2021-03-161-1/+6
|/ | | | | | | | thinLTOResolvePrevailingInIndex This changed in 54fb3ca96e261f7107cb1b5778c34cb0e0808be6 - I'm not entirely sure it's correct that we're leaving config empty, but the one case in LLVM that looked similar did that.
* Auto merge of #83044 - kubo39:set-llvm-code-model, r=nikicbors2021-03-141-0/+8
|\ | | | | | | | | | | | | | | | | | | | | Add support for storing code model to LLVM module IR This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323. This patch is based on https://github.com/rust-lang/rust/pull/74002
| * Add support for storing code model to LLVM module IRHiroki Noda2021-03-121-0/+8
| | | | | | | | | | | | | | | | | | This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323. This patch is based on https://github.com/rust-lang/rust/pull/74002
* | Support merge_functions option in NewPM since LLVM >= 12Hiroki Noda2021-03-121-2/+6
|/ | | | | now we can pass this flag since https://reviews.llvm.org/D93002 has been merged.
* Schedule ThinLTOBuffer passes again after sanitizer passesNikita Popov2021-03-031-1/+6
| | | | | | This works around a design defect in the LLVM 12 pass builder implementation. In LLVM 13, the PreLink ThinLTO pipeline properly respects the OptimizerLastEPCallbacks.
* Mark pure asm as willreturnNikita Popov2021-03-012-0/+3
|
* Don't directly expose coverage::CounterMappingRegion via FFINikita Popov2021-03-011-2/+22
| | | | | | The definition of this struct changes in LLVM 12 due to the addition of branch coverage support. To avoid future mismatches, declare our own struct and then convert between them.
* Support LLVM 12 in rustcNikita Popov2021-02-282-26/+146
|
* HWASan supportTri Vo2021-02-073-0/+29
|
* Add a new ABI to support cmse_nonsecure_callHugues de Valon2021-02-021-0/+8
| | | | | | | | | | | | | This commit adds a new ABI to be selected via `extern "C-cmse-nonsecure-call"` on function pointers in order for the compiler to apply the corresponding cmse_nonsecure_call callsite attribute. For Armv8-M targets supporting TrustZone-M, this will perform a non-secure function call by saving, clearing and calling a non-secure function pointer using the BLXNS instruction. See the page on the unstable book for details. Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
* Use probe-stack=inline-asm in LLVM 11+Erik Desjardins2021-01-141-0/+2
|