Change to use the new GenericBinaryInst class. Support lots more operators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-06-27 23:36:49 +00:00
parent 3b34c59dcb
commit 8a36b31e1a

View File

@ -10,14 +10,21 @@
BinaryOperator *BinaryOperator::create(unsigned Op, Value *S1, Value *S2, BinaryOperator *BinaryOperator::create(unsigned Op, Value *S1, Value *S2,
const string &Name) { const string &Name) {
switch (Op) { switch (Op) {
case Add: return new AddInst(S1, S2, Name); // Standard binary operators...
case Sub: return new SubInst(S1, S2, Name); case Add: return new GenericBinaryInst(Op, S1, S2, "add", Name);
case SetLT: case Sub: return new GenericBinaryInst(Op, S1, S2, "sub", Name);
case SetGT: case Mul: return new GenericBinaryInst(Op, S1, S2, "mul", Name);
case SetLE: case Div: return new GenericBinaryInst(Op, S1, S2, "div", Name);
case SetGE: case Rem: return new GenericBinaryInst(Op, S1, S2, "rem", Name);
case SetEQ:
case SetNE: // Logical operators...
case And: return new GenericBinaryInst(Op, S1, S2, "and", Name);
case Or : return new GenericBinaryInst(Op, S1, S2, "or", Name);
case Xor: return new GenericBinaryInst(Op, S1, S2, "xor", Name);
// Binary comparison operators...
case SetLT: case SetGT: case SetLE:
case SetGE: case SetEQ: case SetNE:
return new SetCondInst((BinaryOps)Op, S1, S2, Name); return new SetCondInst((BinaryOps)Op, S1, S2, Name);
default: default: