summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-14 17:52:27 +0000
committerChris Lattner <sabre@nondot.org>2002-08-14 17:52:27 +0000
commit3733c7374ec71c4201bc1be53e20310834abe8c1 (patch)
tree0599e962bb6c6c3a43b3fae48b43c094c608ab67 /llvm/lib
parent4ec79c3e6f1a3ea125ed95da5f83d6ab9d5d1b4f (diff)
downloadbcm5719-llvm-3733c7374ec71c4201bc1be53e20310834abe8c1.tar.gz
bcm5719-llvm-3733c7374ec71c4201bc1be53e20310834abe8c1.zip
Implement two constructor functions for "unary" instructions
llvm-svn: 3317
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/iOperators.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/iOperators.cpp b/llvm/lib/VMCore/iOperators.cpp
index bc37df5cb7f..f520ff52f5b 100644
--- a/llvm/lib/VMCore/iOperators.cpp
+++ b/llvm/lib/VMCore/iOperators.cpp
@@ -6,6 +6,7 @@
#include "llvm/iOperators.h"
#include "llvm/Type.h"
+#include "llvm/Constants.h"
using std::cerr;
//===----------------------------------------------------------------------===//
@@ -40,6 +41,18 @@ BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2,
}
}
+BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name) {
+ return new GenericBinaryInst(Instruction::Sub,
+ Constant::getNullValue(Op->getType()), Op, Name);
+}
+
+BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name) {
+ return new GenericBinaryInst(Instruction::Xor, Op,
+ ConstantIntegral::getAllOnesValue(Op->getType()),
+ Name);
+}
+
+
// swapOperands - Exchange the two operands to this instruction. This
// instruction is safe to use on any binary instruction and does not
// modify the semantics of the instruction. If the instruction is
OpenPOWER on IntegriCloud