OLD | NEW |
(Empty) | |
| 1 //===- PNaClABIVerifyFunctions.h - Verify PNaCl ABI rules -----------------===// |
| 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 function-level PNaCl ABI requirements. |
| 11 // |
| 12 // |
| 13 //===----------------------------------------------------------------------===// |
| 14 |
| 15 #ifndef LLVM_ANALYSIS_NACL_PNACLABIVERIFYFUNCTIONS_H |
| 16 #define LLVM_ANALYSIS_NACL_PNACLABIVERIFYFUNCTIONS_H |
| 17 |
| 18 #include "llvm/Analysis/NaCl/PNaClABIProps.h" |
| 19 |
| 20 #include "llvm/Analysis/NaCl.h" |
| 21 #include "llvm/IR/DataLayout.h" |
| 22 #include "llvm/IR/Module.h" |
| 23 #include "llvm/IR/NaClAtomicIntrinsics.h" |
| 24 #include "llvm/Pass.h" |
| 25 |
| 26 namespace llvm { |
| 27 |
| 28 // Checks that examine anything in the function body should be in |
| 29 // FunctionPasses to make them streaming-friendly. |
| 30 class PNaClABIVerifyFunctions : public FunctionPass { |
| 31 PNaClABIVerifyFunctions(const PNaClABIVerifyFunctions&) LLVM_DELETED_FUNCTION; |
| 32 void operator=(const PNaClABIVerifyFunctions&) LLVM_DELETED_FUNCTION; |
| 33 public: |
| 34 static char ID; |
| 35 PNaClABIVerifyFunctions() : |
| 36 FunctionPass(ID), |
| 37 Reporter(new PNaClABIErrorReporter), |
| 38 ReporterIsOwned(true) { |
| 39 initializePNaClABIVerifyFunctionsPass(*PassRegistry::getPassRegistry()); |
| 40 } |
| 41 explicit PNaClABIVerifyFunctions(PNaClABIErrorReporter *Reporter_) : |
| 42 FunctionPass(ID), |
| 43 Reporter(Reporter_), |
| 44 ReporterIsOwned(false) { |
| 45 initializePNaClABIVerifyFunctionsPass(*PassRegistry::getPassRegistry()); |
| 46 } |
| 47 virtual ~PNaClABIVerifyFunctions(); |
| 48 virtual bool doInitialization(Module &M) { |
| 49 AtomicIntrinsics.reset(new NaCl::AtomicIntrinsics(M.getContext())); |
| 50 return false; |
| 51 } |
| 52 virtual void getAnalysisUsage(AnalysisUsage &Info) const { |
| 53 Info.setPreservesAll(); |
| 54 Info.addRequired<DataLayoutPass>(); |
| 55 } |
| 56 bool runOnFunction(Function &F); |
| 57 virtual void print(raw_ostream &O, const Module *M) const; |
| 58 |
| 59 private: |
| 60 const char *checkInstruction(const DataLayout *DL, const Instruction *Inst); |
| 61 PNaClABIErrorReporter *Reporter; |
| 62 bool ReporterIsOwned; |
| 63 std::unique_ptr<NaCl::AtomicIntrinsics> AtomicIntrinsics; |
| 64 }; |
| 65 |
| 66 } |
| 67 |
| 68 #endif // LLVM_ANALYSIS_NACL_PNACLABIVERIFYFUNCTIONS_H |
OLD | NEW |