Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: tools/llc/llc.cpp

Issue 12449014: ABI verifier: Add standalone tool pnacl-abicheck (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)) {
« lib/Analysis/NaCl/PNaClABIVerifyModule.cpp ('K') | « lib/Analysis/NaCl/PNaClABIVerifyModule.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698