aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <[email protected]>2011-04-18 10:02:34 -0400
committerRafael Ávila de Espíndola <[email protected]>2011-04-18 10:02:52 -0400
commitf12998e5d7a4409d2bf748a671c345a79085213e (patch)
treee8ae174f5e6bf1c8c7c87b18d807684d1b126358 /src/comp/middle
parentMake log the log level configurable per module (diff)
downloadrust-f12998e5d7a4409d2bf748a671c345a79085213e.tar.xz
rust-f12998e5d7a4409d2bf748a671c345a79085213e.zip
Add a -c option.
Diffstat (limited to 'src/comp/middle')
-rw-r--r--src/comp/middle/trans.rs30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index ac2ceff5..db27a823 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -6754,6 +6754,17 @@ tag output_type {
output_type_none;
output_type_bitcode;
output_type_assembly;
+ output_type_object;
+}
+
+fn is_object_or_assembly(output_type ot) -> bool {
+ if (ot == output_type_assembly) {
+ ret true;
+ }
+ if (ot == output_type_object) {
+ ret true;
+ }
+ ret false;
}
fn run_passes(ModuleRef llmod, bool opt, str output,
@@ -6823,10 +6834,21 @@ fn run_passes(ModuleRef llmod, bool opt, str output,
}
llvm.LLVMAddVerifierPass(pm.llpm);
- if (ot == output_type_assembly) {
- llvm.LLVMRustWriteAssembly(pm.llpm, llmod,
- _str.buf(x86.get_target_triple()),
- _str.buf(output));
+ if (is_object_or_assembly(ot)) {
+ let int LLVMAssemblyFile = 0;
+ let int LLVMObjectFile = 1;
+ let int LLVMNullFile = 2;
+ auto FileType;
+ if (ot == output_type_object) {
+ FileType = LLVMObjectFile;
+ } else {
+ FileType = LLVMAssemblyFile;
+ }
+
+ llvm.LLVMRustWriteOutputFile(pm.llpm, llmod,
+ _str.buf(x86.get_target_triple()),
+ _str.buf(output),
+ FileType);
ret;
}