class BasicBlock;
class ConstantInt;
class PointerType;
-class PackedType;
+class VectorType;
//===----------------------------------------------------------------------===//
// AllocationInst Class
public:
LoadInst(Value *Ptr, const std::string &Name, Instruction *InsertBefore);
LoadInst(Value *Ptr, const std::string &Name, BasicBlock *InsertAtEnd);
- explicit LoadInst(Value *Ptr, const std::string &Name = "",
- bool isVolatile = false, Instruction *InsertBefore = 0);
+ LoadInst(Value *Ptr, const std::string &Name, bool isVolatile = false,
+ Instruction *InsertBefore = 0);
LoadInst(Value *Ptr, const std::string &Name, bool isVolatile,
BasicBlock *InsertAtEnd);
+ LoadInst(Value *Ptr, const char *Name, Instruction *InsertBefore);
+ LoadInst(Value *Ptr, const char *Name, BasicBlock *InsertAtEnd);
+ explicit LoadInst(Value *Ptr, const char *Name = 0, bool isVolatile = false,
+ Instruction *InsertBefore = 0);
+ LoadInst(Value *Ptr, const char *Name, bool isVolatile,
+ BasicBlock *InsertAtEnd);
+
/// isVolatile - Return true if this is a load from a volatile memory
/// location.
///
for (unsigned i = 0, E = NumOperands; i != E; ++i)
OL[i].init(GEPIOL[i], this);
}
- void init(Value *Ptr, const std::vector<Value*> &Idx);
+ void init(Value *Ptr, Value* const *Idx, unsigned NumIdx);
void init(Value *Ptr, Value *Idx0, Value *Idx1);
void init(Value *Ptr, Value *Idx);
public:
/// list of indices. The first ctor can optionally insert before an existing
/// instruction, the second appends the new instruction to the specified
/// BasicBlock.
- GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
- const std::string &Name = "", Instruction *InsertBefore =0);
- GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
- const std::string &Name, BasicBlock *InsertAtEnd);
GetElementPtrInst(Value *Ptr, Value* const *Idx, unsigned NumIdx,
const std::string &Name = "", Instruction *InsertBefore =0);
GetElementPtrInst(Value *Ptr, Value* const *Idx, unsigned NumIdx,
Value* const *Idx, unsigned NumIdx,
bool AllowStructLeaf = false);
- static const Type *getIndexedType(const Type *Ptr,
- const std::vector<Value*> &Indices,
- bool AllowStructLeaf = false) {
- return getIndexedType(Ptr, &Indices[0], Indices.size(), AllowStructLeaf);
- }
static const Type *getIndexedType(const Type *Ptr, Value *Idx0, Value *Idx1,
bool AllowStructLeaf = false);
static const Type *getIndexedType(const Type *Ptr, Value *Idx);
///
class CallInst : public Instruction {
CallInst(const CallInst &CI);
- void init(Value *Func, const std::vector<Value*> &Params);
+ void init(Value *Func, Value* const *Params, unsigned NumParams);
void init(Value *Func, Value *Actual1, Value *Actual2);
void init(Value *Func, Value *Actual);
void init(Value *Func);
public:
- CallInst(Value *F, const std::vector<Value*> &Par,
+ CallInst(Value *F, Value* const *Args, unsigned NumArgs,
const std::string &Name = "", Instruction *InsertBefore = 0);
- CallInst(Value *F, const std::vector<Value*> &Par,
+ CallInst(Value *F, Value *const *Args, unsigned NumArgs,
const std::string &Name, BasicBlock *InsertAtEnd);
-
+
// Alternate CallInst ctors w/ two actuals, w/ one actual and no
// actuals, respectively.
CallInst(Value *F, Value *Actual1, Value *Actual2,
}
};
-
-//===----------------------------------------------------------------------===//
-// ShiftInst Class
-//===----------------------------------------------------------------------===//
-
-/// ShiftInst - This class represents left and right shift instructions.
-///
-class ShiftInst : public Instruction {
- Use Ops[2];
- ShiftInst(const ShiftInst &SI)
- : Instruction(SI.getType(), SI.getOpcode(), Ops, 2) {
- Ops[0].init(SI.Ops[0], this);
- Ops[1].init(SI.Ops[1], this);
- }
- void init(OtherOps Opcode, Value *S, Value *SA) {
- assert((Opcode == Shl || Opcode == LShr || Opcode == AShr) &&
- "ShiftInst Opcode invalid!");
- Ops[0].init(S, this);
- Ops[1].init(SA, this);
- }
-
-public:
- ShiftInst(OtherOps Opcode, Value *S, Value *SA, const std::string &Name = "",
- Instruction *InsertBefore = 0)
- : Instruction(S->getType(), Opcode, Ops, 2, Name, InsertBefore) {
- init(Opcode, S, SA);
- }
- ShiftInst(OtherOps Opcode, Value *S, Value *SA, const std::string &Name,
- BasicBlock *InsertAtEnd)
- : Instruction(S->getType(), Opcode, Ops, 2, Name, InsertAtEnd) {
- init(Opcode, S, SA);
- }
-
- OtherOps getOpcode() const {
- return static_cast<OtherOps>(Instruction::getOpcode());
- }
-
- /// Transparently provide more efficient getOperand methods.
- Value *getOperand(unsigned i) const {
- assert(i < 2 && "getOperand() out of range!");
- return Ops[i];
- }
- void setOperand(unsigned i, Value *Val) {
- assert(i < 2 && "setOperand() out of range!");
- Ops[i] = Val;
- }
- unsigned getNumOperands() const { return 2; }
-
- /// isLogicalShift - Return true if this is a logical shift left or a logical
- /// shift right.
- bool isLogicalShift() const {
- unsigned opcode = getOpcode();
- return opcode == Instruction::Shl || opcode == Instruction::LShr;
- }
-
-
- /// isArithmeticShift - Return true if this is a sign-extending shift right
- /// operation.
- bool isArithmeticShift() const {
- return !isLogicalShift();
- }
-
-
- virtual ShiftInst *clone() const;
-
- // Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ShiftInst *) { return true; }
- static inline bool classof(const Instruction *I) {
- return (I->getOpcode() == Instruction::LShr) |
- (I->getOpcode() == Instruction::AShr) |
- (I->getOpcode() == Instruction::Shl);
- }
- static inline bool classof(const Value *V) {
- return isa<Instruction>(V) && classof(cast<Instruction>(V));
- }
-};
-
//===----------------------------------------------------------------------===//
// SelectInst Class
//===----------------------------------------------------------------------===//
public:
VAArgInst(Value *List, const Type *Ty, const std::string &Name = "",
Instruction *InsertBefore = 0)
- : UnaryInstruction(Ty, VAArg, List, Name, InsertBefore) {
+ : UnaryInstruction(Ty, VAArg, List, 0, InsertBefore) {
+ setName(Name);
}
VAArgInst(Value *List, const Type *Ty, const std::string &Name,
BasicBlock *InsertAtEnd)
- : UnaryInstruction(Ty, VAArg, List, Name, InsertAtEnd) {
+ : UnaryInstruction(Ty, VAArg, List, 0, InsertAtEnd) {
+ setName(Name);
}
virtual VAArgInst *clone() const;
//===----------------------------------------------------------------------===//
/// ExtractElementInst - This instruction extracts a single (scalar)
-/// element from a PackedType value
+/// element from a VectorType value
///
class ExtractElementInst : public Instruction {
Use Ops[2];
//===----------------------------------------------------------------------===//
/// InsertElementInst - This instruction inserts a single (scalar)
-/// element into a PackedType value
+/// element into a VectorType value
///
class InsertElementInst : public Instruction {
Use Ops[3];
virtual bool mayWriteToMemory() const { return false; }
- /// getType - Overload to return most specific packed type.
+ /// getType - Overload to return most specific vector type.
///
- inline const PackedType *getType() const {
- return reinterpret_cast<const PackedType*>(Instruction::getType());
+ inline const VectorType *getType() const {
+ return reinterpret_cast<const VectorType*>(Instruction::getType());
}
/// Transparently provide more efficient getOperand methods.
virtual bool mayWriteToMemory() const { return false; }
- /// getType - Overload to return most specific packed type.
+ /// getType - Overload to return most specific vector type.
///
- inline const PackedType *getType() const {
- return reinterpret_cast<const PackedType*>(Instruction::getType());
+ inline const VectorType *getType() const {
+ return reinterpret_cast<const VectorType*>(Instruction::getType());
}
/// Transparently provide more efficient getOperand methods.
class InvokeInst : public TerminatorInst {
InvokeInst(const InvokeInst &BI);
void init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
- const std::vector<Value*> &Params);
+ Value* const *Args, unsigned NumArgs);
public:
InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
- const std::vector<Value*> &Params, const std::string &Name = "",
+ Value* const* Args, unsigned NumArgs, const std::string &Name = "",
Instruction *InsertBefore = 0);
InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
- const std::vector<Value*> &Params, const std::string &Name,
+ Value* const* Args, unsigned NumArgs, const std::string &Name,
BasicBlock *InsertAtEnd);
~InvokeInst();