aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-04-14 22:20:07 +0000
committerChris Lattner <sabre@nondot.org>2006-04-14 22:20:07 +0000
commit6a56ed48b982a241ed9a0d9a047121f21412f622 (patch)
treed3472ad1e97c146071e740a60792789d92c48970
parentd953947d26da373b3b4e5ff66b60883fb78c0dd5 (diff)
These instructions always return a packed vector. Improve the class definitions to expose this fact.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27712 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Instructions.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index eecc32c533..1c18e9a618 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -24,6 +24,7 @@ namespace llvm {
class BasicBlock;
class ConstantInt;
class PointerType;
+class PackedType;
//===----------------------------------------------------------------------===//
// AllocationInst Class
@@ -776,13 +777,7 @@ public:
///
class InsertElementInst : public Instruction {
Use Ops[3];
- 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);
- }
-
+ InsertElementInst(const InsertElementInst &IE);
public:
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const std::string &Name = "",Instruction *InsertBefore = 0);
@@ -798,6 +793,12 @@ public:
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.
Value *getOperand(unsigned i) const {
assert(i < 3 && "getOperand() out of range!");
@@ -828,13 +829,7 @@ public:
///
class ShuffleVectorInst : public Instruction {
Use Ops[3];
- 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);
- }
-
+ ShuffleVectorInst(const ShuffleVectorInst &IE);
public:
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const std::string &Name = "", Instruction *InsertBefor = 0);
@@ -850,6 +845,12 @@ public:
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.
Value *getOperand(unsigned i) const {
assert(i < 3 && "getOperand() out of range!");