Index: src/llvm2ice.cpp |
diff --git a/src/llvm2ice.cpp b/src/llvm2ice.cpp |
index 6573acd6f82b8ba645ba29f81e10fe36ad1484af..3dca661f36ca8773924cb6d22fb420d9f1453a6e 100644 |
--- a/src/llvm2ice.cpp |
+++ b/src/llvm2ice.cpp |
@@ -148,10 +148,14 @@ static cl::opt<std::string> |
"unnamed functions"), |
cl::init("Function")); |
+// Note: While this flag isn't used in the minimal build, we keep this |
+// flag so that tests can set this command-line flag without concern |
+// to the type of build. We double check that this flag at runtime |
+// to make sure the consistency is maintained. |
static cl::opt<bool> |
-BuildOnRead("build-on-read", |
- cl::desc("Build ICE instructions when reading bitcode"), |
- cl::init(false)); |
+ BuildOnRead("build-on-read", |
+ cl::desc("Build ICE instructions when reading bitcode"), |
+ cl::init(true)); |
static cl::opt<bool> |
UseIntegratedAssembler("integrated-as", |
@@ -267,10 +271,19 @@ int main(int argc, char **argv) { |
Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); |
int ErrorStatus = 0; |
+#if ALLOW_LLVM_IR == 1 |
if (BuildOnRead) { |
Jim Stichnoth
2014/10/28 20:45:35
Could this #if construct be more like this?
if (B
Karl
2014/10/28 21:43:51
Done.
|
+#else |
+ if (!BuildOnRead) { |
+ *Ls << "Error: Build doesn't allow LLVM IR, " |
+ << "--build-on-read=0 not allowed\n"; |
+ return GetReturnValue(1); |
+ } |
+#endif |
Ice::PNaClTranslator Translator(&Ctx, Flags); |
Translator.translate(IRFilename); |
ErrorStatus = Translator.getErrorStatus(); |
+#if ALLOW_LLVM_IR == 1 |
} else { |
// Parse the input LLVM IR file into a module. |
SMDiagnostic Err; |
@@ -287,6 +300,7 @@ int main(int argc, char **argv) { |
Converter.convertToIce(); |
ErrorStatus = Converter.getErrorStatus(); |
} |
+#endif |
if (TimeEachFunction) { |
const bool DumpCumulative = false; |
Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |