Moved UnaryOperator::create to InstrTypes.cpp until there is an iUnaryOps.cpp
[oota-llvm.git] / lib / VMCore / iOperators.cpp
index c754f42b6f0cb6827df3e13d3d6717e4d76707ba..d856a20d0a5a7afb8712735469ff93bb5b747f89 100644 (file)
@@ -7,6 +7,25 @@
 #include "llvm/iBinary.h"
 #include "llvm/Type.h"
 
+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:
+    return new SetCondInst((BinaryOps)Op, S1, S2, Name);
+
+  default:
+    cerr << "Don't know how to GetBinaryOperator " << Op << endl;
+    return 0;
+  }
+}
+
 //===----------------------------------------------------------------------===//
 //                             SetCondInst Class
 //===----------------------------------------------------------------------===//