diff options
| author | Rafael Ávila de Espíndola <respindola@mozilla.com> | 2011-04-18 10:02:34 -0400 |
|---|---|---|
| committer | Rafael Ávila de Espíndola <respindola@mozilla.com> | 2011-04-18 10:02:52 -0400 |
| commit | f12998e5d7a4409d2bf748a671c345a79085213e (patch) | |
| tree | e8ae174f5e6bf1c8c7c87b18d807684d1b126358 /src/rustllvm/RustWrapper.cpp | |
| parent | 148e6f7b00b89850d46624170b82a932d0302575 (diff) | |
| download | rust-f12998e5d7a4409d2bf748a671c345a79085213e.tar.gz rust-f12998e5d7a4409d2bf748a671c345a79085213e.zip | |
Add a -c option.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index b2dcd06555b..ad702555812 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -42,8 +42,15 @@ extern "C" void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM); void (*RustHackToFetchPassesO)(LLVMPassManagerRef PM) = LLVMAddBasicAliasAnalysisPass; -extern "C" void LLVMRustWriteAssembly(LLVMPassManagerRef PMR, LLVMModuleRef M, - const char *triple, const char *path) { +enum LLVMCodeGenFileType { + LLVMAssemblyFile, + LLVMObjectFile, + LLVMNullFile // Do not emit any output. +}; + +extern "C" void LLVMRustWriteOutputFile(LLVMPassManagerRef PMR, LLVMModuleRef M, + const char *triple, const char *path, + LLVMCodeGenFileType FileType) { InitializeAllTargets(); InitializeAllAsmPrinters(); TargetMachine::setRelocationModel(Reloc::PIC_); @@ -53,13 +60,15 @@ extern "C" void LLVMRustWriteAssembly(LLVMPassManagerRef PMR, LLVMModuleRef M, TargetMachine &Target = *TheTarget->createTargetMachine(triple, FeaturesStr); bool NoVerify = false; CodeGenOpt::Level OLvl = CodeGenOpt::Default; - TargetMachine::CodeGenFileType FileType = TargetMachine::CGFT_AssemblyFile; PassManager *PM = unwrap<PassManager>(PMR); std::string ErrorInfo; raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary); formatted_raw_ostream FOS(OS); - bool foo = Target.addPassesToEmitFile(*PM, FOS, FileType, OLvl, NoVerify); + TargetMachine::CodeGenFileType FileType2 = + static_cast<TargetMachine::CodeGenFileType>(FileType); + + bool foo = Target.addPassesToEmitFile(*PM, FOS, FileType2, OLvl, NoVerify); assert(!foo); PM->run(*unwrap(M)); } |
