Index: src/IceCompiler.cpp |
diff --git a/src/IceCompiler.cpp b/src/IceCompiler.cpp |
index fbe05777d1b62cd43cf5ce8546b3baaf63a326c5..dcaeb0521841402b91efb84b8ea9b69057e36007 100644 |
--- a/src/IceCompiler.cpp |
+++ b/src/IceCompiler.cpp |
@@ -86,8 +86,13 @@ void Compiler::run(const Ice::ClFlags &Flags, GlobalContext &Ctx, |
const bool WasmBuildOnRead = Flags.getBuildOnRead() && wasmInput(IRFilename); |
if (BuildOnRead) { |
std::unique_ptr<PNaClTranslator> PTranslator(new PNaClTranslator(&Ctx)); |
+#ifdef PNACL_LLVM |
std::unique_ptr<llvm::StreamingMemoryObject> MemObj( |
new llvm::StreamingMemoryObjectImpl(InputStream.release())); |
+#else // !PNACL_LLVM |
+ std::unique_ptr<llvm::StreamingMemoryObject> MemObj( |
+ new llvm::StreamingMemoryObject(std::move(InputStream))); |
+#endif // !PNACL_LLVM |
PTranslator->translate(IRFilename, std::move(MemObj)); |
Translator.reset(PTranslator.release()); |
} else if (WasmBuildOnRead) { |
@@ -120,6 +125,7 @@ void Compiler::run(const Ice::ClFlags &Flags, GlobalContext &Ctx, |
// Parse the input LLVM IR file into a module. |
llvm::SMDiagnostic Err; |
TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); |
+#ifdef PNACL_LLVM |
llvm::DiagnosticHandlerFunction DiagnosticHandler = |
Flags.getLLVMVerboseErrors() |
? redirectNaClDiagnosticToStream(llvm::errs()) |
@@ -127,6 +133,10 @@ void Compiler::run(const Ice::ClFlags &Flags, GlobalContext &Ctx, |
std::unique_ptr<llvm::Module> Mod = |
NaClParseIRFile(IRFilename, Flags.getInputFileFormat(), Err, |
llvm::getGlobalContext(), DiagnosticHandler); |
+#else // !PNACL_LLVM |
+ llvm::LLVMContext Context; |
+ std::unique_ptr<llvm::Module> Mod = parseIRFile(IRFilename, Err, Context); |
+#endif // !PNACL_LLVM |
if (!Mod) { |
Err.print(Flags.getAppName().c_str(), llvm::errs()); |
Ctx.getErrorStatus()->assign(EC_Bitcode); |