[PATCH] D56182: [CallSite removal] Add `CallBase` support to the `InstVisitor` in such a way that it still supports `CallSite` but users can be ported to rely on `CallBase` instead.
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 6 21:19:37 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350502: [CallSite removal] Add `CallBase` support to the `InstVisitor` in such (authored by chandlerc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D56182?vs=179787&id=180434#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56182/new/
https://reviews.llvm.org/D56182
Files:
llvm/trunk/include/llvm/IR/InstVisitor.h
Index: llvm/trunk/include/llvm/IR/InstVisitor.h
===================================================================
--- llvm/trunk/include/llvm/IR/InstVisitor.h
+++ llvm/trunk/include/llvm/IR/InstVisitor.h
@@ -268,17 +268,23 @@
RetTy visitCmpInst(CmpInst &I) { DELEGATE(Instruction);}
RetTy visitUnaryInstruction(UnaryInstruction &I){ DELEGATE(Instruction);}
- // Provide a special visitor for a 'callsite' that visits both calls and
- // invokes. When unimplemented, properly delegates to either the terminator or
- // regular instruction visitor.
+ // The next level delegation for `CallBase` is slightly more complex in order
+ // to support visiting cases where the call is also a terminator.
+ RetTy visitCallBase(CallBase &I) {
+ if (isa<InvokeInst>(I))
+ return static_cast<SubClass *>(this)->visitTerminator(I);
+
+ DELEGATE(Instruction);
+ }
+
+ // Provide a legacy visitor for a 'callsite' that visits both calls and
+ // invokes.
+ //
+ // Prefer overriding the type system based `CallBase` instead.
RetTy visitCallSite(CallSite CS) {
assert(CS);
Instruction &I = *CS.getInstruction();
- if (CS.isCall())
- DELEGATE(Instruction);
-
- assert(CS.isInvoke());
- return static_cast<SubClass *>(this)->visitTerminator(I);
+ DELEGATE(CallBase);
}
// If the user wants a 'default' case, they can choose to override this
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56182.180434.patch
Type: text/x-patch
Size: 1409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190107/43fa72f3/attachment.bin>
More information about the llvm-commits
mailing list