about summary refs log tree commit diff
path: root/src/rustllvm
AgeCommit message (Collapse)AuthorLines
2016-12-30Add a way to retrieve constant value in 128 bitsSimonas Kazlauskas-0/+16
Fixes rebase fallout, makes code correct in presence of 128-bit constants. This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-29further enable the Sparc LLVM backendJonathan A. Kollasch-1/+8
2016-12-29Rollup merge of #38676 - rkruppe:llvm-check-success, r=alexcrichtonAlex Crichton-9/+26
Check *all* errors in LLVMRustArchiveIterator* API Incrementing the `Archive::child_iterator` fetches and validates the next child. This can trigger an error, which we previously checked on the *next* call to `LLVMRustArchiveIteratorNext()`. This means we ignore the last error if we stop iterating halfway through. This is harmless (we don't access the child, after all) but LLVM 4.0 calls `abort()` if *any* error goes unchecked, even a success value. This means that basically any rustc invocation that opens an archive and searches through it would die. The solution implemented here is to change the order of operations, such that advancing the iterator and fetching the newly-validated iterator happens in the same `Next()` call. This keeps the error handling behavior as before but ensures all `Error`s get checked.
2016-12-29Check *all* errors in LLVMRustArchiveIterator* APIRobin Kruppe-9/+26
Incrementing the `Archive::child_iterator` fetches and validates the next child. This can trigger an error, which we previously checked on the *next* call to `LLVMRustArchiveIteratorNext()`. This means we ignore the last error if we stop iterating halfway through. This is harmless (we don't access the child, after all) but LLVM 4.0 calls `abort()` if *any* error goes unchecked, even a success value. This means that basically any rustc invocation that opens an archive and searches through it would die. The solution implemented here is to change the order of operations, such that advancing the iterator and fetching the newly-validated iterator happens in the same `Next()` call. This keeps the error handling behavior as before but ensures all `Error`s get checked.
2016-12-26Auto merge of #38314 - japaric:do-not-delete-enable-llvm-backend, r=alexcrichtonbors-1/+1
initial SPARC support ### UPDATE Can now compile `no_std` executables with: ``` $ cargo new --bin app && cd $_ $ edit Cargo.toml && tail -n2 $_ [dependencies] core = { path = "/path/to/rust/src/libcore" } $ edit src/main.rs && cat $_ #![feature(lang_items)] #![no_std] #![no_main] #[no_mangle] pub fn _start() -> ! { loop {} } #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } $ edit sparc-none-elf.json && cat $_ { "arch": "sparc", "data-layout": "E-m:e-p:32:32-i64:64-f128:64-n32-S64", "executables": true, "llvm-target": "sparc", "os": "none", "panic-strategy": "abort", "target-endian": "big", "target-pointer-width": "32" } $ cargo rustc --target sparc-none-elf -- -C linker=sparc-unknown-elf-gcc -C link-args=-nostartfiles $ file target/sparc-none-elf/debug/app app: ELF 32-bit MSB executable, SPARC, version 1 (SYSV), statically linked, not stripped $ sparc-unknown-elf-readelf -h target/sparc-none-elf/debug/app ELF Header: Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Sparc Version: 0x1 Entry point address: 0x10074 Start of program headers: 52 (bytes into file) Start of section headers: 1188 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 2 Size of section headers: 40 (bytes) Number of section headers: 14 Section header string table index: 11 $ sparc-unknown-elf-objdump -Cd target/sparc-none-elf/debug/app target/sparc-none-elf/debug/app: file format elf32-sparc Disassembly of section .text: 00010074 <_start>: 10074: 9d e3 bf 98 save %sp, -104, %sp 10078: 10 80 00 02 b 10080 <_start+0xc> 1007c: 01 00 00 00 nop 10080: 10 80 00 02 b 10088 <_start+0x14> 10084: 01 00 00 00 nop 10088: 10 80 00 00 b 10088 <_start+0x14> 1008c: 01 00 00 00 nop ``` --- Someone wants to attempt launching some Rust [into space](https://www.reddit.com/r/rust/comments/5h76oa/c_interop/) but their platform is based on the SPARCv8 architecture. Let's not block them by enabling LLVM's SPARC backend. Something very important that they'll also need is the "cabi" stuff as they'll be embedding some Rust code into a bigger C application (i.e. heavy use of `extern "C"`). The question there is what name(s) should we use for "target_arch" as the "cabi" implementation [varies according to that parameter](https://github.com/rust-lang/rust/blob/1.13.0/src/librustc_trans/abi.rs#L498-L523). AFAICT, SPARCv8 is a 32-bit architecture and SPARCv9 is a 64-bit architecture. And, LLVM uses `sparc`, `sparcv9` and `sparcel` for [the architecture triple](https://github.com/rust-lang/llvm/blob/ac1c94226e9fa17005ce7e2dd52dd6d1875f3137/include/llvm/ADT/Triple.h#L67-L69) so perhaps we should use `target_arch = "sparc"` (32-bit) and `target_arch = "sparcv9"` (64-bit) as well. r? @alexcrichton This PR only enables this LLVM backend when rustbuild is used. Do I also need to implement this for the old Makefile-based build system? Or are all our nightlies now being generated using rustbuild? cc @brson
2016-12-21Fixed fastcall not applying inreg attributes to arguments like the C/C++ ↵Ivan Molodetskikh-0/+3
fastcall.
2016-12-19touch src/rustllvm/llvm-auto-clean-triggerJorge Aparicio-1/+1
2016-12-16llvm: backport r280651Jorge Aparicio-1/+1
fixes #38406
2016-12-14Update LLVM global variable debug info API for 4.0Dylan McKay-5/+20
This teaches Rust about an LLVM 4.0 API change for creating debug info for global variables. This change was made in upstream LLVM patch https://reviews.llvm.org/D20147 This is almost 1:1 copy of how clang did it in http://reviews.llvm.org/D20415
2016-12-12[LLVM 4.0] Move debuginfo alignment argumentJake Goulding-8/+29
Alignment was removed from createBasicType and moved to - createGlobalVariable - createAutoVariable - createStaticMemberType (unused in Rust) - createTempGlobalVariableFwdDecl (unused in Rust) https://github.com/llvm-mirror/llvm/commit/e69c459a6e9756ca1ff3acb1dcfc434843aee80f
2016-12-11[LLVM 4.0] Explicitly call constructor of 'llvm::Error'Dylan McKay-0/+2
The implicit constructor has been deleted. We should use Error::success() instead. The constructor in the LLVM headers mentions that "success" should be used instead of the deleted constructor for clarity.
2016-12-11Auto merge of #38240 - pftbest:update_llvm, r=japaricbors-1/+1
LLVM: Update submodule to include patches for MSP430. Fixes #37829
2016-12-10Auto merge of #38223 - rkruppe:llvm-stringref-fixes, r=alexcrichtonbors-2/+5
printf type correctness The `%.*s` format specifier requires an int for the maximum size, but StringRef::size is a size_t cc @shepmaster
2016-12-09Auto merge of #38196 - rkruppe:llvm-archivewrapper-fwdcompat, r=alexcrichtonbors-0/+19
[LLVM 4.0] rustllvm archive support Error handling is being transitioned from ErrorOr<T> to Expected<T> which has a different API and requires explicitly handling all errors cc #37609
2016-12-08LLVM: update triggerVadzim Dambrouski-1/+1
2016-12-08Auto merge of #38156 - shepmaster:llvm-4.0-bitcode-reader-writer, r=alexcrichtonbors-2/+23
[LLVM 4.0] New bitcode headers and API /cc @michaelwoerister @rkruppe
2016-12-07printf type correctnessRobin Kruppe-2/+5
The %.*s format specifier requires an int for the maximum size, but StringRef::size is a size_t cc @shepmaster
2016-12-07mk: Switch rustbuild to the default build systemAlex Crichton-1/+1
This commit switches the default build system for Rust from the makefiles to rustbuild. The rustbuild build system has been in development for almost a year now and has become quite mature over time. This commit is an implementation of the proposal on [internals] which slates deletion of the makefiles on 2016-01-02. [internals]: https://internals.rust-lang.org/t/proposal-for-promoting-rustbuild-to-official-status/4368 This commit also updates various documentation in `README.md`, `CONTRIBUTING.md`, `src/bootstrap/README.md`, and throughout the source code of rustbuild itself. Closes #37858
2016-12-06[LLVM 4.0] rustllvm archive supportRobin Kruppe-0/+19
Error handling is being transitioned from ErrorOr<T> to Expected<T> which has a different API and requires explicitly handling all errors
2016-12-05Make LLVM symbol visibility FFI types more stable.Michael Woerister-0/+42
2016-12-05Auto merge of #38100 - nox:llvm, r=alexcrichtonbors-1/+1
Update llvm fork to 3ec14daffb4b8c0604df50b7fb0ab552f456e381
2016-12-04[LLVM 4.0] New bitcode headers and APIJake Goulding-2/+23
2016-12-02[LLVM 4.0] Support new DIFlags enumJake Goulding-0/+5
2016-12-02[LLVM] Introduce a stable representation of DIFlagsJake Goulding-13/+93
In LLVM 4.0, this enum becomes an actual type-safe enum, which breaks all of the interfaces. Introduce our own copy of the bitflags that we can then safely convert to the LLVM one.
2016-12-01Update llvm fork to 3ec14daffb4b8c0604df50b7fb0ab552f456e381Anthony Ramine-1/+1
2016-11-28Don't assume llvm::StringRef is null terminatedRobin Kruppe-11/+10
StringRefs have a length and their contents are not usually null-terminated. The solution is to either copy the string data (in rustc_llvm::diagnostic) or take the size into account (in LLVMRustPrintPasses). I couldn't trigger a bug caused by this (apparently all the strings returned in practice are actually null-terminated) but this is more correct and more future-proof.
2016-11-27Auto merge of #38027 - rkruppe:llvm-printpasses-fwdcompat, r=alexcrichtonbors-0/+7
[LLVM 4.0] LLVMRustPrintPasses Adapt `LLVMRustPrintPasses` to LLVM 4.0 preferring `StringRef` over `char *` cc #37609
2016-11-27Adapt LLVMRustPrintPasses to LLVM 4.0 preferring `StringRef` over `char *`Robin Kruppe-0/+7
2016-11-25Auto merge of #38000 - rkruppe:llvm-dinamespace-fwdcompat, r=alexcrichtonbors-1/+5
[LLVM 4.0] Pass new argument ExportSymbol to DIBuilder::createNameSpace cc #37609
2016-11-25Pass new argument ExportSymbol to DIBuilder::createNameSpaceRobin Kruppe-1/+5
2016-11-24Support LLVM 4.0 in OptimizationDiagnostic FFIRobin Kruppe-2/+7
- getMsg() changed to return std::string by-value. Fix: copy the data to a rust String during unpacking. - getPassName() changed to return StringRef
2016-11-21Restore compatibility with LLVM 3.7 and 3.8Seo Sanghyeon-10/+9
2016-11-20Auto merge of #37861 - shepmaster:llvm-4.0-inline-pass, r=alexcrichtonbors-0/+7
[LLVM 4.0] Update AlwaysInliner pass header and constructor
2016-11-19Auto merge of #37831 - rkruppe:llvm-attr-fwdcompat, r=eddybbors-45/+92
[LLVM 4.0] Use llvm::Attribute APIs instead of "raw value" APIs The latter will be removed in LLVM 4.0 (see https://github.com/llvm-mirror/llvm/commit/4a6fc8bacf11d8066da72cf8481467167877ed16). The librustc_llvm API remains mostly unchanged, except that llvm::Attribute is no longer a bitflag but represents only a *single* attribute. The ability to store many attributes in a small number of bits and modify them without interacting with LLVM is only used in rustc_trans::abi and closely related modules, and only attributes for function arguments are considered there. Thus rustc_trans::abi now has its own bit-packed representation of argument attributes, which are translated to rustc_llvm::Attribute when applying the attributes. cc #37609
2016-11-18[LLVM 4.0] Update AlwaysInliner pass header and constructorJake Goulding-0/+7
2016-11-17Use llvm::Attribute API instead of "raw value" APIs, which will be removed ↵Robin Kruppe-45/+92
in LLVM 4.0. The librustc_llvm API remains mostly unchanged, except that llvm::Attribute is no longer a bitflag but represents only a *single* attribute. The ability to store many attributes in a small number of bits and modify them without interacting with LLVM is only used in rustc_trans::abi and closely related modules, and only attributes for function arguments are considered there. Thus rustc_trans::abi now has its own bit-packed representation of argument attributes, which are translated to rustc_llvm::Attribute when applying the attributes.
2016-11-12also enable the MSP430 backend in MakefilesJorge Aparicio-1/+8
2016-10-29LLVM: Update submodule to rust-llvm-2016-10-29 branch.Vadzim Dambrouski-1/+1
2016-10-19Update llvm-auto-clean-triggerRaph Levien-1/+1
Update the datestamp so that buildbots do a clean rebuild of llvm.
2016-10-19Rollup merge of #37182 - alexcrichton:appveyor, r=brsonEduard-Mihai Burtescu-1/+1
Add AppVeyor configuration to the repo We hope to move to AppVeyor in the near future off of Buildbot + EC2. This adds an `appveyor.yml` configuration file which is ready to run builds on the auto branch. This is also accompanied with a few minor fixes to the build system and such to accomodate AppVeyor. The intention is that we're not switching over to AppVeyor entirely just yet, but rather we'll watch the builds for a week or so. If everything checks out then we'll start gating on AppVeyor instead of Buildbot!
2016-10-14Add AppVeyor configuration to the repoAlex Crichton-1/+1
We hope to move to AppVeyor in the near future off of Buildbot + EC2. This adds an `appveyor.yml` configuration file which is ready to run builds on the auto branch. This is also accompanied with a few minor fixes to the build system and such to accomodate AppVeyor. The intention is that we're not switching over to AppVeyor entirely just yet, but rather we'll watch the builds for a week or so. If everything checks out then we'll start gating on AppVeyor instead of Buildbot!
2016-10-14debuginfo: Remove some outdated stuff from LLVM DIBuilder binding.Michael Woerister-20/+1
2016-10-10LLVM: Backport "[SimplifyCFG] Correctly test for unconditional branches in ↵Michael Woerister-1/+1
GetCaseResults"
2016-10-07llvm: Update LLVM to include fix for pathologic case in its LiveDebugValues ↵Michael Woerister-1/+1
pass.
2016-09-30Update LLVM with fastcomp patchesBrian Anderson-1/+1
2016-09-26Extend preprocessor LLVM version checks to support LLVM 4.xJake Goulding-34/+43
This doesn't actually do anything for LLVM 4.x yet, but sets the stage.
2016-09-17Up the LLVMSimonas Kazlauskas-1/+1
Fixes #36474
2016-09-04Fix incorrect LLVM Linkage enumMatt Ickstadt-0/+80
The `Linkage` enum in librustc_llvm got out of sync with the version in LLVM and it caused two variants of the #[linkage=""] attribute to break. This adds the functions `LLVMRustGetLinkage` and `LLVMRustSetLinkage` which convert between the Rust Linkage enum and the LLVM one, which should stop this from breaking every time LLVM changes it. Fixes #33992
2016-09-01Fix optimization regressions for operations on [x; n]-initialized arrays.Eduard Burtescu-1/+1
2016-08-29Auto merge of #36117 - eddyb:llvm-hoist-meta, r=alexcrichtonbors-1/+1
llvm: backport "[SimplifyCFG] Hoisting invalidates metadata". Fixes #36023 by backporting @majnemer's LLVM patch fixing [the LLVM bug](https://llvm.org/bugs/show_bug.cgi?id=29163.) where SimplifyCFG hoisted instructions andkept their metadata (conditional `!nonnull` loads could kill a null check later if hoisted). r? @alexcrichton