diff options
author | Robert Bocchino <bocchino@illinois.edu> | 2006-01-17 20:05:59 +0000 |
---|---|---|
committer | Robert Bocchino <bocchino@illinois.edu> | 2006-01-17 20:05:59 +0000 |
commit | f999344fa74199f5acefbc492af2b60e67d0ba24 (patch) | |
tree | f03e4ad4f6fb18eac471ec62424f89299ba6fc85 /include/llvm/Instructions.h | |
parent | 433f8acefb78f1c8a2cf79c12b101ce7c4b20202 (diff) | |
download | external_llvm-f999344fa74199f5acefbc492af2b60e67d0ba24.tar.gz external_llvm-f999344fa74199f5acefbc492af2b60e67d0ba24.tar.bz2 external_llvm-f999344fa74199f5acefbc492af2b60e67d0ba24.zip |
Instruction and constant expression definitions for the insertelement
operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instructions.h')
-rw-r--r-- | include/llvm/Instructions.h | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 703c41d679..f94bffaa49 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -726,17 +726,17 @@ public: /// 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); + ExtractElementInst(const ExtractElementInst &EE) : + Instruction(EE.getType(), ExtractElement, Ops, 2) { + Ops[0].init(EE.Ops[0], this); + Ops[1].init(EE.Ops[1], this); } public: ExtractElementInst(Value *Val, Value *Index, - const std::string &Name = "", Instruction *InsertBefore = 0); + const std::string &Name = "", Instruction *InsertBefore = 0); ExtractElementInst(Value *Val, Value *Index, - const std::string &Name, BasicBlock *InsertAtEnd); + const std::string &Name, BasicBlock *InsertAtEnd); virtual ExtractElementInst *clone() const; @@ -764,6 +764,53 @@ public: }; //===----------------------------------------------------------------------===// +// InsertElementInst Class +//===----------------------------------------------------------------------===// + +/// InsertElementInst - This instruction inserts a single (scalar) +/// element into a PackedType value +/// +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); + } + +public: + InsertElementInst(Value *Val, Value *Elt, Value *Index, + const std::string &Name = "", Instruction *InsertBefore = 0); + InsertElementInst(Value *Val, Value *Elt, Value *Index, + const std::string &Name, BasicBlock *InsertAtEnd); + + virtual InsertElementInst *clone() const; + + virtual bool mayWriteToMemory() const { return false; } + + /// Transparently provide more efficient getOperand methods. + Value *getOperand(unsigned i) const { + assert(i < 3 && "getOperand() out of range!"); + return Ops[i]; + } + void setOperand(unsigned i, Value *Val) { + assert(i < 3 && "setOperand() out of range!"); + Ops[i] = Val; + } + unsigned getNumOperands() const { return 3; } + + // Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const InsertElementInst *) { return true; } + static inline bool classof(const Instruction *I) { + return I->getOpcode() == Instruction::InsertElement; + } + static inline bool classof(const Value *V) { + return isa<Instruction>(V) && classof(cast<Instruction>(V)); + } +}; + +//===----------------------------------------------------------------------===// // PHINode Class //===----------------------------------------------------------------------===// |