OLD | NEW |
1 //===- PNaClABIVerifyFunctions.h - Verify PNaCl ABI rules -----------------===// | 1 //===- PNaClABIVerifyFunctions.h - Verify PNaCl ABI rules -----------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // Verify function-level PNaCl ABI requirements. | 10 // Verify function-level PNaCl ABI requirements. |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "llvm/IR/DataLayout.h" | 21 #include "llvm/IR/DataLayout.h" |
22 #include "llvm/IR/Module.h" | 22 #include "llvm/IR/Module.h" |
23 #include "llvm/IR/NaClAtomicIntrinsics.h" | 23 #include "llvm/IR/NaClAtomicIntrinsics.h" |
24 #include "llvm/Pass.h" | 24 #include "llvm/Pass.h" |
25 | 25 |
26 namespace llvm { | 26 namespace llvm { |
27 | 27 |
28 // Checks that examine anything in the function body should be in | 28 // Checks that examine anything in the function body should be in |
29 // FunctionPasses to make them streaming-friendly. | 29 // FunctionPasses to make them streaming-friendly. |
30 class PNaClABIVerifyFunctions : public FunctionPass { | 30 class PNaClABIVerifyFunctions : public FunctionPass { |
31 PNaClABIVerifyFunctions(const PNaClABIVerifyFunctions&) LLVM_DELETED_FUNCTION; | 31 PNaClABIVerifyFunctions(const PNaClABIVerifyFunctions&) = delete; |
32 void operator=(const PNaClABIVerifyFunctions&) LLVM_DELETED_FUNCTION; | 32 void operator=(const PNaClABIVerifyFunctions&) = delete; |
33 public: | 33 public: |
34 static char ID; | 34 static char ID; |
35 PNaClABIVerifyFunctions() : | 35 PNaClABIVerifyFunctions() : |
36 FunctionPass(ID), | 36 FunctionPass(ID), |
37 Reporter(new PNaClABIErrorReporter), | 37 Reporter(new PNaClABIErrorReporter), |
38 ReporterIsOwned(true) { | 38 ReporterIsOwned(true) { |
39 initializePNaClABIVerifyFunctionsPass(*PassRegistry::getPassRegistry()); | 39 initializePNaClABIVerifyFunctionsPass(*PassRegistry::getPassRegistry()); |
40 } | 40 } |
41 explicit PNaClABIVerifyFunctions(PNaClABIErrorReporter *Reporter_) : | 41 explicit PNaClABIVerifyFunctions(PNaClABIErrorReporter *Reporter_) : |
42 FunctionPass(ID), | 42 FunctionPass(ID), |
43 Reporter(Reporter_), | 43 Reporter(Reporter_), |
44 ReporterIsOwned(false) { | 44 ReporterIsOwned(false) { |
45 initializePNaClABIVerifyFunctionsPass(*PassRegistry::getPassRegistry()); | 45 initializePNaClABIVerifyFunctionsPass(*PassRegistry::getPassRegistry()); |
46 } | 46 } |
47 virtual ~PNaClABIVerifyFunctions(); | 47 virtual ~PNaClABIVerifyFunctions(); |
48 virtual bool doInitialization(Module &M) { | 48 virtual bool doInitialization(Module &M) { |
49 AtomicIntrinsics.reset(new NaCl::AtomicIntrinsics(M.getContext())); | 49 AtomicIntrinsics.reset(new NaCl::AtomicIntrinsics(M.getContext())); |
50 return false; | 50 return false; |
51 } | 51 } |
52 virtual void getAnalysisUsage(AnalysisUsage &Info) const { | 52 virtual void getAnalysisUsage(AnalysisUsage &Info) const { |
53 Info.setPreservesAll(); | 53 Info.setPreservesAll(); |
54 Info.addRequired<DataLayoutPass>(); | |
55 } | 54 } |
56 bool runOnFunction(Function &F); | 55 bool runOnFunction(Function &F); |
57 virtual void print(raw_ostream &O, const Module *M) const; | 56 virtual void print(raw_ostream &O, const Module *M) const; |
58 | 57 |
59 private: | 58 private: |
60 const char *checkInstruction(const DataLayout *DL, const Instruction *Inst); | 59 const char *checkInstruction(const DataLayout *DL, const Instruction *Inst); |
61 PNaClABIErrorReporter *Reporter; | 60 PNaClABIErrorReporter *Reporter; |
62 bool ReporterIsOwned; | 61 bool ReporterIsOwned; |
63 std::unique_ptr<NaCl::AtomicIntrinsics> AtomicIntrinsics; | 62 std::unique_ptr<NaCl::AtomicIntrinsics> AtomicIntrinsics; |
64 }; | 63 }; |
65 | 64 |
66 } | 65 } |
67 | 66 |
68 #endif // LLVM_ANALYSIS_NACL_PNACLABIVERIFYFUNCTIONS_H | 67 #endif // LLVM_ANALYSIS_NACL_PNACLABIVERIFYFUNCTIONS_H |
OLD | NEW |