diff options
author | Chris Lattner <sabre@nondot.org> | 2001-07-08 04:57:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-07-08 04:57:15 +0000 |
commit | 0908309e3c4b4f423e88d8d8fe8060cb10eaa1c9 (patch) | |
tree | dcdecdda0cd3e1168527d832f3824e0c94b3ef60 /include/llvm | |
parent | f22696f209701bff12edbe41c646d1ef179c685d (diff) | |
download | llvm-0908309e3c4b4f423e88d8d8fe8060cb10eaa1c9.tar.gz llvm-0908309e3c4b4f423e88d8d8fe8060cb10eaa1c9.tar.bz2 llvm-0908309e3c4b4f423e88d8d8fe8060cb10eaa1c9.tar.xz |
Neg instruction removed. Cast instruction implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/ConstantHandling.h | 6 | ||||
-rw-r--r-- | include/llvm/InstrTypes.h | 8 | ||||
-rw-r--r-- | include/llvm/Instruction.h | 10 | ||||
-rw-r--r-- | include/llvm/iOperators.h | 14 |
4 files changed, 21 insertions, 17 deletions
diff --git a/include/llvm/ConstantHandling.h b/include/llvm/ConstantHandling.h index cf18ef8cea..79dd21c2c6 100644 --- a/include/llvm/ConstantHandling.h +++ b/include/llvm/ConstantHandling.h @@ -60,7 +60,6 @@ protected: inline ConstRules() {} // Can only be subclassed... public: // Unary Operators... - virtual ConstPoolVal *neg(const ConstPoolVal *V) const = 0; virtual ConstPoolVal *not(const ConstPoolVal *V) const = 0; // Binary Operators... @@ -88,10 +87,6 @@ private : }; -inline ConstPoolVal *operator-(const ConstPoolVal &V) { - return ConstRules::get(V)->neg(&V); -} - inline ConstPoolVal *operator!(const ConstPoolVal &V) { return ConstRules::get(V)->not(&V); } @@ -154,7 +149,6 @@ inline ConstPoolVal *ConstantFoldUnaryInstruction(unsigned Opcode, ConstPoolVal *V) { switch (Opcode) { case Instruction::Not: return !*V; - case Instruction::Neg: return -*V; } return 0; } diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index fa0ce87c9c..8bfaca4a8a 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -55,10 +55,12 @@ public: // create() - Construct a unary instruction, given the opcode // and its operand. // - static UnaryOperator *create(UnaryOps Op, Value *Source); + static UnaryOperator *create(UnaryOps Op, Value *Source, + const Type *DestTy = 0); - UnaryOperator(Value *S, UnaryOps iType, const string &Name = "") - : Instruction(S->getType(), iType, Name) { + UnaryOperator(Value *S, UnaryOps iType, const Type *ResultType, + const string &Name = "") + : Instruction(ResultType, iType, Name) { Operands.reserve(1); Operands.push_back(Use(S, this)); } diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index 96f2637ee2..16adbb2982 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -77,14 +77,8 @@ public: enum UnaryOps { FirstUnaryOp = NumTermOps, - Neg = NumTermOps, Not, - - // Type conversions... - ToBoolTy , - ToUByteTy , ToSByteTy, ToUShortTy, ToShortTy, - ToUInt , ToInt, ToULongTy , ToLongTy, - - ToFloatTy , ToDoubleTy, ToArrayTy , ToPointerTy, + Not = NumTermOps, // Binary inverse + Cast, // Type cast... NumUnaryOps // Must remain at end of enum }; diff --git a/include/llvm/iOperators.h b/include/llvm/iOperators.h index 4b6109a854..5d02a40477 100644 --- a/include/llvm/iOperators.h +++ b/include/llvm/iOperators.h @@ -10,6 +10,20 @@ #include "llvm/InstrTypes.h" //===----------------------------------------------------------------------===// +// Class to represent Unary operators +//===----------------------------------------------------------------------===// +// +class GenericUnaryInst : public UnaryOperator { +public: + GenericUnaryInst(UnaryOps Opcode, Value *S1, const Type *ResultTy = 0, + const string &Name = "") + : UnaryOperator(S1, Opcode, ResultTy, Name) { + } + + virtual const char *getOpcodeName() const; +}; + +//===----------------------------------------------------------------------===// // Classes to represent Binary operators //===----------------------------------------------------------------------===// // |