aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ConstantFold.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-04 23:37:40 +0000
committerChris Lattner <sabre@nondot.org>2003-11-04 23:37:40 +0000
commitd5e4918fa77bf413b020735fa81fc160b43a5d0c (patch)
tree7c658a8fdd4f92085554e78fbf950c7739979366 /lib/VMCore/ConstantFold.h
parent689d24b6ed709ea2dbeee5741c0b9ac8c658d92e (diff)
downloadexternal_llvm-d5e4918fa77bf413b020735fa81fc160b43a5d0c.zip
external_llvm-d5e4918fa77bf413b020735fa81fc160b43a5d0c.tar.gz
external_llvm-d5e4918fa77bf413b020735fa81fc160b43a5d0c.tar.bz2
Fix spello
Add negate overload git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9709 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.h')
-rw-r--r--lib/VMCore/ConstantFold.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/VMCore/ConstantFold.h b/lib/VMCore/ConstantFold.h
index ef19cd2..a27283c 100644
--- a/lib/VMCore/ConstantFold.h
+++ b/lib/VMCore/ConstantFold.h
@@ -134,11 +134,15 @@ private:
// Unary operators...
inline Constant *operator~(const Constant &V) {
- assert(V.getType()->isIntegral() && "Cannot invert non-intergral constant!");
+ assert(V.getType()->isIntegral() && "Cannot invert non-integral constant!");
return ConstRules::get(V, V)->op_xor(&V,
ConstantInt::getAllOnesValue(V.getType()));
}
+inline Constant *operator-(const Constant &V) {
+ return ConstRules::get(V, V)->sub(Constant::getNullValue(V.getType()), &V);
+}
+
// Standard binary operators...
inline Constant *operator+(const Constant &V1, const Constant &V2) {
assert(V1.getType() == V2.getType() && "Constant types must be identical!");