forked from OSchip/llvm-project
parent
00426b4876
commit
b809748595
|
@ -43,7 +43,7 @@ protected:
|
|||
public:
|
||||
explicit AllocaInst(const Type *Ty, Value *ArraySize = 0,
|
||||
const Twine &Name = "", Instruction *InsertBefore = 0);
|
||||
AllocaInst(const Type *Ty, Value *ArraySize,
|
||||
AllocaInst(const Type *Ty, Value *ArraySize,
|
||||
const Twine &Name, BasicBlock *InsertAtEnd);
|
||||
|
||||
AllocaInst(const Type *Ty, const Twine &Name, Instruction *InsertBefore = 0);
|
||||
|
@ -166,8 +166,8 @@ public:
|
|||
unsigned getPointerAddressSpace() const {
|
||||
return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 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) {
|
||||
|
@ -237,7 +237,7 @@ public:
|
|||
|
||||
Value *getValueOperand() { return getOperand(0); }
|
||||
const Value *getValueOperand() const { return getOperand(0); }
|
||||
|
||||
|
||||
Value *getPointerOperand() { return getOperand(1); }
|
||||
const Value *getPointerOperand() const { return getOperand(1); }
|
||||
static unsigned getPointerOperandIndex() { return 1U; }
|
||||
|
@ -245,7 +245,7 @@ public:
|
|||
unsigned getPointerAddressSpace() const {
|
||||
return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace();
|
||||
}
|
||||
|
||||
|
||||
// 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) {
|
||||
|
@ -472,7 +472,7 @@ public:
|
|||
static unsigned getPointerOperandIndex() {
|
||||
return 0U; // get index for modifying correct operand
|
||||
}
|
||||
|
||||
|
||||
unsigned getPointerAddressSpace() const {
|
||||
return cast<PointerType>(getType())->getAddressSpace();
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GetElementPtrInst, Value)
|
|||
class ICmpInst: public CmpInst {
|
||||
protected:
|
||||
/// @brief Clone an indentical ICmpInst
|
||||
virtual ICmpInst *clone_impl() const;
|
||||
virtual ICmpInst *clone_impl() const;
|
||||
public:
|
||||
/// @brief Constructor with insert-before-instruction semantics.
|
||||
ICmpInst(
|
||||
|
@ -746,7 +746,7 @@ public:
|
|||
assert(getOperand(0)->getType()->isFPOrFPVectorTy() &&
|
||||
"Invalid operand types for FCmp instruction");
|
||||
}
|
||||
|
||||
|
||||
/// @brief Constructor with insert-at-end semantics.
|
||||
FCmpInst(
|
||||
BasicBlock &InsertAtEnd, ///< Block to insert into.
|
||||
|
@ -984,7 +984,7 @@ public:
|
|||
unsigned getParamAlignment(unsigned i) const {
|
||||
return AttributeList.getParamAlignment(i);
|
||||
}
|
||||
|
||||
|
||||
/// @brief Return true if the call should not be inlined.
|
||||
bool isNoInline() const { return paramHasAttr(~0, Attribute::NoInline); }
|
||||
void setIsNoInline(bool Value = true) {
|
||||
|
@ -1052,7 +1052,7 @@ public:
|
|||
void setCalledFunction(Value* Fn) {
|
||||
Op<-1>() = Fn;
|
||||
}
|
||||
|
||||
|
||||
/// isInlineAsm - Check if this call is an inline asm statement.
|
||||
bool isInlineAsm() const {
|
||||
return isa<InlineAsm>(Op<-1>());
|
||||
|
@ -1156,7 +1156,7 @@ public:
|
|||
Value *getCondition() { return Op<0>(); }
|
||||
Value *getTrueValue() { return Op<1>(); }
|
||||
Value *getFalseValue() { return Op<2>(); }
|
||||
|
||||
|
||||
/// areInvalidOperands - Return a string if the specified operands are invalid
|
||||
/// for a select operation, otherwise return null.
|
||||
static const char *areInvalidOperands(Value *Cond, Value *True, Value *False);
|
||||
|
@ -1256,12 +1256,12 @@ public:
|
|||
Value *getIndexOperand() { return Op<1>(); }
|
||||
const Value *getVectorOperand() const { return Op<0>(); }
|
||||
const Value *getIndexOperand() const { return Op<1>(); }
|
||||
|
||||
|
||||
const VectorType *getVectorOperandType() const {
|
||||
return reinterpret_cast<const VectorType*>(getVectorOperand()->getType());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
|
@ -1839,7 +1839,7 @@ public:
|
|||
BasicBlock *getIncomingBlock(unsigned i) const {
|
||||
return cast<BasicBlock>(getOperand(i*2+1));
|
||||
}
|
||||
|
||||
|
||||
/// getIncomingBlock - Return incoming basic block corresponding
|
||||
/// to an operand of the PHI.
|
||||
///
|
||||
|
@ -1847,7 +1847,7 @@ public:
|
|||
assert(this == U.getUser() && "Iterator doesn't point to PHI's Uses?");
|
||||
return cast<BasicBlock>((&U + 1)->get());
|
||||
}
|
||||
|
||||
|
||||
/// getIncomingBlock - Return incoming basic block corresponding
|
||||
/// to value use iterator.
|
||||
///
|
||||
|
@ -1855,8 +1855,8 @@ public:
|
|||
BasicBlock *getIncomingBlock(value_use_iterator<U> I) const {
|
||||
return getIncomingBlock(I.getUse());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setIncomingBlock(unsigned i, BasicBlock *BB) {
|
||||
setOperand(i*2+1, (Value*)BB);
|
||||
}
|
||||
|
@ -2300,7 +2300,7 @@ class IndirectBrInst : public TerminatorInst {
|
|||
/// here to make memory allocation more efficient. This constructor can also
|
||||
/// autoinsert before another instruction.
|
||||
IndirectBrInst(Value *Address, unsigned NumDests, Instruction *InsertBefore);
|
||||
|
||||
|
||||
/// IndirectBrInst ctor - Create a new indirectbr instruction, specifying an
|
||||
/// Address to jump to. The number of expected destinations can be specified
|
||||
/// here to make memory allocation more efficient. This constructor also
|
||||
|
@ -2318,32 +2318,32 @@ public:
|
|||
return new IndirectBrInst(Address, NumDests, InsertAtEnd);
|
||||
}
|
||||
~IndirectBrInst();
|
||||
|
||||
|
||||
/// Provide fast operand accessors.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
|
||||
// Accessor Methods for IndirectBrInst instruction.
|
||||
Value *getAddress() { return getOperand(0); }
|
||||
const Value *getAddress() const { return getOperand(0); }
|
||||
void setAddress(Value *V) { setOperand(0, V); }
|
||||
|
||||
|
||||
|
||||
|
||||
/// getNumDestinations - return the number of possible destinations in this
|
||||
/// indirectbr instruction.
|
||||
unsigned getNumDestinations() const { return getNumOperands()-1; }
|
||||
|
||||
|
||||
/// getDestination - Return the specified destination.
|
||||
BasicBlock *getDestination(unsigned i) { return getSuccessor(i); }
|
||||
const BasicBlock *getDestination(unsigned i) const { return getSuccessor(i); }
|
||||
|
||||
|
||||
/// addDestination - Add a destination.
|
||||
///
|
||||
void addDestination(BasicBlock *Dest);
|
||||
|
||||
|
||||
/// removeDestination - This method removes the specified successor from the
|
||||
/// indirectbr instruction.
|
||||
void removeDestination(unsigned i);
|
||||
|
||||
|
||||
unsigned getNumSuccessors() const { return getNumOperands()-1; }
|
||||
BasicBlock *getSuccessor(unsigned i) const {
|
||||
return cast<BasicBlock>(getOperand(i+1));
|
||||
|
@ -2351,7 +2351,7 @@ public:
|
|||
void setSuccessor(unsigned i, BasicBlock *NewSucc) {
|
||||
setOperand(i+1, (Value*)NewSucc);
|
||||
}
|
||||
|
||||
|
||||
// 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) {
|
||||
|
@ -2371,8 +2371,8 @@ struct OperandTraits<IndirectBrInst> : public HungoffOperandTraits<1> {
|
|||
};
|
||||
|
||||
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(IndirectBrInst, Value)
|
||||
|
||||
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// InvokeInst Class
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -46,50 +46,50 @@ protected:
|
|||
BasicBlock::iterator InsertPt;
|
||||
LLVMContext &Context;
|
||||
public:
|
||||
|
||||
|
||||
IRBuilderBase(LLVMContext &context)
|
||||
: Context(context) {
|
||||
ClearInsertionPoint();
|
||||
}
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Builder configuration methods
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
|
||||
/// ClearInsertionPoint - Clear the insertion point: created instructions will
|
||||
/// not be inserted into a block.
|
||||
void ClearInsertionPoint() {
|
||||
BB = 0;
|
||||
}
|
||||
|
||||
|
||||
BasicBlock *GetInsertBlock() const { return BB; }
|
||||
BasicBlock::iterator GetInsertPoint() const { return InsertPt; }
|
||||
LLVMContext &getContext() const { return Context; }
|
||||
|
||||
|
||||
/// SetInsertPoint - This specifies that created instructions should be
|
||||
/// appended to the end of the specified block.
|
||||
void SetInsertPoint(BasicBlock *TheBB) {
|
||||
BB = TheBB;
|
||||
InsertPt = BB->end();
|
||||
}
|
||||
|
||||
|
||||
/// SetInsertPoint - This specifies that created instructions should be
|
||||
/// inserted at the specified point.
|
||||
void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP) {
|
||||
BB = TheBB;
|
||||
InsertPt = IP;
|
||||
}
|
||||
|
||||
|
||||
/// SetCurrentDebugLocation - Set location information used by debugging
|
||||
/// information.
|
||||
void SetCurrentDebugLocation(const DebugLoc &L) {
|
||||
CurDbgLocation = L;
|
||||
}
|
||||
|
||||
|
||||
/// getCurrentDebugLocation - Get location information used by debugging
|
||||
/// information.
|
||||
const DebugLoc &getCurrentDebugLocation() const { return CurDbgLocation; }
|
||||
|
||||
|
||||
/// SetInstDebugLocation - If this builder has a current debug location, set
|
||||
/// it on the specified instruction.
|
||||
void SetInstDebugLocation(Instruction *I) const {
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
//===--------------------------------------------------------------------===//
|
||||
// Miscellaneous creation methods.
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
|
||||
/// CreateGlobalString - Make a new global variable with an initializer that
|
||||
/// has array of i8 type filled in with the nul terminated string value
|
||||
/// specified. If Name is specified, it is the name of the global variable
|
||||
|
@ -178,65 +178,65 @@ public:
|
|||
ConstantInt *getInt32(uint32_t C) {
|
||||
return ConstantInt::get(getInt32Ty(), C);
|
||||
}
|
||||
|
||||
|
||||
/// getInt64 - Get a constant 64-bit value.
|
||||
ConstantInt *getInt64(uint64_t C) {
|
||||
return ConstantInt::get(getInt64Ty(), C);
|
||||
}
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Type creation methods
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
|
||||
/// getInt1Ty - Fetch the type representing a single bit
|
||||
const IntegerType *getInt1Ty() {
|
||||
return Type::getInt1Ty(Context);
|
||||
}
|
||||
|
||||
|
||||
/// getInt8Ty - Fetch the type representing an 8-bit integer.
|
||||
const IntegerType *getInt8Ty() {
|
||||
return Type::getInt8Ty(Context);
|
||||
}
|
||||
|
||||
|
||||
/// getInt16Ty - Fetch the type representing a 16-bit integer.
|
||||
const IntegerType *getInt16Ty() {
|
||||
return Type::getInt16Ty(Context);
|
||||
}
|
||||
|
||||
|
||||
/// getInt32Ty - Fetch the type resepresenting a 32-bit integer.
|
||||
const IntegerType *getInt32Ty() {
|
||||
return Type::getInt32Ty(Context);
|
||||
}
|
||||
|
||||
|
||||
/// getInt64Ty - Fetch the type representing a 64-bit integer.
|
||||
const IntegerType *getInt64Ty() {
|
||||
return Type::getInt64Ty(Context);
|
||||
}
|
||||
|
||||
|
||||
/// getFloatTy - Fetch the type representing a 32-bit floating point value.
|
||||
const Type *getFloatTy() {
|
||||
return Type::getFloatTy(Context);
|
||||
}
|
||||
|
||||
|
||||
/// getDoubleTy - Fetch the type representing a 64-bit floating point value.
|
||||
const Type *getDoubleTy() {
|
||||
return Type::getDoubleTy(Context);
|
||||
}
|
||||
|
||||
|
||||
/// getVoidTy - Fetch the type representing void.
|
||||
const Type *getVoidTy() {
|
||||
return Type::getVoidTy(Context);
|
||||
}
|
||||
|
||||
|
||||
const PointerType *getInt8PtrTy() {
|
||||
return Type::getInt8PtrTy(Context);
|
||||
}
|
||||
|
||||
|
||||
/// getCurrentFunctionReturnType - Get the return type of the current function
|
||||
/// that we're emitting into.
|
||||
const Type *getCurrentFunctionReturnType() const;
|
||||
};
|
||||
|
||||
|
||||
/// IRBuilder - This provides a uniform API for creating instructions and
|
||||
/// inserting them into a basic block: either at the end of a BasicBlock, or
|
||||
/// at a specific iterator location in a block.
|
||||
|
@ -258,25 +258,25 @@ public:
|
|||
IRBuilder(LLVMContext &C, const T &F, const Inserter &I = Inserter())
|
||||
: IRBuilderBase(C), Inserter(I), Folder(F) {
|
||||
}
|
||||
|
||||
|
||||
explicit IRBuilder(LLVMContext &C) : IRBuilderBase(C), Folder(C) {
|
||||
}
|
||||
|
||||
|
||||
explicit IRBuilder(BasicBlock *TheBB, const T &F)
|
||||
: IRBuilderBase(TheBB->getContext()), Folder(F) {
|
||||
SetInsertPoint(TheBB);
|
||||
}
|
||||
|
||||
|
||||
explicit IRBuilder(BasicBlock *TheBB)
|
||||
: IRBuilderBase(TheBB->getContext()), Folder(Context) {
|
||||
SetInsertPoint(TheBB);
|
||||
}
|
||||
|
||||
|
||||
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T& F)
|
||||
: IRBuilderBase(TheBB->getContext()), Folder(F) {
|
||||
SetInsertPoint(TheBB, IP);
|
||||
}
|
||||
|
||||
|
||||
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP)
|
||||
: IRBuilderBase(TheBB->getContext()), Folder(Context) {
|
||||
SetInsertPoint(TheBB, IP);
|
||||
|
@ -288,7 +288,7 @@ public:
|
|||
/// isNamePreserving - Return true if this builder is configured to actually
|
||||
/// add the requested names to IR created through it.
|
||||
bool isNamePreserving() const { return preserveNames; }
|
||||
|
||||
|
||||
/// Insert - Insert and return the specified instruction.
|
||||
template<typename InstTy>
|
||||
InstTy *Insert(InstTy *I, const Twine &Name = "") const {
|
||||
|
@ -313,7 +313,7 @@ public:
|
|||
ReturnInst *CreateRet(Value *V) {
|
||||
return Insert(ReturnInst::Create(Context, V));
|
||||
}
|
||||
|
||||
|
||||
/// CreateAggregateRet - Create a sequence of N insertvalue instructions,
|
||||
/// with one Value from the retVals array each, that build a aggregate
|
||||
/// return value one value at a time, and a ret instruction to return
|
||||
|
@ -735,7 +735,7 @@ public:
|
|||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Folder.CreateGetElementPtr(PC, &Idx, 1);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(Ptr, &Idx, &Idx+1), Name);
|
||||
return Insert(GetElementPtrInst::Create(Ptr, &Idx, &Idx+1), Name);
|
||||
}
|
||||
Value *CreateConstInBoundsGEP1_32(Value *Ptr, unsigned Idx0,
|
||||
const Twine &Name = "") {
|
||||
|
@ -746,7 +746,7 @@ public:
|
|||
|
||||
return Insert(GetElementPtrInst::CreateInBounds(Ptr, &Idx, &Idx+1), Name);
|
||||
}
|
||||
Value *CreateConstGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
|
||||
Value *CreateConstGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
|
||||
const Twine &Name = "") {
|
||||
Value *Idxs[] = {
|
||||
ConstantInt::get(Type::getInt32Ty(Context), Idx0),
|
||||
|
@ -756,7 +756,7 @@ public:
|
|||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Folder.CreateGetElementPtr(PC, Idxs, 2);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name);
|
||||
return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name);
|
||||
}
|
||||
Value *CreateConstInBoundsGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
|
||||
const Twine &Name = "") {
|
||||
|
@ -776,7 +776,7 @@ public:
|
|||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Folder.CreateGetElementPtr(PC, &Idx, 1);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(Ptr, &Idx, &Idx+1), Name);
|
||||
return Insert(GetElementPtrInst::Create(Ptr, &Idx, &Idx+1), Name);
|
||||
}
|
||||
Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0,
|
||||
const Twine &Name = "") {
|
||||
|
@ -797,7 +797,7 @@ public:
|
|||
if (Constant *PC = dyn_cast<Constant>(Ptr))
|
||||
return Folder.CreateGetElementPtr(PC, Idxs, 2);
|
||||
|
||||
return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name);
|
||||
return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name);
|
||||
}
|
||||
Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
|
||||
const Twine &Name = "") {
|
||||
|
@ -814,7 +814,7 @@ public:
|
|||
Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = "") {
|
||||
return CreateConstInBoundsGEP2_32(Ptr, 0, Idx, Name);
|
||||
}
|
||||
|
||||
|
||||
/// CreateGlobalStringPtr - Same as CreateGlobalString, but return a pointer
|
||||
/// with "i8*" type instead of a pointer to array of i8.
|
||||
Value *CreateGlobalStringPtr(const char *Str = "", const Twine &Name = "") {
|
||||
|
@ -823,7 +823,7 @@ public:
|
|||
Value *Args[] = { zero, zero };
|
||||
return CreateInBoundsGEP(gv, Args, Args+2, Name);
|
||||
}
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Instruction creation methods: Cast/Conversion Operators
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue