OLD | NEW |
(Empty) | |
| 1 //===- PNaClABIVerifyModule.h - Verify PNaCl ABI rules ----------*- C++ -*-===// |
| 2 // |
| 3 // The LLVM Compiler Infrastructure |
| 4 // |
| 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. |
| 7 // |
| 8 //===----------------------------------------------------------------------===// |
| 9 // |
| 10 // Verify module-level PNaCl ABI requirements (specifically those that do not |
| 11 // require looking at the function bodies). |
| 12 // |
| 13 // |
| 14 //===----------------------------------------------------------------------===// |
| 15 |
| 16 #ifndef LLVM_ANALYSIS_NACL_PNACLABIVERIFYMODULE_H |
| 17 #define LLVM_ANALYSIS_NACL_PNACLABIVERIFYMODULE_H |
| 18 |
| 19 #include "llvm/ADT/StringMap.h" |
| 20 #include "llvm/Analysis/NaCl.h" |
| 21 #include "llvm/IR/Module.h" |
| 22 #include "llvm/Pass.h" |
| 23 |
| 24 namespace llvm { |
| 25 |
| 26 class PNaClAllowedIntrinsics; |
| 27 |
| 28 // This pass should not touch function bodies, to stay streaming-friendly |
| 29 class PNaClABIVerifyModule : public ModulePass { |
| 30 PNaClABIVerifyModule(const PNaClABIVerifyModule&) LLVM_DELETED_FUNCTION; |
| 31 void operator=(const PNaClABIVerifyModule&) LLVM_DELETED_FUNCTION; |
| 32 public: |
| 33 static char ID; |
| 34 PNaClABIVerifyModule() : |
| 35 ModulePass(ID), |
| 36 Reporter(new PNaClABIErrorReporter), |
| 37 ReporterIsOwned(true), |
| 38 StreamingMode(false), |
| 39 SeenEntryPoint(false) { |
| 40 initializePNaClABIVerifyModulePass(*PassRegistry::getPassRegistry()); |
| 41 } |
| 42 PNaClABIVerifyModule(PNaClABIErrorReporter *Reporter_, |
| 43 bool StreamingMode) : |
| 44 ModulePass(ID), |
| 45 Reporter(Reporter_), |
| 46 ReporterIsOwned(false), |
| 47 StreamingMode(StreamingMode), |
| 48 SeenEntryPoint(false) { |
| 49 initializePNaClABIVerifyModulePass(*PassRegistry::getPassRegistry()); |
| 50 } |
| 51 virtual ~PNaClABIVerifyModule(); |
| 52 bool runOnModule(Module &M); |
| 53 virtual void print(raw_ostream &O, const Module *M) const; |
| 54 |
| 55 // Checks validity of function declaration F with given name Name. |
| 56 // (see PNaClABIVerifyFunctions.h for handling function bodies). |
| 57 void checkFunction(const Function *F, const StringRef &Name, |
| 58 PNaClAllowedIntrinsics &Intrinsics); |
| 59 // Checks validity of global variable declaration GV. |
| 60 void checkGlobalVariable(const GlobalVariable *GV) { |
| 61 return checkGlobalValue(GV); |
| 62 } |
| 63 private: |
| 64 void checkGlobalValue(const GlobalValue *GV); |
| 65 /// Checks whether \p GV is an allowed external symbol in stable bitcode. |
| 66 void checkExternalSymbol(const GlobalValue *GV); |
| 67 |
| 68 void checkGlobalIsFlattened(const GlobalVariable *GV); |
| 69 PNaClABIErrorReporter *Reporter; |
| 70 bool ReporterIsOwned; |
| 71 bool StreamingMode; |
| 72 bool SeenEntryPoint; |
| 73 }; |
| 74 |
| 75 } |
| 76 #endif // LLVM_ANALYSIS_NACL_PNACLABIVERIFYMODULE_H |
OLD | NEW |