+ void visitModule (Module &M) {}
+ void visitFunction (Function &F) {}
+ void visitBasicBlock(BasicBlock &BB) {}
+
+
+ // Define instruction specific visitor functions that can be overridden to
+ // handle SPECIFIC instructions. These functions automatically define
+ // visitMul to proxy to visitBinaryOperator for instance in case the user does
+ // not need this generality.
+ //
+ // The one problem case we have to handle here though is that the PHINode
+ // class and opcode name are the exact same. Because of this, we cannot
+ // define visitPHINode (the inst version) to forward to visitPHINode (the
+ // generic version) without multiply defined symbols and recursion. To handle
+ // this, we do not autoexpand "Other" instructions, we do it manually.
+ //
+#define HANDLE_INST(NUM, OPCODE, CLASS) \
+ RetTy visit##OPCODE(CLASS &I) { DELEGATE(CLASS); }
+#define HANDLE_OTHER_INST(NUM, OPCODE, CLASS) // Ignore "other" instructions
+#include "llvm/Instruction.def"
+
+ // Implement all "other" instructions, except for PHINode
+ RetTy visitCast(CastInst &I) { DELEGATE(CastInst); }
+ RetTy visitCall(CallInst &I) { DELEGATE(CallInst); }
+ RetTy visitShr(ShiftInst &I) { DELEGATE(ShiftInst); }
+ RetTy visitShl(ShiftInst &I) { DELEGATE(ShiftInst); }
+ RetTy visitVarArg(VarArgInst &I) { DELEGATE(VarArgInst); }
+ RetTy visitUserOp1(Instruction &I) { DELEGATE(Instruction); }
+ RetTy visitUserOp2(Instruction &I) { DELEGATE(Instruction); }
+