diff options
author | Chris Lattner <sabre@nondot.org> | 2001-07-08 21:10:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-07-08 21:10:27 +0000 |
commit | 027dcc5b2249bc260f8bbf3fe5f6ce774054e671 (patch) | |
tree | 14f209003a2776cd602dbbb9eeeee56ab29b642c /include/llvm/iOther.h | |
parent | 71496b3b50cfcba84eb4acd988ce88a4463e4515 (diff) | |
download | external_llvm-027dcc5b2249bc260f8bbf3fe5f6ce774054e671.zip external_llvm-027dcc5b2249bc260f8bbf3fe5f6ce774054e671.tar.gz external_llvm-027dcc5b2249bc260f8bbf3fe5f6ce774054e671.tar.bz2 |
Implemented shl, shl, & load instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/iOther.h')
-rw-r--r-- | include/llvm/iOther.h | 76 |
1 files changed, 52 insertions, 24 deletions
diff --git a/include/llvm/iOther.h b/include/llvm/iOther.h index cf9fe96..ce5aa93 100644 --- a/include/llvm/iOther.h +++ b/include/llvm/iOther.h @@ -13,30 +13,6 @@ #include <vector> //===----------------------------------------------------------------------===// -// CastInst Class -//===----------------------------------------------------------------------===// - -// CastInst - This function represents a cast from Operand[0] to the type of -// the instruction (i->getType()). -// -class CastInst : public Instruction { - CastInst(const CastInst &CI) : Instruction(CI.getType(), Cast) { - Operands.reserve(1); - Operands.push_back(Use((Value*)CI.getOperand(0), this)); - } -public: - CastInst(Value *S, const Type *Ty, const string &Name = "") - : Instruction(Ty, Cast, Name) { - Operands.reserve(1); - Operands.push_back(Use(S, this)); - } - - virtual Instruction *clone() const { return new CastInst(*this); } - virtual const char *getOpcodeName() const { return "cast"; } -}; - - -//===----------------------------------------------------------------------===// // PHINode Class //===----------------------------------------------------------------------===// @@ -81,6 +57,30 @@ public: //===----------------------------------------------------------------------===// +// CastInst Class +//===----------------------------------------------------------------------===// + +// CastInst - This class represents a cast from Operand[0] to the type of +// the instruction (i->getType()). +// +class CastInst : public Instruction { + CastInst(const CastInst &CI) : Instruction(CI.getType(), Cast) { + Operands.reserve(1); + Operands.push_back(Use(Operands[0], this)); + } +public: + CastInst(Value *S, const Type *Ty, const string &Name = "") + : Instruction(Ty, Cast, Name) { + Operands.reserve(1); + Operands.push_back(Use(S, this)); + } + + virtual Instruction *clone() const { return new CastInst(*this); } + virtual const char *getOpcodeName() const { return "cast"; } +}; + + +//===----------------------------------------------------------------------===// // MethodArgument Class //===----------------------------------------------------------------------===// @@ -127,4 +127,32 @@ public: } }; + +//===----------------------------------------------------------------------===// +// ShiftInst Class +//===----------------------------------------------------------------------===// + +// ShiftInst - This class represents left and right shift instructions. +// +class ShiftInst : public Instruction { + ShiftInst(const ShiftInst &CI) : Instruction(CI.getType(), CI.getOpcode()) { + Operands.reserve(2); + Operands.push_back(Use(Operands[0], this)); + Operands.push_back(Use(Operands[1], this)); + } +public: + ShiftInst(OtherOps Opcode, Value *S, Value *SA, const string &Name = "") + : Instruction(S->getType(), Opcode, Name) { + assert((Opcode == Shl || Opcode == Shr) && "ShiftInst Opcode invalid!"); + Operands.reserve(2); + Operands.push_back(Use(S, this)); + Operands.push_back(Use(SA, this)); + } + + virtual Instruction *clone() const { return new ShiftInst(*this); } + virtual const char *getOpcodeName() const { + return getOpcode() == Shl ? "shl" : "shr"; + } +}; + #endif |