about summary refs log tree commit diff
path: root/src/rustllvm
AgeCommit message (Collapse)AuthorLines
2016-01-29trans: Upgrade LLVMAlex Crichton-5/+37
This brings some routine upgrades to the bundled LLVM that we're using, the most notable of which is a bug fix to the way we handle range asserts when loading the discriminant of an enum. This fix ended up being very similar to f9d4149c where we basically can't have a range assert when loading a discriminant due to filling drop, and appropriate flags were added to communicate this to `trans::adt`.
2016-01-25Register LLVM passes with the correct LLVM pass manager.Corey Farwell-6/+30
LLVM was upgraded to a new version in this commit: https://github.com/rust-lang/rust/commit/f9d4149c29e8b989fa3624993be379f380e48dcf which was part of this pull request: https://github.com/rust-lang/rust/issues/26025 Consider the following two lines from that commit: https://github.com/rust-lang/rust/commit/f9d4149c29e8b989fa3624993be379f380e48dcf#diff-a3b24dbe2ea7c1981f9ac79f9745f40aL462 https://github.com/rust-lang/rust/commit/f9d4149c29e8b989fa3624993be379f380e48dcf#diff-a3b24dbe2ea7c1981f9ac79f9745f40aL469 The purpose of these lines is to register LLVM passes. Prior to the that commit, the passes being handled were assumed to be ModulePasses (a specific type of LLVM pass) since they were being added to a ModulePass manager. After that commit, both lines were refactored (presumably in an attempt to DRY out the code), but the ModulePasses were changed to be registered to a FunctionPass manager. This change resulted in ModulePasses being run, but a Function object was being passed as a parameter to the pass instead of a Module, which resulted in segmentation faults. In this commit, I changed relevant sections of the code to check the type of the passes being added and register them to the appropriate pass manager. Closes https://github.com/rust-lang/rust/issues/31067
2016-01-16Don't make atomic loads and stores volatileAmanieu d'Antras-2/+0
2015-12-02Disable the null check elimination passBjörn Steinbrink-1/+1
This pass causes mis-optimizations in some cases and is probably no longer really important for us, so let's disable it for now. Fixes #30081
2015-11-19Remove segmented stack option from LLVMRustCreateTargetMachine. Unused.Brian Anderson-1/+0
2015-10-24rustllvm: Update to LLVM trunkSeo Sanghyeon-0/+28
2015-10-18Update LLVM fork to include a backported fix for broken debug locationsBjörn Steinbrink-1/+1
Fixes #28947
2015-10-13Avoid using getDataLayout, deprecated in LLVM 3.7Seo Sanghyeon-2/+1
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-1/+1
2015-09-29Tweak Travis to use GCEAlex Crichton-5/+0
Travis CI has new infrastructure using the Google Compute Engine which has both faster CPUs and more memory, and we've been encouraged to switch as it should help our build times! The only downside currently, however, is that IPv6 is disabled, causing a number of standard library tests to fail. Consequently this commit tweaks our travis config in a few ways: * ccache is disabled as it's not working on GCE just yet * Docker is used to run tests inside which reportedly will get IPv6 working * A system LLVM installation is used instead of building LLVM itself. This is primarily done to reduce build times, but we want automation for this sort of behavior anyway and we can extend this in the future with building from source as well if needed. * gcc-specific logic is removed as the docker image for Ubuntu gives us a recent-enough gcc by default.
2015-09-11Update LLVM to fix nightly build failuresBjörn Steinbrink-1/+1
2015-09-02Update to LLVM 3.7Alex Crichton-1/+1
This is a rebase of our few small patches on top of the release of LLVM 3.7, picking up those last few bug fixes on the way up to 3.7!
2015-08-10Remove morestack supportAlex Crichton-16/+0
This commit removes all morestack support from the compiler which entails: * Segmented stacks are no longer emitted in codegen. * We no longer build or distribute libmorestack.a * The `stack_exhausted` lang item is no longer required The only current use of the segmented stack support in LLVM is to detect stack overflow. This is no longer really required, however, because we already have guard pages for all threads and registered signal handlers watching for a segfault on those pages (to print out a stack overflow message). Additionally, major platforms (aka Windows) already don't use morestack. This means that Rust is by default less likely to catch stack overflows because if a function takes up more than one page of stack space it won't hit the guard page. This is what the purpose of morestack was (to catch this case), but it's better served with stack probes which have more cross platform support and no runtime support necessary. Until LLVM supports this for all platform it looks like morestack isn't really buying us much. cc #16012 (still need stack probes) Closes #26458 (a drive-by fix to help diagnostics on stack overflow)
2015-07-22Write deterministic archiveseternaleye-1/+1
Currently, `rustc` generates nondeterministic archives, which contain system timestamps. These don't really serve any useful purpose, and enabling deterministic archives moves us a little closer to completely deterministic builds. For a small toy library using `std::ops::{Deref,DerefMut}`, this change actually results in a bit-for-bit identical build every time.
2015-07-21trans: Move rust_try into the compilerAlex Crichton-1/+2
This commit moves the IR files in the distribution, rust_try.ll, rust_try_msvc_64.ll, and rust_try_msvc_32.ll into the compiler from the main distribution. There's a few reasons for this change: * LLVM changes its IR syntax from time to time, so it's very difficult to have these files build across many LLVM versions simultaneously. We'll likely want to retain this ability for quite some time into the future. * The implementation of these files is closely tied to the compiler and runtime itself, so it makes sense to fold it into a location which can do more platform-specific checks for various implementation details (such as MSVC 32 vs 64-bit). * This removes LLVM as a build-time dependency of the standard library. This may end up becoming very useful if we move towards building the standard library with Cargo. In the immediate future, however, this commit should restore compatibility with LLVM 3.5 and 3.6.
2015-07-16trans: Clean up handling the LLVM data layoutAlex Crichton-0/+27
Turns out for OSX our data layout was subtly wrong and the LLVM update must have exposed this. Instead of fixing this I've removed all data layouts from the compiler to just use the defaults that LLVM provides for all targets. All data layouts (and a number of dead modules) are removed from the compiler here. Custom target specifications can still provide a custom data layout, but it is now an optional key as the default will be used if one isn't specified.
2015-07-16trans: Add kind to writeArchiveAlex Crichton-3/+14
Updates our LLVM bindings to be able to write out multiple kinds of archives. This commit also enables using LLVM instead of the system ar on all current targets.
2015-07-16rustc_trans: Update LLVMBuildLandingPad signatureAlex Crichton-0/+15
The C API of this function changed so it no longer takes a personality function. A shim was introduced to call the right LLVM function (depending on which version we're compiled against) to set the personality function on the outer function. The compiler only ever sets one personality function for all generated functions, so this should be equivalent.
2015-07-16Update LLVMAlex Crichton-1/+1
There's a number of goodies in this LLVM update: * This contains a fix for https://llvm.org/bugs/show_bug.cgi?id=23957 which should help us bootstrap farther on 32-bit MSVC targets. * There is better support for writing multiple flavors of archives, allowing us to use the built-in LLVM support instead of the system `ar` on all current platforms of the compiler. * A number of other minor bug fixes and performance improvements to unblock various other pieces of work.
2015-07-10trans: Use LLVM's writeArchive to modify archivesAlex Crichton-101/+168
We have previously always relied upon an external tool, `ar`, to modify archives that the compiler produces (staticlibs, rlibs, etc). This approach, however, has a number of downsides: * Spawning a process is relatively expensive for small compilations * Encoding arguments across process boundaries often incurs unnecessary overhead or lossiness. For example `ar` has a tough time dealing with files that have the same name in archives, and the compiler copies many files around to ensure they can be passed to `ar` in a reasonable fashion. * Most `ar` programs found do **not** have the ability to target arbitrary platforms, so this is an extra tool which needs to be found/specified when cross compiling. The LLVM project has had a tool called `llvm-ar` for quite some time now, but it wasn't available in the standard LLVM libraries (it was just a standalone program). Recently, however, in LLVM 3.7, this functionality has been moved to a library and is now accessible by consumers of LLVM via the `writeArchive` function. This commit migrates our archive bindings to no longer invoke `ar` by default but instead make a library call to LLVM to do various operations. This solves all of the downsides listed above: * Archive management is now much faster, for example creating a "hello world" staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also recently started requiring modification of rlibs, and linking a hello world dynamic library is now 2x faster. * The compiler is now one step closer to "hassle free" cross compilation because no external tool is needed for managing archives, LLVM does the right thing! This commit does not remove support for calling a system `ar` utility currently. We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward (so the system LLVM can be used wherever possible), and in these cases we must shell out to a system utility. All nightly builds of Rust, however, will stop needing a system `ar`.
2015-06-17Auto merge of #26025 - alexcrichton:update-llvm, r=brsonbors-43/+173
This commit updates the LLVM submodule in use to the current HEAD of the LLVM repository. This is primarily being done to start picking up unwinding support for MSVC, which is currently unimplemented in the revision of LLVM we are using. Along the way a few changes had to be made: * As usual, lots of C++ debuginfo bindings in LLVM changed, so there were some significant changes to our RustWrapper.cpp * As usual, some pass management changed in LLVM, so clang was re-scrutinized to ensure that we're doing the same thing as clang. * Some optimization options are now passed directly into the `PassManagerBuilder` instead of through CLI switches to LLVM. * The `NoFramePointerElim` option was removed from LLVM, favoring instead the `no-frame-pointer-elim` function attribute instead. * The `LoopVectorize` option of the LLVM optimization passes has been disabled as it causes a divide-by-zero exception to happen in LLVM for zero-sized types. This is reported as https://llvm.org/bugs/show_bug.cgi?id=23763 Additionally, LLVM has picked up some new optimizations which required fixing an existing soundness hole in the IR we generate. It appears that the current LLVM we use does not expose this hole. When an enum is moved, the previous slot in memory is overwritten with a bit pattern corresponding to "dropped". When the drop glue for this slot is run, however, the switch on the discriminant can often start executing the `unreachable` block of the switch due to the discriminant now being outside the normal range. This was patched over locally for now by having the `unreachable` block just change to a `ret void`.
2015-06-16rustc: Update LLVMAlex Crichton-43/+173
This commit updates the LLVM submodule in use to the current HEAD of the LLVM repository. This is primarily being done to start picking up unwinding support for MSVC, which is currently unimplemented in the revision of LLVM we are using. Along the way a few changes had to be made: * As usual, lots of C++ debuginfo bindings in LLVM changed, so there were some significant changes to our RustWrapper.cpp * As usual, some pass management changed in LLVM, so clang was re-scrutinized to ensure that we're doing the same thing as clang. * Some optimization options are now passed directly into the `PassManagerBuilder` instead of through CLI switches to LLVM. * The `NoFramePointerElim` option was removed from LLVM, favoring instead the `no-frame-pointer-elim` function attribute instead. Additionally, LLVM has picked up some new optimizations which required fixing an existing soundness hole in the IR we generate. It appears that the current LLVM we use does not expose this hole. When an enum is moved, the previous slot in memory is overwritten with a bit pattern corresponding to "dropped". When the drop glue for this slot is run, however, the switch on the discriminant can often start executing the `unreachable` block of the switch due to the discriminant now being outside the normal range. This was patched over locally for now by having the `unreachable` block just change to a `ret void`.
2015-06-14inverse the logic in code inclusionSébastien Marie-3/+3
instead of enumerate the (long) list of platforms to exclude, use only the short list of platforms to include. should fixes __morestack symbol problem under openbsd
2015-06-10fixes __morestack symbol problem on BSDsDave Huseby-2/+2
2015-06-09Auto merge of #25627 - murarth:execution-engine-fix, r=nrcbors-23/+35
* Removes `RustJITMemoryManager` from public API. This was really sort of an implementation detail to begin with. * `__morestack` is linked to C++ wrapper code and this pointer is used when resolving the symbol for `ExecutionEngine` code. * `__morestack_addr` is also resolved for `ExecutionEngine` code. This function is sometimes referenced in LLVM-generated code, but was not able to be resolved on Mac OS systems. * Added Windows support to `ExecutionEngine` API. * Added a test for basic `ExecutionEngine` functionality.
2015-06-08Changes to LLVM `ExecutionEngine` wrapperMurarth-23/+35
* Removes `RustJITMemoryManager` from public API. This was really sort of an implementation detail to begin with. * `__morestack` is linked to C++ wrapper code and this pointer is used when resolving the symbol for `ExecutionEngine` code. * `__morestack_addr` is also resolved for `ExecutionEngine` code. This function is sometimes referenced in LLVM-generated code, but was not able to be resolved on Mac OS systems. * Added Windows support to `ExecutionEngine` API. * Added a test for basic `ExecutionEngine` functionality.
2015-06-07rustc_trans: don't hardcode llvm version for conditional intrinsicsLuca Bruno-0/+8
This commit introduce a third parameter for compatible_ifn!, as new intrinsics are being added in recent LLVM releases and there is no need to hardcode a specific case. Signed-off-by: Luca Bruno <lucab@debian.org>
2015-06-07Remove useless `const`Tamir Duberstein-1/+1
2015-05-19rustc_llvm: Don't export constants across dllsAlex Crichton-1/+3
For imports of constants across DLLs to work on Windows it *requires* that the import be marked with `dllimport` (unlike functions where the marker is optional, but strongly recommended). This currently isn't working for importing FFI constants across boundaries, however, so the one constant exported from `rustc_llvm.dll` is now a function to be called instead.
2015-05-12rustc_llvm: Expose setting more DLL storage classesAlex Crichton-2/+3
Currently only `dllexport` is used, but more integration will require using `dllimport` as well.
2015-04-25Add singlethreaded fence intrinsics.Peter Marheine-2/+4
These new intrinsics are comparable to `atomic_signal_fence` in C++, ensuring the compiler will not reorder memory accesses across the barrier, nor will it emit any machine instructions for it. Closes #24118, implementing RFC 888.
2015-04-21rollup merge of #24635: tamird/llvm-3.5Alex Crichton-43/+13
r? @alexcrichton
2015-04-21rustc: Handle duplicate names merging archivesAlex Crichton-24/+55
When linking an archive statically to an rlib, the compiler will extract all contents of the archive and add them all to the rlib being generated. The current method of extraction is to run `ar x`, dumping all files into a temporary directory. Object archives, however, are allowed to have multiple entries with the same file name, so there is no method for them to extract their contents into a directory in a lossless fashion. This commit adds iterator support to the `ArchiveRO` structure which hooks into LLVM's support for reading object archives. This iterator is then used to inspect each object in turn and extract it to a unique location for later assembly.
2015-04-21LLVM < 3.5 is unsupported since bb18a3cTamir Duberstein-43/+13
2015-04-03Implement LLVMGetOrInsertGlobal wrapperSimonas Kazlauskas-0/+6
2015-04-03Wrap LLVM’s Module::getNamedValueSimonas Kazlauskas-0/+5
2015-03-14Drop support for LLVM < 3.5 and fix compile errors with 3.5Björn Steinbrink-108/+12
LLVM older that 3.6 has a bug that cause assertions when compiling certain constructs. For 3.5 there's still a chance that the bug might get fixed in 3.5.2, so let's keep allowing to compile with it for it for now.
2015-03-10Add support for target-cpu=nativeJulian Orth-1/+7
2015-03-05updating llvm-auto-clean-trigger tooDave Huseby-1/+1
2015-02-21Update LLVM to rust-llvm-2015-02-19Björn Steinbrink-1/+1
Fixes #22159 Fixes #21721
2015-02-16Update LLVM to release_36@229036Björn Steinbrink-1/+1
Fixes the crash blocking #21886.
2015-02-12Update LLVM to disable asserts in the PassInfo cacheBjörn Steinbrink-1/+1
Fixes #22233
2015-02-09Update llvm to rust-llvm-2015-02-09Björn Steinbrink-1/+1
Fixes #21996
2015-02-02Test fixes and rebase conflictsAlex Crichton-1/+1
2015-02-01Update LLVM to rust-llvm-2015-01-30Björn Steinbrink-111/+181
2015-01-22Better inline assembly errorsJohn Kåre Alsaker-0/+16
2015-01-18Redo Segmented stack support for DragonFlyMichael Neumann-1/+1
It got accidentially reverted in 44440e5.
2015-01-13Bump to ensure llvm is rebuiltRicho Healey-1/+1
2015-01-05Ensure that LLVM is rebuilt with recent changesMichael Neumann-1/+1
2015-01-03Initial version of AArch64 support.Akos Kiss-1/+1
Adds AArch64 knowledge to: * configure, * make files, * sources, * tests, and * documentation.