[llvm-commits] CVS: llvm/include/llvm/ConstantHandling.h
Chris Lattner
lattner at cs.uiuc.edu
Wed Jul 23 12:22:03 PDT 2003
Changes in directory llvm/include/llvm:
ConstantHandling.h updated: 1.27 -> 1.28
---
Log message:
Add support for ~ operator on constants
---
Diffs of the changes:
Index: llvm/include/llvm/ConstantHandling.h
diff -u llvm/include/llvm/ConstantHandling.h:1.27 llvm/include/llvm/ConstantHandling.h:1.28
--- llvm/include/llvm/ConstantHandling.h:1.27 Sat Jun 21 22:07:32 2003
+++ llvm/include/llvm/ConstantHandling.h Wed Jul 23 12:21:17 2003
@@ -125,6 +125,12 @@
ConstRules &operator=(const ConstRules &); // Do not implement
};
+// Unary operators...
+inline Constant *operator~(const Constant &V) {
+ assert(V.getType()->isIntegral() && "Cannot invert non-intergral constant!");
+ return ConstRules::get(V, V)->op_xor(&V,
+ ConstantInt::getAllOnesValue(V.getType()));
+}
// Standard binary operators...
inline Constant *operator+(const Constant &V1, const Constant &V2) {
More information about the llvm-commits
mailing list