Commit graph

183 commits

Author SHA1 Message Date
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
Renamed from src/llvmext/RustWrapper.cpp (Browse further)