11 #ifndef LLVM_INSTVISITOR_H
12 #define LLVM_INSTVISITOR_H
27 #define HANDLE_INST(NUM, OPCODE, CLASS) class CLASS;
28 #include "llvm/IR/Instruction.def"
30 #define DELEGATE(CLASS_TO_VISIT) \
31 return static_cast<SubClass*>(this)-> \
32 visit##CLASS_TO_VISIT(static_cast<CLASS_TO_VISIT&>(I))
80 template<
typename SubClass,
typename RetTy=
void>
89 template<
class Iterator>
90 void visit(Iterator Start, Iterator End) {
92 static_cast<SubClass*
>(
this)->
visit(*Start++);
122 #define HANDLE_INST(NUM, OPCODE, CLASS) \
123 case Instruction::OPCODE: return \
124 static_cast<SubClass*>(this)-> \
125 visit##OPCODE(static_cast<CLASS&>(I));
126 #include "llvm/IR/Instruction.def"
154 #define HANDLE_INST(NUM, OPCODE, CLASS) \
155 RetTy visit##OPCODE(CLASS &I) { \
156 if (NUM == Instruction::Call) \
157 return delegateCallInst(I); \
161 #include "llvm/IR/Instruction.def"
280 RetTy delegateCallInst(Instruction &I) {
RetTy visitSelectInst(SelectInst &I)
RetTy visitAtomicRMWInst(AtomicRMWInst &I)
RetTy visitVAStartInst(VAStartInst &I)
RetTy visitMemSetInst(MemSetInst &I)
Abstract base class of comparison instructions.
RetTy visitCallSite(CallSite CS)
Base class for instruction visitors.
RetTy visitDbgDeclareInst(DbgDeclareInst &I)
RetTy visitDbgInfoIntrinsic(DbgInfoIntrinsic &I)
RetTy visitFPExtInst(FPExtInst &I)
The main container class for the LLVM Intermediate Representation.
RetTy visitCmpInst(CmpInst &I)
RetTy visitFCmpInst(FCmpInst &I)
This class represents zero extension of integer types.
RetTy visitCastInst(CastInst &I)
RetTy visitBranchInst(BranchInst &I)
RetTy visitLandingPadInst(LandingPadInst &I)
void visit(BasicBlock *BB)
This class represents a sign extension of integer types.
RetTy visitPHINode(PHINode &I)
RetTy visitICmpInst(ICmpInst &I)
RetTy visitExtractElementInst(ExtractElementInst &I)
RetTy visitVACopyInst(VACopyInst &I)
RetTy visitSExtInst(SExtInst &I)
void visitFunction(Function &F)
This class represents a conversion between pointers from one address space to another.
RetTy visitMemCpyInst(MemCpyInst &I)
RetTy visitIntrinsicInst(IntrinsicInst &I)
Base class of casting instructions.
RetTy visitUIToFPInst(UIToFPInst &I)
RetTy visitMemMoveInst(MemMoveInst &I)
#define llvm_unreachable(msg)
RetTy visitFPToUIInst(FPToUIInst &I)
RetTy visitInsertValueInst(InsertValueInst &I)
This class represents a cast from a pointer to an integer.
void visit(Iterator Start, Iterator End)
Represents a floating point comparison operator.
This class represents a no-op cast from one type to another.
This class represents a cast from floating point to signed integer.
RetTy visitMemTransferInst(MemTransferInst &I)
RetTy visitExtractValueInst(ExtractValueInst &I)
This class represents a truncation of integer types.
RetTy visitVAEndInst(VAEndInst &I)
void visitBasicBlock(BasicBlock &BB)
RetTy visitVAArgInst(VAArgInst &I)
LLVM Basic Block Representation.
InstrTy * getInstruction() const
RetTy visitIntToPtrInst(IntToPtrInst &I)
RetTy visitResumeInst(ResumeInst &I)
RetTy visitTerminatorInst(TerminatorInst &I)
Represent an integer comparison operator.
RetTy visitSwitchInst(SwitchInst &I)
RetTy visitFPTruncInst(FPTruncInst &I)
RetTy visitLoadInst(LoadInst &I)
This class represents a cast from an integer to a pointer.
RetTy visitDbgValueInst(DbgValueInst &I)
RetTy visitZExtInst(ZExtInst &I)
RetTy visitReturnInst(ReturnInst &I)
RetTy visitSIToFPInst(SIToFPInst &I)
RetTy visitInvokeInst(InvokeInst &I)
RetTy visitBinaryOperator(BinaryOperator &I)
RetTy visitShuffleVectorInst(ShuffleVectorInst &I)
RetTy visitIndirectBrInst(IndirectBrInst &I)
RetTy visitAtomicCmpXchgInst(AtomicCmpXchgInst &I)
RetTy visitFPToSIInst(FPToSIInst &I)
This class represents a cast from floating point to unsigned integer.
Function * getCalledFunction() const
RetTy visitFenceInst(FenceInst &I)
RetTy visitStoreInst(StoreInst &I)
RetTy visitCallInst(CallInst &I)
void visitModule(Module &M)
RetTy visitPtrToIntInst(PtrToIntInst &I)
This class represents a cast unsigned integer to floating point.
RetTy visitGetElementPtrInst(GetElementPtrInst &I)
RetTy visitBitCastInst(BitCastInst &I)
RetTy visitAddrSpaceCastInst(AddrSpaceCastInst &I)
RetTy visitAllocaInst(AllocaInst &I)
RetTy visitMemIntrinsic(MemIntrinsic &I)
void visit(BasicBlock &BB)
This class represents a cast from signed integer to floating point.
RetTy visit(Instruction &I)
RetTy visitUnreachableInst(UnreachableInst &I)
This class represents a truncation of floating point types.
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
#define DELEGATE(CLASS_TO_VISIT)
RetTy visitInsertElementInst(InsertElementInst &I)
RetTy visit(Instruction *I)
void visitInstruction(Instruction &I)
This class represents an extension of floating point types.
RetTy visitUnaryInstruction(UnaryInstruction &I)
RetTy visitTruncInst(TruncInst &I)