diff options
| author | Graydon Hoare <[email protected]> | 2010-08-18 00:19:45 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-08-18 00:19:45 -0700 |
| commit | 9db70bfc42702e32bac09394e55bd756664aadf8 (patch) | |
| tree | b9b3ba8c7ee5fdd9b3260139804d494153cd4f9e /src/comp/driver | |
| parent | Fix symbol names on LLVM C library binding and library-name for LLVM. (diff) | |
| download | rust-9db70bfc42702e32bac09394e55bd756664aadf8.tar.xz rust-9db70bfc42702e32bac09394e55bd756664aadf8.zip | |
Add test code that exercises LLVM in rustc. Works.
Diffstat (limited to 'src/comp/driver')
| -rw-r--r-- | src/comp/driver/rustc.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index 1a0329c1..4b842bd0 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -1,5 +1,20 @@ // -*- rust -*- +import std._str; +import lib.llvm.llvm; +import lib.llvm.builder; + +fn write_module() { + auto llmod = + llvm.LLVMModuleCreateWithNameInContext(_str.buf("rust_out"), + llvm.LLVMGetGlobalContext()); + + auto b = builder(llvm.LLVMCreateBuilder()); + + llvm.LLVMWriteBitcodeToFile(llmod, _str.buf("rust_out.bc")); + llvm.LLVMDisposeModule(llmod); +} + fn main(vec[str] args) -> () { log "This is the rust 'self-hosted' compiler."; @@ -19,6 +34,8 @@ fn main(vec[str] args) -> () { i += 1; } + // Test LLVM module-writing. Nothing interesting yet. + write_module(); } |