[llvm-commits] CVS: llvm/include/llvm/Instructions.h

Chris Lattner lattner at cs.uiuc.edu
Fri Apr 14 15:20:19 PDT 2006



Changes in directory llvm/include/llvm:

Instructions.h updated: 1.33 -> 1.34
---
Log message:

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


---
Diffs of the changes:  (+15 -14)

 Instructions.h |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.33 llvm/include/llvm/Instructions.h:1.34
--- llvm/include/llvm/Instructions.h:1.33	Fri Apr  7 23:04:54 2006
+++ llvm/include/llvm/Instructions.h	Fri Apr 14 17:20:07 2006
@@ -24,6 +24,7 @@
 class BasicBlock;
 class ConstantInt;
 class PointerType;
+class PackedType;
 
 //===----------------------------------------------------------------------===//
 //                             AllocationInst Class
@@ -776,13 +777,7 @@
 ///
 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 @@
 
   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 @@
 ///
 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 @@
   
   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!");






More information about the llvm-commits mailing list