[llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def Instructions.h
Robert L. Bocchino Jr.
bocchino at persephone.cs.uiuc.edu
Tue Jan 10 11:06:30 PST 2006
Changes in directory llvm/include/llvm:
Constants.h updated: 1.75 -> 1.76
Instruction.def updated: 1.16 -> 1.17
Instructions.h updated: 1.29 -> 1.30
---
Log message:
Added an instruction and constant expression for the extractelement
operation.
---
Diffs of the changes: (+54 -1)
Constants.h | 6 ++++++
Instruction.def | 3 ++-
Instructions.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 54 insertions(+), 1 deletion(-)
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.75 llvm/include/llvm/Constants.h:1.76
--- llvm/include/llvm/Constants.h:1.75 Tue Oct 4 13:12:13 2005
+++ llvm/include/llvm/Constants.h Tue Jan 10 13:03:58 2006
@@ -521,6 +521,8 @@
Constant *C1, Constant *C2, Constant *C3);
static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,
const std::vector<Value*> &IdxList);
+ static Constant *getExtractElementTy(const Type *Ty, Constant *Val,
+ Constant *Idx);
public:
// Static methods to construct a ConstantExpr of different kinds. Note that
@@ -587,6 +589,10 @@
const std::vector<Constant*> &IdxList);
static Constant *getGetElementPtr(Constant *C,
const std::vector<Value*> &IdxList);
+
+ /// Extractelement form.
+ ///
+ static Constant *getExtractElement(Constant *Val, Constant *Idx);
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.16 llvm/include/llvm/Instruction.def:1.17
--- llvm/include/llvm/Instruction.def:1.16 Fri Jun 24 13:17:33 2005
+++ llvm/include/llvm/Instruction.def Tue Jan 10 13:03:58 2006
@@ -135,7 +135,8 @@
HANDLE_OTHER_INST(35, UserOp1, Instruction) // May be used internally in a pass
HANDLE_OTHER_INST(36, UserOp2, Instruction)
HANDLE_OTHER_INST(37, VAArg , VAArgInst ) // vaarg instruction
- LAST_OTHER_INST(37)
+HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst) // extract packed element
+ LAST_OTHER_INST(38)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.29 llvm/include/llvm/Instructions.h:1.30
--- llvm/include/llvm/Instructions.h:1.29 Sat Nov 5 15:58:30 2005
+++ llvm/include/llvm/Instructions.h Tue Jan 10 13:03:58 2006
@@ -718,6 +718,52 @@
};
//===----------------------------------------------------------------------===//
+// ExtractElementInst Class
+//===----------------------------------------------------------------------===//
+
+/// ExtractElementInst - This instruction extracts a single (scalar)
+/// element from a PackedType value
+///
+class ExtractElementInst : public Instruction {
+ Use Ops[2];
+ ExtractElementInst(const ExtractElementInst &EI) :
+ Instruction(EI.getType(), ExtractElement, Ops, 2) {
+ Ops[0].init(EI.Ops[0], this);
+ Ops[1].init(EI.Ops[1], this);
+ }
+
+public:
+ ExtractElementInst(Value *Val, Value *Index,
+ const std::string &Name = "", Instruction *InsertBefore = 0);
+ ExtractElementInst(Value *Val, Value *Index,
+ const std::string &Name, BasicBlock *InsertAtEnd);
+
+ virtual ExtractElementInst *clone() const;
+
+ virtual bool mayWriteToMemory() const { return false; }
+
+ /// 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; }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const ExtractElementInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return I->getOpcode() == Instruction::ExtractElement;
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
+};
+
+//===----------------------------------------------------------------------===//
// PHINode Class
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list