bool isStaticAlloca() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const AllocaInst *) { return true; }
static inline bool classof(const Instruction *I) {
return (I->getOpcode() == Instruction::Alloca);
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const LoadInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Load;
}
static unsigned getPointerOperandIndex() { return 1U; }
unsigned getPointerAddressSpace() const {
- return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace();
+ if (getPointerOperand()->getType()->isPointerTy())
+ return cast<PointerType>(getPointerOperand()->getType())
+ ->getAddressSpace();
+ if (getPointerOperand()->getType()->isVectorTy()
+ && cast<VectorType>(getPointerOperand()->getType())->isPointerTy())
+ return cast<PointerType>(cast<VectorType>(
+ getPointerOperand()->getType())->getElementType())
+ ->getAddressSpace();
+ llvm_unreachable("Only a vector of pointers or pointers can be used!");
+ return 0;
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const StoreInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Store;
}
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const FenceInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Fence;
}
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const AtomicCmpXchgInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::AtomicCmpXchg;
}
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const AtomicRMWInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::AtomicRMW;
}
bool isInBounds() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const GetElementPtrInst *) { return true; }
static inline bool classof(const Instruction *I) {
return (I->getOpcode() == Instruction::GetElementPtr);
}
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ICmpInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::ICmp;
}
}
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const FCmpInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::FCmp;
}
void setIsNoInline() {
Attributes::Builder B;
B.addAttribute(Attributes::NoInline);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Return true if the call can return twice
void setCanReturnTwice() {
Attributes::Builder B;
B.addAttribute(Attributes::ReturnsTwice);
- addAttribute(~0U, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call does not access memory.
void setDoesNotAccessMemory() {
Attributes::Builder B;
B.addAttribute(Attributes::ReadNone);
- addAttribute(~0U, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call does not access or only reads memory.
void setOnlyReadsMemory() {
Attributes::Builder B;
B.addAttribute(Attributes::ReadOnly);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call cannot return.
void setDoesNotReturn() {
Attributes::Builder B;
B.addAttribute(Attributes::NoReturn);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call cannot unwind.
void setDoesNotThrow() {
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call returns a structure through first
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const CallInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Call;
}
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const SelectInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Select;
}
static unsigned getPointerOperandIndex() { return 0U; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const VAArgInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == VAArg;
}
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ExtractElementInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::ExtractElement;
}
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const InsertElementInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::InsertElement;
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ShuffleVectorInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::ShuffleVector;
}
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ExtractValueInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::ExtractValue;
}
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const InsertValueInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::InsertValue;
}
Value *hasConstantValue() const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const PHINode *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::PHI;
}
void reserveClauses(unsigned Size) { growOperands(Size); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const LandingPadInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::LandingPad;
}
unsigned getNumSuccessors() const { return 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ReturnInst *) { return true; }
static inline bool classof(const Instruction *I) {
return (I->getOpcode() == Instruction::Ret);
}
void swapSuccessors();
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const BranchInst *) { return true; }
static inline bool classof(const Instruction *I) {
return (I->getOpcode() == Instruction::Br);
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const SwitchInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Switch;
}
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const IndirectBrInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::IndirectBr;
}
void setIsNoInline() {
Attributes::Builder B;
B.addAttribute(Attributes::NoInline);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call does not access memory.
void setDoesNotAccessMemory() {
Attributes::Builder B;
B.addAttribute(Attributes::ReadNone);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call does not access or only reads memory.
void setOnlyReadsMemory() {
Attributes::Builder B;
B.addAttribute(Attributes::ReadOnly);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call cannot return.
void setDoesNotReturn() {
Attributes::Builder B;
B.addAttribute(Attributes::NoReturn);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call cannot unwind.
void setDoesNotThrow() {
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- addAttribute(~0, Attributes::get(B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
}
/// @brief Determine if the call returns a structure through first
unsigned getNumSuccessors() const { return 2; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const InvokeInst *) { return true; }
static inline bool classof(const Instruction *I) {
return (I->getOpcode() == Instruction::Invoke);
}
unsigned getNumSuccessors() const { return 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ResumeInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Resume;
}
unsigned getNumSuccessors() const { return 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const UnreachableInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Instruction::Unreachable;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const TruncInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == Trunc;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ZExtInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == ZExt;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const SExtInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == SExt;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const FPTruncInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == FPTrunc;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const FPExtInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == FPExt;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const UIToFPInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == UIToFP;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const SIToFPInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == SIToFP;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const FPToUIInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == FPToUI;
}
);
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const FPToSIInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == FPToSI;
}
/// @brief return the address space of the pointer.
unsigned getAddressSpace() const {
- return cast<PointerType>(getType())->getAddressSpace();
+ if (getType()->isPointerTy())
+ return cast<PointerType>(getType())->getAddressSpace();
+ if (getType()->isVectorTy() &&
+ cast<VectorType>(getType())->getElementType()->isPointerTy())
+ return cast<PointerType>(
+ cast<VectorType>(getType())->getElementType())
+ ->getAddressSpace();
+ llvm_unreachable("Must be a pointer or a vector of pointers.");
+ return 0;
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const IntToPtrInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == IntToPtr;
}
/// @brief return the address space of the pointer.
unsigned getPointerAddressSpace() const {
- return cast<PointerType>(getOperand(0)->getType())->getAddressSpace();
+ Type *Ty = getOperand(0)->getType();
+ if (Ty->isPointerTy())
+ return cast<PointerType>(Ty)->getAddressSpace();
+ if (Ty->isVectorTy()
+ && cast<VectorType>(Ty)->getElementType()->isPointerTy())
+ return cast<PointerType>(
+ cast<VectorType>(Ty)->getElementType())
+ ->getAddressSpace();
+ llvm_unreachable("Must be a pointer or a vector of pointers.");
+ return 0;
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const PtrToIntInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == PtrToInt;
}
);
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const BitCastInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == BitCast;
}