Home | History | Annotate | Download | only in llvm

Lines Matching refs:Instruction

1 //===-- llvm/Instructions.h - Instruction subclass definitions --*- C++ -*-===//
11 // Instruction class. This is meant to be an easy way to get access to all
12 // instruction subclasses.
55 /// AllocaInst - an instruction to allocate memory on the stack
62 const Twine &Name = "", Instruction *InsertBefore = 0);
66 AllocaInst(Type *Ty, const Twine &Name, Instruction *InsertBefore = 0);
70 const Twine &Name = "", Instruction *InsertBefore = 0);
78 /// to the allocation instruction that is not 1.
91 return reinterpret_cast<PointerType*>(Instruction::getType());
95 /// instruction.
100 /// by the instruction.
114 static inline bool classof(const Instruction *I) {
115 return (I->getOpcode() == Instruction::Alloca);
118 return isa<Instruction>(V) && classof(cast<Instruction>(V));
121 // Shadow Instruction::setInstructionSubclassData with a private forwarding
124 Instruction::setInstructionSubclassData(D);
133 /// LoadInst - an instruction for reading from memory. This uses the
141 LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore);
144 Instruction *InsertBefore = 0);
148 unsigned Align, Instruction *InsertBefore = 0);
154 Instruction *InsertBefore = 0);
160 LoadInst(Value *Ptr, const char *NameStr, Instruction *InsertBefore);
163 bool isVolatile = false, Instruction *InsertBefore = 0);
234 static inline bool classof(const Instruction *I) {
235 return I->getOpcode() == Instruction::Load;
238 return isa<Instruction>(V) && classof(cast<Instruction>(V));
241 // Shadow Instruction::setInstructionSubclassData with a private forwarding
244 Instruction::setInstructionSubclassData(D);
253 /// StoreInst - an instruction for storing to memory
255 class StoreInst : public Instruction {
265 StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore);
268 Instruction *InsertBefore = 0);
271 unsigned Align, Instruction *InsertBefore = 0);
277 Instruction *InsertBefore = 0);
323 /// Specify whether this store instruction is ordered with respect to all
356 static inline bool classof(const Instruction *I) {
357 return I->getOpcode() == Instruction::Store;
360 return isa<Instruction>(V) && classof(cast<Instruction>(V));
363 // Shadow Instruction::setInstructionSubclassData with a private forwarding
366 Instruction::setInstructionSubclassData(D);
380 /// FenceInst - an instruction for ordering other memory operations
382 class FenceInst : public Instruction {
397 Instruction *InsertBefore = 0);
428 static inline bool classof(const Instruction *I) {
429 return I->getOpcode() == Instruction::Fence;
432 return isa<Instruction>(V) && classof(cast<Instruction>(V));
435 // Shadow Instruction::setInstructionSubclassData with a private forwarding
438 Instruction::setInstructionSubclassData(D);
446 /// AtomicCmpXchgInst - an instruction that atomically checks whether a
450 class AtomicCmpXchgInst : public Instruction {
463 Instruction *InsertBefore = 0);
528 static inline bool classof(const Instruction *I) {
529 return I->getOpcode() == Instruction::AtomicCmpXchg;
532 return isa<Instruction>(V) && classof(cast<Instruction>(V));
535 // Shadow Instruction::setInstructionSubclassData with a private forwarding
538 Instruction::setInstructionSubclassData(D);
553 /// AtomicRMWInst - an instruction that atomically reads a memory location,
557 class AtomicRMWInst : public Instruction {
563 /// the descriptions, 'p' is the pointer to the instruction's memory location,
565 /// instruction. These instructions always return 'old'.
601 Instruction *InsertBefore = 0);
672 static inline bool classof(const Instruction *I) {
673 return I->getOpcode() == Instruction::AtomicRMW;
676 return isa<Instruction>(V) && classof(cast<Instruction>(V));
681 // Shadow Instruction::setInstructionSubclassData with a private forwarding
684 Instruction::setInstructionSubclassData(D);
700 // message on bad indexes for a gep instruction.
707 /// GetElementPtrInst - an instruction for type-safe pointer arithmetic to
710 class GetElementPtrInst : public Instruction {
714 /// Constructors - Create a getelementptr instruction with a base pointer an
716 /// instruction, the second appends the new instruction to the specified
720 Instruction *InsertBefore);
729 Instruction *InsertBefore = 0) {
747 Instruction *InsertBefore = 0) {
766 return reinterpret_cast<PointerType*>(Instruction::getType());
770 /// a load instruction with the specified parameters.
823 /// setIsInBounds - Set or clear the inbounds flag on this GEP instruction.
832 static inline bool classof(const Instruction *I) {
833 return (I->getOpcode() == Instruction::GetElementPtr);
836 return isa<Instruction>(V) && classof(cast<Instruction>(V));
849 Instruction *InsertBefore)
850 : Instruction(PointerType::get(checkGEPType(
864 : Instruction(PointerType::get(checkGEPType(
882 /// This instruction compares its operands according to the predicate given
891 /// @brief Constructor with insert-before-instruction semantics.
893 Instruction *InsertBefore, ///< Where to insert
897 const Twine &NameStr = "" ///< Name of the instruction
899 Instruction::ICmp, pred, LHS, RHS, NameStr,
905 "Both operands to ICmp instruction are not of the same type!");
909 "Invalid operand types for ICmp instruction");
918 const Twine &NameStr = "" ///< Name of the instruction
920 Instruction::ICmp, pred, LHS, RHS, NameStr,
926 "Both operands to ICmp instruction are not of the same type!");
930 "Invalid operand types for ICmp instruction");
938 const Twine &NameStr = "" ///< Name of the instruction
940 Instruction::ICmp, pred, LHS, RHS, NameStr) {
945 "Both operands to ICmp instruction are not of the same type!");
949 "Invalid operand types for ICmp instruction");
960 /// This is a static version that you can use without an instruction.
972 /// This is a static version that you can use without an instruction.
1008 /// Exchange the two operands to this instruction in such a way that it does
1009 /// not modify the semantics of the instruction. The predicate value may be
1020 static inline bool classof(const Instruction *I) {
1021 return I->getOpcode() == Instruction::ICmp;
1024 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1033 /// This instruction compares its operands according to the predicate given
1042 /// @brief Constructor with insert-before-instruction semantics.
1044 Instruction *InsertBefore, ///< Where to insert
1048 const Twine &NameStr = "" ///< Name of the instruction
1050 Instruction::FCmp, pred, LHS, RHS, NameStr,
1055 "Both operands to FCmp instruction are not of the same type!");
1058 "Invalid operand types for FCmp instruction");
1067 const Twine &NameStr = "" ///< Name of the instruction
1069 Instruction::FCmp, pred, LHS, RHS, NameStr,
1074 "Both operands to FCmp instruction are not of the same type!");
1077 "Invalid operand types for FCmp instruction");
1085 const Twine &NameStr = "" ///< Name of the instruction
1087 Instruction::FCmp, pred, LHS, RHS, NameStr) {
1091 "Both operands to FCmp instruction are not of the same type!");
1094 "Invalid operand types for FCmp instruction");
1097 /// @returns true if the predicate of this instruction is EQ or NE.
1104 /// @returns true if the predicate of this instruction is commutative.
1118 /// Exchange the two operands to this instruction in such a way that it does
1119 /// not modify the semantics of the instruction. The predicate value may be
1130 static inline bool classof(const Instruction *I) {
1131 return I->getOpcode() == Instruction::FCmp;
1134 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1144 class CallInst : public Instruction {
1153 const Twine &NameStr, Instruction *InsertBefore);
1161 Instruction *InsertBefore);
1165 Instruction *InsertBefore);
1173 Instruction *InsertBefore = 0) {
1184 Instruction *InsertBefore = 0) {
1197 static Instruction *CreateMalloc(Instruction *InsertBefore,
1202 static Instruction *CreateMalloc(BasicBlock *InsertAtEnd,
1208 static Instruction* CreateFree(Value* Source, Instruction *InsertBefore);
1209 static Instruction* CreateFree(Value* Source, BasicBlock *InsertAtEnd);
1331 /// instruction.
1347 static inline bool classof(const Instruction *I) {
1348 return I->getOpcode() == Instruction::Call;
1351 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1354 // Shadow Instruction::setInstructionSubclassData with a private forwarding
1357 Instruction::setInstructionSubclassData(D);
1367 : Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
1369 Instruction::Call,
1376 const Twine &NameStr, Instruction *InsertBefore)
1377 : Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
1379 Instruction::Call,
1395 /// SelectInst - This class represents the LLVM 'select' instruction.
1397 class SelectInst : public Instruction {
1406 Instruction *InsertBefore)
1407 : Instruction(S1->getType(), Instruction::Select,
1414 : Instruction(S1->getType(), Instruction::Select,
1424 Instruction *InsertBefore = 0) {
1448 return static_cast<OtherOps>(Instruction::getOpcode());
1453 static inline bool classof(const Instruction *I) {
1454 return I->getOpcode() == Instruction::Select;
1457 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1471 /// VAArgInst - This class represents the va_arg llvm instruction, which returns
1480 Instruction *InsertBefore = 0)
1496 static inline bool classof(const Instruction *I) {
1500 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1508 /// ExtractElementInst - This instruction extracts a single (scalar)
1511 class ExtractElementInst : public Instruction {
1513 Instruction *InsertBefore = 0);
1522 Instruction *InsertBefore = 0) {
1531 /// isValidOperands - Return true if an extractelement instruction can be
1550 static inline bool classof(const Instruction *I) {
1551 return I->getOpcode() == Instruction::ExtractElement;
1554 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1569 /// InsertElementInst - This instruction inserts a single (scalar)
1572 class InsertElementInst : public Instruction {
1575 Instruction *InsertBefore = 0);
1584 Instruction *InsertBefore = 0) {
1593 /// isValidOperands - Return true if an insertelement instruction can be
1601 return reinterpret_cast<VectorType*>(Instruction::getType());
1609 static inline bool classof(const Instruction *I) {
1610 return I->getOpcode() == Instruction::InsertElement;
1613 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1628 /// ShuffleVectorInst - This instruction constructs a fixed permutation of two
1631 class ShuffleVectorInst : public Instruction {
1642 Instruction *InsertBefor = 0);
1646 /// isValidOperands - Return true if a shufflevector instruction can be
1654 return reinterpret_cast<VectorType*>(Instruction::getType());
1667 static inline bool classof(const Instruction *I) {
1668 return I->getOpcode() == Instruction::ShuffleVector;
1671 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1686 /// ExtractValueInst - This instruction extracts a struct member or array
1695 /// Constructors - Create a extractvalue instruction with a base aggregate
1697 /// an existing instruction, the second appends the new instruction to the
1702 Instruction *InsertBefore);
1718 Instruction *InsertBefore = 0) {
1730 /// with an extractvalue instruction with the specified parameters.
1763 static inline bool classof(const Instruction *I) {
1764 return I->getOpcode() == Instruction::ExtractValue;
1767 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1774 Instruction *InsertBefore)
1793 /// InsertValueInst - This instruction inserts a struct field of array element
1796 class InsertValueInst : public Instruction {
1804 /// Constructors - Create a insertvalue instruction with a base aggregate
1806 /// optionally insert before an existing instruction, the second appends
1807 /// the new instruction to the specified BasicBlock.
1811 Instruction *InsertBefore);
1820 Instruction *InsertBefore = 0);
1834 Instruction *InsertBefore = 0) {
1885 static inline bool classof(const Instruction *I) {
1886 return I->getOpcode() == Instruction::InsertValue;
1889 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1902 Instruction *InsertBefore)
1903 : Instruction(Agg->getType(), InsertValue,
1913 : Instruction(Agg->getType(), InsertValue,
1929 class PHINode : public Instruction {
1940 const Twine &NameStr = "", Instruction *InsertBefore = 0)
1941 : Instruction(Ty, Instruction::PHI, 0, 0, InsertBefore),
1949 : Instruction(Ty, Instruction::PHI, 0, 0, InsertAtEnd),
1966 Instruction *InsertBefore = 0) {
2102 static inline bool classof(const Instruction *I) {
2103 return I->getOpcode() == Instruction::PHI;
2106 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2123 /// LandingPadInst - The landingpad instruction holds all of the information
2124 /// necessary to generate correct exception handling. The landingpad instruction
2130 class LandingPadInst : public Instruction {
2148 Instruction *InsertBefore);
2160 Instruction *InsertBefore = 0);
2173 /// isCleanup - Return 'true' if this landingpad instruction is a
2178 /// setCleanup - Indicate that this landingpad instruction is a cleanup.
2210 static inline bool classof(const Instruction *I) {
2211 return I->getOpcode() == Instruction::LandingPad;
2214 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2237 // ReturnInst() - 'ret void' instruction
2238 // ReturnInst( null) - 'ret void' instruction
2239 // ReturnInst(Value* X) - 'ret X' instruction
2240 // ReturnInst( null, Inst *I) - 'ret void' instruction, insert before I
2241 // ReturnInst(Value* X, Inst *I) - 'ret X' instruction, insert before I
2242 // ReturnInst( null, BB *B) - 'ret void' instruction, insert @ end of B
2243 // ReturnInst(Value* X, BB *B) - 'ret X' instruction, insert @ end of B
2248 Instruction *InsertBefore = 0);
2255 Instruction *InsertBefore = 0) {
2279 static inline bool classof(const Instruction *I) {
2280 return (I->getOpcode() == Instruction::Ret);
2283 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2302 /// BranchInst - Conditional or Unconditional Branch instruction.
2318 explicit BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = 0);
2320 Instruction *InsertBefore = 0);
2327 static BranchInst *Create(BasicBlock *IfTrue, Instruction *InsertBefore = 0) {
2331 Value *Cond, Instruction *InsertBefore = 0) {
2370 /// \brief Swap the successors of this branch instruction.
2372 /// Swaps the successors of the branch instruction. This also swaps any
2373 /// branch weight metadata associated with the instruction so that it
2379 static inline bool classof(const Instruction *I) {
2380 return (I->getOpcode() == Instruction::Br);
2383 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2418 /// SwitchInst ctor - Create a new switch instruction, specifying a value to
2421 /// constructor can also autoinsert before another instruction.
2423 Instruction *InsertBefore);
2425 /// SwitchInst ctor - Create a new switch instruction, specifying a value to
2435 unsigned NumCases, Instruction *InsertBefore = 0) {
2455 /// getNumCases - return the number of 'cases' in this switch instruction.
2500 /// addCase - Add an entry to the switch instruction...
2505 /// instruction
2537 static inline bool classof(const Instruction *I) {
2538 return I->getOpcode() == Instruction::Switch;
2541 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2561 /// IndirectBrInst - Indirect Branch Instruction.
2577 /// IndirectBrInst ctor - Create a new indirectbr instruction, specifying an
2580 /// autoinsert before another instruction.
2581 IndirectBrInst(Value *Address, unsigned NumDests, Instruction *InsertBefore);
2583 /// IndirectBrInst ctor - Create a new indirectbr instruction, specifying an
2592 Instruction *InsertBefore = 0) {
2604 // Accessor Methods for IndirectBrInst instruction.
2611 /// indirectbr instruction.
2623 /// indirectbr instruction.
2636 static inline bool classof(const Instruction *I) {
2637 return I->getOpcode() == Instruction::IndirectBr;
2640 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2659 /// InvokeInst - Invoke instruction. The SubclassData field is used to hold the
2673 const Twine &NameStr, Instruction *InsertBefore);
2687 Instruction *InsertBefore = 0) {
2803 /// instruction
2826 /// getLandingPadInst - Get the landingpad instruction from the landing pad
2844 static inline bool classof(const Instruction *I) {
2845 return (I->getOpcode() == Instruction::Invoke);
2848 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2856 // Shadow Instruction::setInstructionSubclassData with a private forwarding
2859 Instruction::setInstructionSubclassData(D);
2870 const Twine &NameStr, Instruction *InsertBefore)
2873 Instruction::Invoke,
2884 Instruction::Invoke,
2898 /// until an invoke instruction is found.
2909 explicit UnwindInst(LLVMContext &C, Instruction *InsertBefore = 0);
2916 static inline bool classof(const Instruction *I) {
2917 Instruction::Unwind;
2920 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2938 explicit ResumeInst(Value *Exn, Instruction *InsertBefore=0);
2943 static ResumeInst *Create(Value *Exn, Instruction *InsertBefore = 0) {
2960 static inline bool classof(const Instruction *I) {
2961 return I->getOpcode() == Instruction::Resume;
2964 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2985 /// presence of this instruction indicates some higher level knowledge that the
2998 explicit UnreachableInst(LLVMContext &C, Instruction *InsertBefore = 0);
3005 static inline bool classof(const Instruction *I) {
3006 return I->getOpcode() == Instruction::Unreachable;
3009 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3028 /// @brief Constructor with insert-before-instruction semantics
3032 const Twine &NameStr = "", ///< A name for the new instruction
3033 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3040 const Twine &NameStr, ///< A name for the new instruction
3041 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3046 static inline bool classof(const Instruction *I) {
3050 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3065 /// @brief Constructor with insert-before-instruction semantics
3069 const Twine &NameStr = "", ///< A name for the new instruction
3070 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3077 const Twine &NameStr, ///< A name for the new instruction
3078 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3083 static inline bool classof(const Instruction *I) {
3087 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3102 /// @brief Constructor with insert-before-instruction semantics
3106 const Twine &NameStr = "", ///< A name for the new instruction
3107 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3114 const Twine &NameStr, ///< A name for the new instruction
3115 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3120 static inline bool classof(const Instruction *I) {
3124 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3139 /// @brief Constructor with insert-before-instruction semantics
3143 const Twine &NameStr = "", ///< A name for the new instruction
3144 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3147 /// @brief Constructor with insert-before-instruction semantics
3151 const Twine &NameStr, ///< A name for the new instruction
3152 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3157 static inline bool classof(const Instruction *I) {
3161 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3176 /// @brief Constructor with insert-before-instruction semantics
3180 const Twine &NameStr = "", ///< A name for the new instruction
3181 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3188 const Twine &NameStr, ///< A name for the new instruction
3189 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3194 static inline bool classof(const Instruction *I) {
3198 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3213 /// @brief Constructor with insert-before-instruction semantics
3217 const Twine &NameStr = "", ///< A name for the new instruction
3218 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3225 const Twine &NameStr, ///< A name for the new instruction
3226 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3231 static inline bool classof(const Instruction *I) {
3235 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3250 /// @brief Constructor with insert-before-instruction semantics
3254 const Twine &NameStr = "", ///< A name for the new instruction
3255 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3262 const Twine &NameStr, ///< A name for the new instruction
3263 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3268 static inline bool classof(const Instruction *I) {
3272 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3287 /// @brief Constructor with insert-before-instruction semantics
3291 const Twine &NameStr = "", ///< A name for the new instruction
3292 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3299 const Twine &NameStr, ///< A name for the new instruction
3300 BasicBlock *InsertAtEnd ///< Where to insert the new instruction
3305 static inline bool classof(const Instruction *I) {
3309 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3324 /// @brief Constructor with insert-before-instruction semantics
3328 const Twine &NameStr = "", ///< A name for the new instruction
3329 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3336 const Twine &NameStr, ///< A name for the new instruction
3337 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3342 static inline bool classof(const Instruction *I) {
3346 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3357 /// @brief Constructor with insert-before-instruction semantics
3361 const Twine &NameStr = "", ///< A name for the new instruction
3362 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3369 const Twine &NameStr, ///< A name for the new instruction
3370 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3378 static inline bool classof(const Instruction *I) {
3382 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3397 /// @brief Constructor with insert-before-instruction semantics
3401 const Twine &NameStr = "", ///< A name for the new instruction
3402 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3409 const Twine &NameStr, ///< A name for the new instruction
3410 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3415 static inline bool classof(const Instruction *I) {
3419 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3434 /// @brief Constructor with insert-before-instruction semantics
3438 const Twine &NameStr = "", ///< A name for the new instruction
3439 Instruction *InsertBefore = 0 ///< Where to insert the new instruction
3446 const Twine &NameStr, ///< A name for the new instruction
3447 BasicBlock *InsertAtEnd ///< The block to insert the instruction into
3452 static inline bool classof(const Instruction *I) {
3456 return isa<Instruction>(V) && classof(cast<Instruction>(V));