diff options
author | Chris Lattner <sabre@nondot.org> | 2001-06-27 23:36:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-06-27 23:36:49 +0000 |
commit | 0ee411c080a30265570dbc242a43aef09c943a60 (patch) | |
tree | dc3b638eea5a7f13299b98d5b16e7c02cf7f087f /llvm/lib/VMCore/iOperators.cpp | |
parent | 1a67fb88604b611c1ce2290eef3166eaa15ede4a (diff) | |
download | bcm5719-llvm-0ee411c080a30265570dbc242a43aef09c943a60.tar.gz bcm5719-llvm-0ee411c080a30265570dbc242a43aef09c943a60.zip |
Change to use the new GenericBinaryInst class. Support lots more operators.
llvm-svn: 92
Diffstat (limited to 'llvm/lib/VMCore/iOperators.cpp')
-rw-r--r-- | llvm/lib/VMCore/iOperators.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/VMCore/iOperators.cpp b/llvm/lib/VMCore/iOperators.cpp index d856a20d0a5..c1efb42e716 100644 --- a/llvm/lib/VMCore/iOperators.cpp +++ b/llvm/lib/VMCore/iOperators.cpp @@ -10,14 +10,21 @@ BinaryOperator *BinaryOperator::create(unsigned Op, Value *S1, Value *S2, const string &Name) { switch (Op) { - case Add: return new AddInst(S1, S2, Name); - case Sub: return new SubInst(S1, S2, Name); - case SetLT: - case SetGT: - case SetLE: - case SetGE: - case SetEQ: - case SetNE: + // Standard binary operators... + case Add: return new GenericBinaryInst(Op, S1, S2, "add", Name); + case Sub: return new GenericBinaryInst(Op, S1, S2, "sub", Name); + case Mul: return new GenericBinaryInst(Op, S1, S2, "mul", Name); + case Div: return new GenericBinaryInst(Op, S1, S2, "div", Name); + case Rem: return new GenericBinaryInst(Op, S1, S2, "rem", Name); + + // 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); default: |