diff options
author | Robert Bocchino <bocchino@illinois.edu> | 2006-01-10 19:04:13 +0000 |
---|---|---|
committer | Robert Bocchino <bocchino@illinois.edu> | 2006-01-10 19:04:13 +0000 |
commit | 49b78a569609881811d905960baa7dd1ab801383 (patch) | |
tree | 7b70bc80f70d5e57c72c8ac49a81328b739ecfce /include/llvm/Instructions.h | |
parent | eb7116bb08a99897c69570a3789af97343bff9f2 (diff) | |
download | external_llvm-49b78a569609881811d905960baa7dd1ab801383.zip external_llvm-49b78a569609881811d905960baa7dd1ab801383.tar.gz external_llvm-49b78a569609881811d905960baa7dd1ab801383.tar.bz2 |
Added an instruction and constant expression for the extractelement
operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instructions.h')
-rw-r--r-- | include/llvm/Instructions.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 8c62d3d..703c41d 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -718,6 +718,52 @@ public: }; //===----------------------------------------------------------------------===// +// 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 //===----------------------------------------------------------------------===// |