aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ConstantHandling.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-20 19:14:41 +0000
committerChris Lattner <sabre@nondot.org>2001-07-20 19:14:41 +0000
commita137f870513d59ba4759ef5e6069a075f4934898 (patch)
treee7bab84527b97e764ebff5d76d0515d14bc57c30 /include/llvm/ConstantHandling.h
parente3ad3575b0ab0852f3a52f5a5f0cba3d45f05b43 (diff)
Add multiply as a supported constant propogation operation
Include the LevelChange.h header in AllOpts.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ConstantHandling.h')
-rw-r--r--include/llvm/ConstantHandling.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/ConstantHandling.h b/include/llvm/ConstantHandling.h
index 79dd21c2c6..de79ab3600 100644
--- a/include/llvm/ConstantHandling.h
+++ b/include/llvm/ConstantHandling.h
@@ -67,6 +67,8 @@ public:
const ConstPoolVal *V2) const = 0;
virtual ConstPoolVal *sub(const ConstPoolVal *V1,
const ConstPoolVal *V2) const = 0;
+ virtual ConstPoolVal *mul(const ConstPoolVal *V1,
+ const ConstPoolVal *V2) const = 0;
virtual ConstPoolBool *lessthan(const ConstPoolVal *V1,
const ConstPoolVal *V2) const = 0;
@@ -103,6 +105,11 @@ inline ConstPoolVal *operator-(const ConstPoolVal &V1, const ConstPoolVal &V2) {
return ConstRules::get(V1)->sub(&V1, &V2);
}
+inline ConstPoolVal *operator*(const ConstPoolVal &V1, const ConstPoolVal &V2) {
+ assert(V1.getType() == V2.getType() && "Constant types must be identical!");
+ return ConstRules::get(V1)->mul(&V1, &V2);
+}
+
inline ConstPoolBool *operator<(const ConstPoolVal &V1,
const ConstPoolVal &V2) {
assert(V1.getType() == V2.getType() && "Constant types must be identical!");