OLD | NEW |
1 //===- RewriteLLVMIntrinsics.cpp - Rewrite LLVM intrinsics to other values ===// | 1 //===- RewriteLLVMIntrinsics.cpp - Rewrite LLVM intrinsics to other values ===// |
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 // This pass replaces calls to LLVM intrinsics that are *not* part of the | 10 // This pass replaces calls to LLVM intrinsics that are *not* part of the |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 IntrinsicRewriter(Module &M, Intrinsic::ID IntrinsicID) | 47 IntrinsicRewriter(Module &M, Intrinsic::ID IntrinsicID) |
48 : F(Intrinsic::getDeclaration(&M, IntrinsicID)) {} | 48 : F(Intrinsic::getDeclaration(&M, IntrinsicID)) {} |
49 virtual ~IntrinsicRewriter() {} | 49 virtual ~IntrinsicRewriter() {} |
50 /// This pure virtual method must be defined by implementors, and | 50 /// This pure virtual method must be defined by implementors, and |
51 /// will be called by rewriteCall. | 51 /// will be called by rewriteCall. |
52 virtual void doRewriteCall(CallInst *Call) = 0; | 52 virtual void doRewriteCall(CallInst *Call) = 0; |
53 | 53 |
54 Function *F; | 54 Function *F; |
55 | 55 |
56 private: | 56 private: |
57 IntrinsicRewriter() LLVM_DELETED_FUNCTION; | 57 IntrinsicRewriter() = delete; |
58 IntrinsicRewriter(const IntrinsicRewriter &) LLVM_DELETED_FUNCTION; | 58 IntrinsicRewriter(const IntrinsicRewriter &) = delete; |
59 IntrinsicRewriter &operator=( | 59 IntrinsicRewriter &operator=(const IntrinsicRewriter &) = delete; |
60 const IntrinsicRewriter &) LLVM_DELETED_FUNCTION; | |
61 }; | 60 }; |
62 | 61 |
63 private: | 62 private: |
64 /// Visit all uses of a Function, rewrite it using the \p Rewriter, | 63 /// Visit all uses of a Function, rewrite it using the \p Rewriter, |
65 /// and then delete the Call. Later delete the Function from the | 64 /// and then delete the Call. Later delete the Function from the |
66 /// Module. Returns true if the Module was changed. | 65 /// Module. Returns true if the Module was changed. |
67 bool visitUses(IntrinsicRewriter &Rewriter); | 66 bool visitUses(IntrinsicRewriter &Rewriter); |
68 }; | 67 }; |
69 | 68 |
70 /// Rewrite a Call to nothing. | 69 /// Rewrite a Call to nothing. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 Call->eraseFromParent(); | 140 Call->eraseFromParent(); |
142 } | 141 } |
143 | 142 |
144 F->eraseFromParent(); | 143 F->eraseFromParent(); |
145 return !Calls.empty(); | 144 return !Calls.empty(); |
146 } | 145 } |
147 | 146 |
148 ModulePass *llvm::createRewriteLLVMIntrinsicsPass() { | 147 ModulePass *llvm::createRewriteLLVMIntrinsicsPass() { |
149 return new RewriteLLVMIntrinsics(); | 148 return new RewriteLLVMIntrinsics(); |
150 } | 149 } |
OLD | NEW |