mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Add test code that exercises LLVM in rustc. Works.
This commit is contained in:
parent
3f2c39b3d8
commit
9db70bfc42
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user