Move llvm-using code in rustc to trans module.

This commit is contained in:
Graydon Hoare 2010-09-22 15:21:06 -07:00
parent e0f682e5fb
commit 738fe078a4
3 changed files with 38 additions and 21 deletions

View file

@ -1,21 +1,8 @@
// -*- rust -*-
import std._str;
import lib.llvm.llvm;
import lib.llvm.builder;
import fe.parser;
import fe.token;
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);
}
import me.trans;
fn main(vec[str] args) {
@ -31,17 +18,13 @@ fn main(vec[str] args) {
auto p = parser.new_parser(sess, filename);
log "opened file: " + filename;
auto crate = parser.parse_crate(p);
trans.translate_crate(sess, crate);
}
i += 1;
}
// Test LLVM module-writing. Nothing interesting yet.
write_module();
}
//
// Local Variables:
// mode: rust
// fill-column: 78;
@ -50,4 +33,3 @@ fn main(vec[str] args) {
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C ../.. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
//