Neg instruction removed. Cast instruction implemented.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-07-08 04:57:15 +00:00
parent f22696f209
commit 0908309e3c
19 changed files with 752 additions and 722 deletions

View File

@@ -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();
}
}