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 /lib/VMCore/iOperators.cpp | |
parent | f22696f209701bff12edbe41c646d1ef179c685d (diff) | |
download | external_llvm-0908309e3c4b4f423e88d8d8fe8060cb10eaa1c9.tar.gz external_llvm-0908309e3c4b4f423e88d8d8fe8060cb10eaa1c9.tar.bz2 external_llvm-0908309e3c4b4f423e88d8d8fe8060cb10eaa1c9.zip |
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 'lib/VMCore/iOperators.cpp')
-rw-r--r-- | lib/VMCore/iOperators.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/VMCore/iOperators.cpp b/lib/VMCore/iOperators.cpp index 61d5d26d2b..6f7c2f158e 100644 --- a/lib/VMCore/iOperators.cpp +++ b/lib/VMCore/iOperators.cpp @@ -7,6 +7,32 @@ #include "llvm/iBinary.h" #include "llvm/Type.h" +UnaryOperator *UnaryOperator::create(UnaryOps Op, Value *Source, + const Type *DestTy = 0) { + if (DestTy == 0) DestTy = Source->getType(); + switch (Op) { + case Not: assert(DestTy == Source->getType()); + case Cast: return new GenericUnaryInst(Op, Source, DestTy); + default: + cerr << "Don't know how to GetUnaryOperator " << Op << endl; + return 0; + } +} + +const char *GenericUnaryInst::getOpcodeName() const { + switch (getOpcode()) { + case Not: return "not"; + case Cast: return "cast"; + default: + cerr << "Invalid unary operator type!" << getOpcode() << endl; + abort(); + } +} + +//===----------------------------------------------------------------------===// +// BinaryOperator Class +//===----------------------------------------------------------------------===// + BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2, const string &Name) { switch (Op) { @@ -20,6 +46,10 @@ BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2, } } +//===----------------------------------------------------------------------===// +// GenericBinaryInst Class +//===----------------------------------------------------------------------===// + const char *GenericBinaryInst::getOpcodeName() const { switch (getOpcode()) { // Standard binary operators... @@ -35,7 +65,7 @@ const char *GenericBinaryInst::getOpcodeName() const { case Xor: return "xor"; default: cerr << "Invalid binary operator type!" << getOpcode() << endl; - return 0; + abort(); } } |