1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

These instructions always return a packed vector. Improve the class definitions to expose this fact.

llvm-svn: 27712
This commit is contained in:
Chris Lattner 2006-04-14 22:20:07 +00:00
parent 32c4470374
commit 5324c4f9aa

View File

@ -24,6 +24,7 @@ namespace llvm {
class BasicBlock; class BasicBlock;
class ConstantInt; class ConstantInt;
class PointerType; class PointerType;
class PackedType;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// AllocationInst Class // AllocationInst Class
@ -776,13 +777,7 @@ public:
/// ///
class InsertElementInst : public Instruction { class InsertElementInst : public Instruction {
Use Ops[3]; Use Ops[3];
InsertElementInst(const InsertElementInst &IE) : InsertElementInst(const InsertElementInst &IE);
Instruction(IE.getType(), InsertElement, Ops, 3) {
Ops[0].init(IE.Ops[0], this);
Ops[1].init(IE.Ops[1], this);
Ops[2].init(IE.Ops[2], this);
}
public: public:
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const std::string &Name = "",Instruction *InsertBefore = 0); const std::string &Name = "",Instruction *InsertBefore = 0);
@ -798,6 +793,12 @@ public:
virtual bool mayWriteToMemory() const { return false; } virtual bool mayWriteToMemory() const { return false; }
/// getType - Overload to return most specific packed type.
///
inline const PackedType *getType() const {
return reinterpret_cast<const PackedType*>(Instruction::getType());
}
/// Transparently provide more efficient getOperand methods. /// Transparently provide more efficient getOperand methods.
Value *getOperand(unsigned i) const { Value *getOperand(unsigned i) const {
assert(i < 3 && "getOperand() out of range!"); assert(i < 3 && "getOperand() out of range!");
@ -828,13 +829,7 @@ public:
/// ///
class ShuffleVectorInst : public Instruction { class ShuffleVectorInst : public Instruction {
Use Ops[3]; Use Ops[3];
ShuffleVectorInst(const ShuffleVectorInst &IE) : ShuffleVectorInst(const ShuffleVectorInst &IE);
Instruction(IE.getType(), ShuffleVector, Ops, 3) {
Ops[0].init(IE.Ops[0], this);
Ops[1].init(IE.Ops[1], this);
Ops[2].init(IE.Ops[2], this);
}
public: public:
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const std::string &Name = "", Instruction *InsertBefor = 0); const std::string &Name = "", Instruction *InsertBefor = 0);
@ -850,6 +845,12 @@ public:
virtual bool mayWriteToMemory() const { return false; } virtual bool mayWriteToMemory() const { return false; }
/// getType - Overload to return most specific packed type.
///
inline const PackedType *getType() const {
return reinterpret_cast<const PackedType*>(Instruction::getType());
}
/// Transparently provide more efficient getOperand methods. /// Transparently provide more efficient getOperand methods.
Value *getOperand(unsigned i) const { Value *getOperand(unsigned i) const {
assert(i < 3 && "getOperand() out of range!"); assert(i < 3 && "getOperand() out of range!");