Commit Graph

287 Commits

Author SHA1 Message Date
Valerii Hiora 57cade5744 Updated LLVM for iOS
There should be no more problems during SjLj pass
2014-07-24 07:25:55 -07:00
Björn Steinbrink 90a9f65b8d Update LLVM
To fix #8106, we need an LLVM version that contains r211082 aka 0dee6756
which fixes a bug that blocks that issue.

There have been some tiny API changes in LLVM, and cmpxchg changed its
return type. The i1 part of the new return type is only interesting when
using the new weak cmpxchg, which we don't do.
2014-06-21 19:59:58 +02:00
Michael Woerister c7426cf05a debuginfo: Fix issue with unique type IDs not being passed to LLVM for LLVM 3.4 2014-06-12 18:48:14 +02:00
Luqman Aden 3cae434f5c librustc: Consolidate the attribute handling for tagging function arguments and returns. 2014-05-23 22:32:30 -04:00
Luqman Aden 90eeb92e10 Update to LLVM head and mark various ptrs as nonnull. 2014-05-22 21:06:24 -04:00
klutzy 9f7caed202 rustllvm: Add LLVMRustArrayType
LLVM internally uses `uint64_t` for array size, but the corresponding
C API (`LLVMArrayType`) uses `unsigned int` so ths value is truncated.
Therefore rustc generates wrong type for fixed-sized large vector e.g.
`[0 x i8]` for `[0u8, ..(1 << 32)]`.

This patch adds `LLVMRustArrayType` function for `uint64_t` support.
2014-05-13 17:24:08 -07:00
Alex Crichton de7845ac72 rustc: Fix passing errors from LLVM to rustc
Many of the instances of setting a global error variable ended up leaving a
dangling pointer into free'd memory. This changes the method of error
transmission to strdup any error and "relinquish ownership" to rustc when it
gets an error. The corresponding Rust code will then free the error as
necessary.

Closes #12865
2014-04-23 10:04:29 -07:00
Alex Crichton 50fb57bb10 rustc: Ensure closures are "split-stack"
In upgrading LLVM, only rust functions had the "split-stack" attribute added.
This commit changes the addition of LLVM's "split-stack" attribute to *always*
occur and then we remove it sometimes if the "no_split_stack" rust attribute is
present.

Closes #13625
2014-04-19 10:33:46 -07:00
Alex Crichton 30ff17f809 Upgrade LLVM
This comes with a number of fixes to be compatible with upstream LLVM:

* Previously all monomorphizations of "mem::size_of()" would receive the same
  symbol. In the past LLVM would silently rename duplicated symbols, but it
  appears to now be dropping the duplicate symbols and functions now. The symbol
  names of monomorphized functions are now no longer solely based on the type of
  the function, but rather the type and the unique hash for the
  monomorphization.

* Split stacks are no longer a global feature controlled by a flag in LLVM.
  Instead, they are opt-in on a per-function basis through a function attribute.
  The rust #[no_split_stack] attribute will disable this, otherwise all
  functions have #[split_stack] attached to them.

* The compare and swap instruction now takes two atomic orderings, one for the
  successful case and one for the failure case. LLVM internally has an
  implementation of calculating the appropriate failure ordering given a
  particular success ordering (previously only a success ordering was
  specified), and I copied that into the intrinsic translation so the failure
  ordering isn't supplied on a source level for now.

* Minor tweaks to LLVM's API in terms of debuginfo, naming, c++11 conventions,
  etc.
2014-04-17 11:11:39 -07:00
Alex Crichton 15e6e8cf3e rustc: Stop using LLVMGetSectionName
The recent pull request to remove libc from libstd has hit a wall in compiling
on windows, and I've been trying to investigate on the try bots as to why (it
compiles locally just fine). To the best of my knowledge, the LLVM section
iterator is behaving badly when iterating over the sections of the libc DLL.

Upon investigating the LLVMGetSectionName function in LLVM, I discovered that
this function doesn't always return a null-terminated string. It returns the
data pointer of a StringRef instance (LLVM's equivalent of &str essentially),
but it has no method of returning the length of the name of the section.

This commit modifies the section iteration when loading libraries to invoke a
custom LLVMRustGetSectionName which will correctly return both the length and
the data pointer.

I have not yet verified that this will fix landing liblibc, as it will require a
snapshot before doing a full test. Regardless, this is a worrisome situation
regarding the LLVM API, and should likely be fixed anyway.
2014-04-03 10:49:35 -07:00
gentlefolk f4518cdba7 Initial support for emitting DWARF for static vars.
Only supports crate level statics. No debug info is generated for
function level statics. Closes #9227.
2014-03-27 21:03:44 -04:00
Alex Crichton 9396452592 rustc: Fix support for LLVM 3.3
The llvm.copysign and llvm.round intrinsics weren't added until LLVM 3.4, so if
we're on LLVM 3.3 we lower these to calls in libm instead of LLVM intrinsics.

This should fix our travis failures.
2014-03-05 18:05:05 -08:00
Alex Crichton 1ac5e84e91 rustc: Get rustc compiling with LLVM 3.{3,4} again
The travis builds have been breaking recently because LLVM 3.5 upstream is
changing. This looks like it's likely to continue, so it would be more useful
for us if we could lock ourselves to a system LLVM version that is not changing.

This commit has the support to bring our C++ glue to LLVM back in line with what
was possible back in LLVM 3.{3,4}. I don't think we're going to be able to
reasonably protect against regressions in the future, but this kind of code is a
good sign that we can continue to use the system LLVM for simple-ish things.
Codegen for ARM won't work and it won't have some of the perf improvements we
have, but using the system LLVM should work well enough for development.
2014-02-26 15:01:15 -08:00
bors e3b1f3c443 auto merge of #11853 : alexcrichton/rust/up-llvm, r=brson
This upgrade brings commit by @eddyb to help optimizations of virtual calls in
a few places (https://github.com/llvm-mirror/llvm/commit/6d2bd95) as well as a
commit by @c-a to *greatly* improve the runtime of the optimization passes
(https://github.com/rust-lang/llvm/pull/3).

Nice work to these guys!
2014-01-29 23:46:26 -08:00
Alex Crichton 8cd935f52a Upgrade LLVM
This upgrade brings commit by @eddyb to help optimizations of virtual calls in
a few places (https://github.com/llvm-mirror/llvm/commit/6d2bd95) as well as a
commit by @c-a to *greatly* improve the runtime of the optimization passes
(https://github.com/rust-lang/llvm/pull/3).

Nice work to these guys!
2014-01-29 23:43:39 -08:00
comex ea7b20d8f2 Add appropriate LLVM module flags for debug info.
Set "Dwarf Version" to 2 on OS X to avoid toolchain incompatibility, and
set "Debug Info Version" to prevent debug info from being stripped from
bitcode.

Fixes #11352.
2014-01-28 00:05:33 -05:00
Niko Matsakis 419ac4a1b8 Issue #3511 - Rationalize temporary lifetimes.
Major changes:

- Define temporary scopes in a syntax-based way that basically defaults
  to the innermost statement or conditional block, except for in
  a `let` initializer, where we default to the innermost block. Rules
  are documented in the code, but not in the manual (yet).
  See new test run-pass/cleanup-value-scopes.rs for examples.
- Refactors Datum to better define cleanup roles.
- Refactor cleanup scopes to not be tied to basic blocks, permitting
  us to have a very large number of scopes (one per AST node).
- Introduce nascent documentation in trans/doc.rs covering datums and
  cleanup in a more comprehensive way.
2014-01-15 18:34:38 -05:00
bors 3249de8c4f auto merge of #11274 : michaelwoerister/rust/issue11083, r=pcwalton
This pull request fixes #11083. The problem was that recursive type definitions were not properly handled for enum types, leading to problems with LLVM's metadata "uniquing". This bug has already been fixed for struct types some time ago (#9658) but I seem to have forgotten about enums back then. I added the offending code from issue #11083 as a test case.
2014-01-02 09:02:01 -08:00
Michael Woerister 6d20876c3f debuginfo: Fix issue #11083 and some minor clean up. 2014-01-02 15:20:43 +01:00
Alex Crichton c22fed9424 Convert relevant static mutexes to Once 2013-12-31 20:15:03 -08:00
Alex Crichton 64faafba19 rustc: Optimize reading metadata by 4x
We were previously reading metadata via `ar p`, but as learned from rustdoc
awhile back, spawning a process to do something is pretty slow. Turns out LLVM
has an Archive class to read archives, but it cannot write archives.

This commits adds bindings to the read-only version of the LLVM archive class
(with a new type that only has a read() method), and then it uses this class
when reading the metadata out of rlibs. When you put this in tandem of not
compressing the metadata, reading the metadata is 4x faster than it used to be
The timings I got for reading metadata from the respective libraries was:

    libstd-04ff901e-0.9-pre.dylib    => 100ms
    libstd-04ff901e-0.9-pre.rlib     => 23ms
    librustuv-7945354c-0.9-pre.dylib => 4ms
    librustuv-7945354c-0.9-pre.rlib  => 1ms
    librustc-5b94a16f-0.9-pre.dylib  => 87ms
    librustc-5b94a16f-0.9-pre.rlib   => 35ms
    libextra-a6ebb16f-0.9-pre.dylib  => 63ms
    libextra-a6ebb16f-0.9-pre.rlib   => 15ms
    libsyntax-2e4c0458-0.9-pre.dylib => 86ms
    libsyntax-2e4c0458-0.9-pre.rlib  => 22ms

In order to always take advantage of these faster metadata read-times, I sort
the files in filesearch based on whether they have an rlib extension or not
(prefer all rlib files first).

Overall, this halved the compile time for a `fn main() {}` crate from 0.185s to
0.095s on my system (when preferring dynamic linking). Reading metadata is still
the slowest pass of the compiler at 0.035s, but it's getting pretty close to
linking at 0.021s! The next best optimization is to just not copy the metadata
from LLVM because that's the most expensive part of reading metadata right now.
2013-12-19 23:34:32 -08:00
Alex Crichton fce4a174b9 Implement LTO
This commit implements LTO for rust leveraging LLVM's passes. What this means
is:

* When compiling an rlib, in addition to insdering foo.o into the archive, also
  insert foo.bc (the LLVM bytecode) of the optimized module.

* When the compiler detects the -Z lto option, it will attempt to perform LTO on
  a staticlib or binary output. The compiler will emit an error if a dylib or
  rlib output is being generated.

* The actual act of performing LTO is as follows:

    1. Force all upstream libraries to have an rlib version available.
    2. Load the bytecode of each upstream library from the rlib.
    3. Link all this bytecode into the current LLVM module (just using llvm
       apis)
    4. Run an internalization pass which internalizes all symbols except those
       found reachable for the local crate of compilation.
    5. Run the LLVM LTO pass manager over this entire module

    6a. If assembling an archive, then add all upstream rlibs into the output
        archive. This ignores all of the object/bitcode/metadata files rust
        generated and placed inside the rlibs.
    6b. If linking a binary, create copies of all upstream rlibs, remove the
        rust-generated object-file, and then link everything as usual.

As I have explained in #10741, this process is excruciatingly slow, so this is
*not* turned on by default, and it is also why I have decided to hide it behind
a -Z flag for now. The good news is that the binary sizes are about as small as
they can be as a result of LTO, so it's definitely working.

Closes #10741
Closes #10740
2013-12-09 14:41:49 -08:00
Alex Crichton 6b34ba242d Update LLVM and jettison jit support
LLVM's JIT has been updated numerous times, and we haven't been tracking it at
all. The existing LLVM glue code no longer compiles, and the JIT isn't used for
anything currently.

This also rebases out the FixedStackSegment support which we have added to LLVM.
None of this is still in use by the compiler, and there's no need to keep this
functionality around inside of LLVM.

This is needed to unblock #10708 (where we're tripping an LLVM assertion).
2013-12-05 09:15:54 -08:00
Daniel Micay 541e5f84d7 add support for the `cold` function attribute
This allows a function to marked as infrequently called, resulting in
any branch calling it to be considered colder.
2013-10-28 15:34:50 -04:00
Daniel Micay 7bad416765 have LLVM print type strings for us
Example:

    void ({ i64, %tydesc*, i8*, i8*, i8 }*, i64*, %"struct.std::fmt::Formatter[#1]"*)*

Before, we would print 20 levels deep due to recursion in the type
definition.
2013-10-11 20:26:08 -04:00
Michael Woerister 85deeeab59 debuginfo: Unified namespace generation approach for crate-local and external items. Fixed bug related to LLVM metadata uniquing. 2013-10-08 10:35:24 +02:00
Michael Woerister ccb721a58d debuginfo: Added description of algorithm for handling recursive types.
Also fixed nasty bug caused by calling LLVMDIBuilderCreateStructType() with a null pointer where an empty array was expected (which would trigger an unintelligable assertion somewhere down the line).
2013-09-15 12:28:25 +02:00
Michael Woerister f85da506a8 debuginfo: Support for recursive types. 2013-09-15 12:28:25 +02:00
Michael Woerister 382cb500be debuginfo: Wrapped namespace facilities of llvm::DIBuilder 2013-09-10 16:25:19 +02:00
Daniel Micay 889e1b9731 add `noalias` attribute to ~ return values 2013-09-09 13:48:54 -04:00
Michael Woerister b81ea86530 debuginfo: Support for variables captured in closures and closure type descriptions. 2013-09-04 18:38:46 +02:00
Brian Anderson 3801534d10 Revert "auto merge of #8695 : thestinger/rust/build, r=pcwalton"
This reverts commit 2c0f9bd354, reversing
changes made to f8c4f0ea9c.

Conflicts:
	src/rustllvm/RustWrapper.cpp
2013-08-28 19:59:52 -07:00
Alex Crichton 73540551e5 Rewrite pass management with LLVM
Beforehand, it was unclear whether rust was performing the "recommended set" of
optimizations provided by LLVM for code. This commit changes the way we run
passes to closely mirror that of clang, which in theory does it correctly. The
notable changes include:

* Passes are no longer explicitly added one by one. This would be difficult to
  keep up with as LLVM changes and we don't guaranteed always know the best
  order in which to run passes
* Passes are now managed by LLVM's PassManagerBuilder object. This is then used
  to populate the various pass managers run.
* We now run both a FunctionPassManager and a module-wide PassManager. This is
  what clang does, and I presume that we *may* see a speed boost from the
  module-wide passes just having to do less work. I have no measured this.
* The codegen pass manager has been extracted to its own separate pass manager
  to not get mixed up with the other passes
* All pass managers now include passes for target-specific data layout and
  analysis passes

Some new features include:

* You can now print all passes being run with `-Z print-llvm-passes`
* When specifying passes via `--passes`, the passes are now appended to the
  default list of passes instead of overwriting them.
* The output of `--passes list` is now generated by LLVM instead of maintaining
  a list of passes ourselves
* Loop vectorization is turned on by default as an optimization pass and can be
  disabled with `-Z no-vectorize-loops`
2013-08-26 20:11:51 -07:00
Luqman Aden cfd0bfbd11 rustllvm: Specify hard floats for gnueabihf. 2013-08-24 08:49:03 -04:00
Daniel Micay 0ac02e7c4f make: stop disabling frame pointer elimination
We currently have no need for the frame pointers on any platform. They
may eventually be needed on platforms without an equivalent to the DWARF
call frame information to walk the stack in the garbage collector.

Closes #7477
2013-08-22 20:49:48 -04:00
bors a8c3fe45c6 auto merge of #8328 : alexcrichton/rust/llvm-head, r=brson
The first commit message is pretty good, but whomever reviews this should probably also at least glance at the changes I made in LLVM. I basically reorganized our pending patch queue to be a bit more organized and clearer in what needs to go where. After this, our queue would be:

* Add the `no-split-stack` attribute
* Add the `fixedstacksegment` attribute
* Add split-stacks for arm android
* Add split-stacks for arm linux
* Add split stacks for mips

Then there's a patch which I added to get rust to build at all on LLVM-head, and I'm not quite sure why it's there, but nothing seems to be crashing for now! (famous last words).

Otherwise, I just updated code to reflect the changes I made in LLVM with the only major change being the advent of the new `no_split_stack` attribute. This is work towards #1226, but someone more familiar with the code should probably actually assign the attribute to the appropriate functions.

Also as a bonus, I've verified that this closes #5774
2013-08-20 11:31:59 -07:00
Alex Crichton 7f91e7740d Fix LLVM compilation issues and use the new attrs
This implements #[no_split_stack] and also changes #[fast_ffi] to using the new
"fixedstacksegment" string attribute instead of integer attribute.
2013-08-20 08:33:52 -07:00
Michael Woerister 907633b1bf debuginfo: Generate template type parameters for generic functions.
Conflicts:
	src/librustc/lib/llvm.rs
	src/librustc/middle/trans/debuginfo.rs
	src/rustllvm/RustWrapper.cpp
	src/rustllvm/rustllvm.def.in
2013-08-16 22:27:38 +02:00
bors 1785841a5b auto merge of #8410 : luqmana/rust/mcpu, r=sanxiyn
Adds `--target-cpu` flag which lets you choose a more specific target cpu instead of just passing the default, `generic`. It's more or less akin to `-mcpu`/`-mtune` in clang/gcc.
2013-08-11 20:50:14 -07:00
Luqman Aden fcfd6e7c79 rustc: Add --target-cpu flag to select a more specific processor instead of the default, 'generic'. 2013-08-10 17:03:43 -04:00
Alex Crichton 2f3fde60c3 Implement an `address_insignificant` attribute
This can be applied to statics and it will indicate that LLVM will attempt to
merge the constant in .data with other statics.

I have preliminarily applied this to all of the statics generated by the new
`ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a
separate file with 1000 calls to `fmt!` to compare the sizes, and the results
were:

fmt           310k
ifmt (before) 529k
ifmt (after)  202k

This now means that ifmt! is both faster and smaller than fmt!, yay!
2013-08-09 13:49:41 -07:00
Alex Crichton 8d29367650 Fix build issues once LLVM has been upgraded
* LLVM now has a C interface to LLVMBuildAtomicRMW
* The exception handling support for the JIT seems to have been dropped
* Various interfaces have been added or headers have changed
2013-08-04 10:58:23 -07:00
James Miller 4a1a0fbed5 Add an atomic fence intrinsic 2013-07-28 20:26:49 +12:00
Michael Woerister f389bd8f2a debuginfo: Support for tuple-style enums (WIP) 2013-07-19 07:55:24 +02:00
Michael Woerister 739f3eece9 debuginfo: Added support for c-style enums. 2013-07-19 07:55:24 +02:00
Vadim Chugunov adff46250e Fixed rebase fallout . 2013-06-17 08:42:05 -07:00
Vadim Chugunov 65dd6218af Fixed remaining issues to pass debug-test/* tests.
Made debugger scripts source line insensitive.
2013-06-17 08:41:25 -07:00
Vadim Chugunov 6cc3189787 Made the while DebugContext mutable, not just created_* hashes
Disabled create_arg
2013-06-17 08:41:23 -07:00
Vadim Chugunov 868f9a88d6 Use DIBuilder in debuginfo 2013-06-17 08:41:23 -07:00
Alex Crichton dc18321ef5 Don't run passes again on JIT code
These passes are already run beforehand, no need to do them twice.
2013-06-13 22:53:10 -07:00
Alex Crichton a90fffe367 Revert "Revert "Have JIT execution take ownership of the LLVMContextRef""
This reverts commit 19adece68b.
2013-06-13 21:25:18 -07:00
Alex Crichton 1a3edecbf2 Revert "Revert "Remove all usage of the global LLVMContextRef""
This reverts commit 541c657a73.
2013-06-13 21:25:12 -07:00
Brian Anderson 541c657a73 Revert "Remove all usage of the global LLVMContextRef"
This reverts commit 779191cd4b.

Conflicts:
	src/librustc/middle/trans/base.rs
	src/librustc/middle/trans/common.rs
2013-06-13 13:08:57 -07:00
Brian Anderson 19adece68b Revert "Have JIT execution take ownership of the LLVMContextRef"
This reverts commit 5c5095d25e.

Conflicts:
	src/librusti/rusti.rc
2013-06-13 13:08:57 -07:00
Alex Crichton 5c5095d25e Have JIT execution take ownership of the LLVMContextRef
Also stop leaking the ExecutionEngine created for jit code by forcibly disposing
of it after the JIT code has finished executing
2013-06-10 13:17:04 -07:00
Alex Crichton 779191cd4b Remove all usage of the global LLVMContextRef
This allows parallel usage of the rustc library
2013-06-10 13:17:04 -07:00
James Miller d694e283b3 Refactor optimization pass handling.
Refactor the optimization passes to explicitly use the passes. This commit
just re-implements the same passes as were already being run.

It also adds an option (behind `-Z`) to run the LLVM lint pass on the
unoptimized IR.
2013-05-29 14:16:49 +12:00
Brian Anderson 474d9983be rustllvm: Use target alignment for atomic load/store 2013-05-20 17:28:06 -07:00
James Miller a289dcd187 Fix AtomicLoad builder code 2013-05-17 14:48:24 +12:00
Matthijs Hofstra a9f2132606 Adds atomic_load, atomic_load_acq, atomic_store, and atomic_store_rel intrinsics.
The default versions (atomic_load and atomic_store) are sequentially consistent.
The atomic_load_acq intrinsic acquires as described in [1].
The atomic_store_rel intrinsic releases as described in [1].

[1]: http://llvm.org/docs/Atomics.html
2013-05-12 23:23:40 +02:00
Daniel Micay 86efd97a10 add gitattributes and fix whitespace issues 2013-05-03 20:01:42 -04:00
Seo Sanghyeon da4bc490e6 Choose target features 2013-04-22 20:54:12 +09:00
Patrick Walton 90b65c8839 llvm: Fixes for RustWrapper. 2013-04-19 11:53:34 -07:00
Patrick Walton af42d37547 rustllvm: Fix RustWrapper.cpp 2013-04-19 11:53:32 -07:00
Patrick Walton f903ae9e72 librustc: Implement fast-ffi and use it in various places 2013-04-19 11:53:31 -07:00
Brian Anderson a34948a2c5 rustllvm: Initialize target analysis passes
Without this the target info for certain optimizations will not be
created and the compiler will sometimes crash
2013-04-10 18:49:51 -07:00
Young-il Choi 4b4f48283b rustllvm: followup latest LLVM 2013-04-10 18:49:50 -07:00
Tim Chevalier d6f455ebca rustllvm: Only initialize command-line arguments once
In my WIP on rustpkg, I was calling driver code that calls
LLVMRustWriteOutputFile more than once. This was making LLVM
unhappy, since that function has code that initializes the
command-line options for LLVM, and I guess you can't do that more
than once. So, check if they've already been initialized.
2013-04-05 17:18:26 -07:00
ILyoan 1ded138851 Enable arm error handling abi 2 2013-03-19 17:23:18 +09:00
ILyoan f581b2f9dd Enable arm error handling abi 2013-03-19 17:23:08 +09:00
ILyoan 10df2ea9db Normalize target triple so that llvm can recognize target os correctly 2013-03-15 15:39:58 +09:00
Niko Matsakis efc7f82bc4 Revamp foreign code not to consider the Rust modes. This requires
adjusting a few foreign functions that were declared with by-ref
mode.  This also allows us to remove by-val mode in the near future.

With copy mode, though, we have to be careful because Rust will implicitly pass
somethings by pointer but this may not be the C ABI rules.  For example, rust
will pass a struct Foo as a Foo*.  So I added some code into the adapters to
fix this (though the C ABI rules may put the pointer back, oh well).

This patch also includes a lint mode for the use of by-ref mode
in foreign functions as the semantics of this have changed.
2013-03-13 16:59:37 -04:00
Luqman Aden fc78b93c41 Wrap llvm::InlineAsm::AsmDialect 2013-03-12 01:03:34 -07:00
Luqman Aden ecccc0d649 Parse inline assembly. 2013-03-12 01:03:34 -07:00
Jyun-Yan You 5150b9811b rustc: MIPS32 support 2013-03-03 19:27:27 -08:00
kyeongwoon 987f824f23 Support ARM and Android
Conflicts:
	src/libcore/os.rs
	src/librustc/back/link.rs
	src/librustc/driver/driver.rs
	src/librustc/metadata/loader.rs
	src/librustc/middle/trans/base.rs
2013-01-13 16:43:39 -08:00
Brian Leibig dda12f8ef6 Replace much of the REPL run code with a call to compile_upto 2012-12-28 13:51:02 -08:00
Patrick Walton 3ee1d3ebb8 rustllvm: Fix symbol resolution on Mac for rusti. rs=bugfix 2012-12-22 16:24:19 -05:00
Graydon Hoare 12c32e944d Add license boilerplate to more files. 2012-12-10 17:32:58 -08:00
Luqman Aden e1db959ec2 rustc: add new intrinsics - atomic_cxchg{_acq,_rel} 2012-10-21 22:23:50 -04:00
Luca Bruno 97ecde297e Conditional usage of LLVM DebugFlag
DebugFlag is conditionally exported by LLVM in llvm/Support/Debug.h
in-between an #ifndef NDEBUG block; RustWrapper should not
unconditionally use it. This closes #3701.

Signed-off-by: Luca Bruno <lucab@debian.org>
2012-10-11 07:33:49 +02:00
Zack Corr b3f418c10e jit: Remove old crate loading code and don't search through loaded crates (use llvm default instead) 2012-09-28 18:05:49 +10:00
Zack Corr ca4455666e jit: Initialize native parser so rust-repl works 2012-09-27 16:07:33 +10:00
Zack Corr ebe6b2d15c jit: Enable exception handling 2012-09-27 12:57:58 +10:00
Zack Corr 887b59b7be jit: Separate JIT execution into two functions and load crates before main lookup 2012-09-27 12:57:58 +10:00
Zack Corr efb576a60d jit: Clean rustllvm code, let rustc expose __morestack instead of linking in libmorestack and return _rust_main and call it from rustc 2012-08-31 16:20:36 -07:00
Zack Corr 6723a5a0ea jit: Forgot header for inlining pass 2012-08-31 16:20:36 -07:00
Zack Corr 19ea3ab480 jit: Add passes and cleanup code 2012-08-31 16:20:36 -07:00
Zack Corr 795acb7395 jit: Link in __morestack and make it resolvable by JIT 2012-08-31 16:20:36 -07:00
Zack Corr 7993f48209 jit: Add custom memory manager (still segfaulting) 2012-08-31 16:20:35 -07:00
Zack Corr d7aa9918ef Add experimental JIT compiler 2012-08-31 16:20:35 -07:00
Elliott Slaughter 987814f11e Added debug flag to enable LLVM debug output. 2012-07-25 16:00:13 -07:00
Elliott Slaughter d9c9a2f97e Remove rustllvm functions which have moved upstream. 2012-07-24 17:11:13 -07:00
Zack Corr 480fa7c00e Only initialize targets that are actually supported / linked to in RustWrapper 2012-07-24 17:11:13 -07:00
Glenn Willen 28c1f21433 Better error when rustc fails to write output. 2012-07-13 17:06:30 -04:00
Eric Holk 0a99912cdd Adding a bunch of atomic intrinsics.
Adding a test cases for the atomic intrinsics.
2012-06-29 18:37:29 -07:00
Graydon Hoare 079c3b02a8 Update llvm and integrate clang and compiler-rt. 2012-04-30 17:48:38 -07:00
Brian Anderson bb1e79768c llvm: Switch back to LLVM trunk 2012-01-13 11:05:59 -08:00
Josh Matthews 10030a37d5 Generate basic debug info for files, functions and compile units. 2011-12-18 23:39:54 -05:00
Brian Anderson a92218e630 Upgrade LLVM to svn revision 145779
This pulls in commits 145765 & 145766, which are required for split stacks.
2011-12-04 14:59:56 -08:00
Brian Anderson 9a188b2e94 rustc: Fall back to intrinsics.ll if we can't parse the bc
This will allow us to transition to the new bitcode format.
2011-11-25 22:54:10 -08:00
Niko Matsakis 834b6879ea temp workaround for failure to pass ulonglong successfully 2011-11-16 15:27:09 -08:00
Haitao Li b8dd148444 rustllvm: Add a GetOrInsertFunction wrapper
Fixes issue #1161

Test-case-by: Brian Anderson <banderson@mozilla.com>
Signed-off-by: Haitao Li <lihaitao@gmail.com>
2011-11-15 00:33:29 +08:00
Haitao Li b12de98814 rustc: Add support of generating LLVM assembly
rustc generates output files in LLVM bitcode format if "--emit-llvm"
option is given. When used with the "-S" option, rustc generates LLVM
intermediate language assembly files.

Fixes Issue #476
2011-11-07 21:44:40 +08:00
Patrick Walton 329f045d4c rustc: Enable segmented stacks in LLVM when --stack-growth is on 2011-10-31 14:42:44 -07:00
Brian Anderson 160c56e768 Get 'make tidy' to work rustllvm and rt again 2011-10-21 17:35:52 -07:00
Elly Jones a5dc6a7aa8 Update LinkModules invocation to use new prototype
LLVM revision 141606 changes the prototype of llvm::Linker::LinkModules.

Signed-off-by: Elly Jones <elly@leptoquark.net>
2011-10-15 15:53:18 -07:00
Lindsey Kuper 0d43e90172 Revert "Merge pull request #1025 from elly/master"
This reverts commit e12e76e9ba, reversing
changes made to f480203fdd.
2011-10-11 22:23:47 -04:00
Elly Jones 19eae0bc38 Update LinkModules invocation to use new prototype
LLVM revision 141606 changes the prototype of llvm::Linker::LinkModules.

Signed-off-by: Elly Jones <elly@leptoquark.net>
2011-10-11 21:32:34 -04:00
Marijn Haverbeke 58110b1b13 Follow LLVM header file shuffling
This allows us to compile against revision 138708. I need this, because
the version we currently use is causing mysterious corruption of object
files during linking on win, apparently triggered by my vec-representation
patch.
2011-08-28 20:59:05 +02:00
Rafael Ávila de Espíndola 6402b63b4f Use the new C API for PassManagerBuilder. 2011-08-11 19:09:52 -04:00
Rafael Ávila de Espíndola 4cee063976 Update for llvm api change. 2011-08-11 14:58:30 -07:00
Kelly Wilson 1e4f198a1d Update RustWrapper.cpp so that LLVM revision 134231 from June 30, 2011 at 22:15 GMT, works. 2011-07-01 00:56:49 -06:00
Rafael Ávila de Espíndola 64513808ca Use fast regalloc and codegen at OptLevel=0. 2011-06-22 16:50:30 -04:00
Rafael Ávila de Espíndola 698022d351 Update rust to build with newer llvm versions. 2011-06-08 14:08:24 -04:00
Brian Anderson 1ad58d4dd6 rustllvm: Free TargetMachine in LLVMRustWriteOutputFile 2011-05-14 00:48:51 -04:00
Graydon Hoare d6f1fcff6b Add --time-llvm-passes. 2011-05-10 16:10:08 -07:00
Graydon Hoare db3b9a4992 Stop stringifying integers to get integral constants. 2011-05-07 18:54:23 +00:00
Graydon Hoare e2f7f11d47 Put out burning linux tinderbox. 2011-05-06 16:07:28 -07:00
Kelly Wilson b4a0d891c0 Ge the host triple using LLVM. Fix a few 'mutable' warnings also. 2011-05-06 11:30:39 -07:00
Patrick Walton 5fb6e6364b rustc: Add a binding to LLVM's bitcode parser 2011-05-05 11:34:45 -07:00
Patrick Walton 729648282b rustllvm: Add bindings to the LLVM linker 2011-05-04 21:27:00 -07:00
Patrick Walton c47a075a99 rustllvm: Whitespace police in RustWrapper.cpp 2011-05-04 20:30:23 -07:00
Patrick Walton f969b227c1 rustc: Disable frame pointer omission 2011-05-02 11:01:51 -07:00
Rafael Ávila de Espíndola b0980b7d79 Add a very minimal set of .cfi_* statements to get part of backtraces
working (on hello world at least):

~/inst/gdb/bin/gdb --args ./foo
(gdb) b write
...
(gdb) r
...
Breakpoint 1, 0xf7f04270 in write () from /lib32/libc.so.6
(gdb) bt
0  0xf7f04270 in write () from /lib32/libc.so.6
1  0x0804931a in rust_native_cdecl_3 ()
2  0x080487d7 in _rust_wrapper3_ ()
3  0x0804890a in _rust_fn5_main ()
4  0x08049440 in rust_native_cdecl_7 ()
2011-04-28 16:19:20 -04:00
Graydon Hoare 592cd5fa30 Disable frame-pointer elimination (not sure how this didn't get commited before). 2011-04-26 15:21:20 -07:00
Rafael Ávila de Espíndola fac8cc3b06 Use -c in the Makefiles. 2011-04-22 15:15:52 -04:00
Rafael Ávila de Espíndola 9eb1479746 Dispose the module.
Thanks to brson for noticing it.
2011-04-22 14:49:02 -04:00
Rafael Ávila de Espíndola 9657e5d2d3 Revert 9ab42038bb while I find what is
wrong on Windows.
2011-04-18 15:37:04 -04:00
Rafael Ávila de Espíndola 9ab42038bb Change the makefiles to use -c. 2011-04-18 15:00:17 -04:00
Rafael Ávila de Espíndola f12998e5d7 Add a -c option. 2011-04-18 10:02:52 -04:00
Rafael Ávila de Espíndola 099e094765 Produce PIC code and use -S in the Makefile. 2011-04-15 19:29:13 -04:00
Rafael Ávila de Espíndola 2214b6835d Add a -S option for producing assembly. I will move more of it to
rust once the necessary APIs are available in C.
2011-04-15 17:41:14 -04:00
Rafael Ávila de Espíndola 01b1d4110d Remove code that is already in llvm for some time. 2011-04-13 14:55:44 -04:00
Rafael Ávila de Espíndola e7b8db2e63 Enable alias analysis and the function attributes pass.
The C API extension is already upstream, we can drop the local copy once
the bots are updated.
2011-04-13 13:54:08 -04:00
Rafael Ávila de Espíndola fcb344799a Add a hack to force the linker to fetch Object.o 2011-04-11 15:49:45 -04:00
Graydon Hoare 7ac885ee8c Repair some fallout from pcwalton's last few build changes. 2011-03-21 23:06:42 -07:00