1
Fork 0

LLVM < 3.5 is unsupported since bb18a3c

This commit is contained in:
Tamir Duberstein 2015-04-20 10:19:02 -07:00
parent 77acda1c8e
commit ba276adab5
9 changed files with 18 additions and 91 deletions

View file

@ -92,9 +92,6 @@ LLVMRustCreateTargetMachine(const char *triple,
TargetOptions Options;
Options.PositionIndependentExecutable = PositionIndependentExecutable;
Options.NoFramePointerElim = NoFramePointerElim;
#if LLVM_VERSION_MINOR < 5
Options.EnableSegmentedStacks = EnableSegmentedStacks;
#endif
Options.FloatABIType = FloatABI::Default;
Options.UseSoftFloat = UseSoftFloat;
if (UseSoftFloat) {
@ -128,10 +125,8 @@ LLVMRustAddAnalysisPasses(LLVMTargetMachineRef TM,
PassManagerBase *PM = unwrap(PMR);
#if LLVM_VERSION_MINOR >= 6
PM->add(new DataLayoutPass());
#elif LLVM_VERSION_MINOR == 5
PM->add(new DataLayoutPass(unwrap(M)));
#else
PM->add(new DataLayout(unwrap(M)));
PM->add(new DataLayoutPass(unwrap(M)));
#endif
unwrap(TM)->addAnalysisPasses(*PM);
}
@ -202,10 +197,8 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target,
raw_fd_ostream OS(path, EC, sys::fs::F_None);
if (EC)
ErrorInfo = EC.message();
#elif LLVM_VERSION_MINOR >= 4
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
#else
raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
#endif
if (ErrorInfo != "") {
LLVMRustSetLastError(ErrorInfo.c_str());
@ -230,19 +223,13 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR,
raw_fd_ostream OS(path, EC, sys::fs::F_None);
if (EC)
ErrorInfo = EC.message();
#elif LLVM_VERSION_MINOR >= 4
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
#else
raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
#endif
formatted_raw_ostream FOS(OS);
#if LLVM_VERSION_MINOR >= 5
PM->add(createPrintModulePass(FOS));
#else
PM->add(createPrintModulePass(&FOS));
#endif
PM->run(*unwrap(M));
}