Index: tools/llc/llc.cpp |
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp |
index bdc14fc554b561b786e8cc20e3ccd770dcd8bff5..b71476a79e0c7d87be70444d17fa8cfe8dc9a8bc 100644 |
--- a/tools/llc/llc.cpp |
+++ b/tools/llc/llc.cpp |
@@ -15,6 +15,7 @@ |
#include "llvm/IR/LLVMContext.h" |
#include "llvm/ADT/Triple.h" |
+#include "llvm/Analysis/NaCl.h" |
#include "llvm/Assembly/PrintModulePass.h" |
#include "llvm/Support/DataStream.h" // @LOCALMOD |
#include "llvm/CodeGen/CommandFlags.h" |
@@ -107,6 +108,10 @@ ReduceMemoryFootprint("reduce-memory-footprint", |
cl::desc("Aggressively reduce memory used by llc"), |
cl::init(false)); |
+static cl::opt<bool> |
+ABIVerify("pnaclabi-verify", |
jvoung (off chromium)
2013/03/12 22:16:21
Maybe have the PNaCl prefix in the variable name t
Derek Schuff
2013/03/13 21:51:01
Done.
|
+ cl::desc("Verify PNaCl bitcode ABI before translating"), |
+ cl::init(false)); |
// @LOCALMOD-END |
// Determine optimization level. |
@@ -346,6 +351,11 @@ static int compileModule(char **argv, LLVMContext &Context) { |
} |
// @LOCALMOD-BEGIN |
+ if (ABIVerify) { |
+ // Verify the module (but not the functions yet) |
+ ModulePass* VerifyPass = createPNaClABIVerifyModulePass(true); |
jvoung (off chromium)
2013/03/12 22:16:21
The Function pass is only added when __native_clie
Mark Seaborn
2013/03/12 22:25:56
Spacing should be " *"
Derek Schuff
2013/03/13 21:51:01
Done.
Derek Schuff
2013/03/13 21:51:01
Done.
|
+ VerifyPass->runOnModule(*mod); |
+ } |
#if defined(__native_client__) && defined(NACL_SRPC) |
RecordMetadataForSrpc(*mod); |
@@ -554,6 +564,10 @@ static int compileModule(char **argv, LLVMContext &Context) { |
StopAfterID = PI->getTypeInfo(); |
} |
+ // Add the ABI verifier pass before the code emission passes. |
+ if (ABIVerify) |
+ PM->add(createPNaClABIVerifyFunctionsPass(true)); |
+ |
// Ask the target to add backend passes as necessary. |
if (Target.addPassesToEmitFile(*PM, FOS, FileType, NoVerify, |
StartAfterID, StopAfterID)) { |