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
This commit is contained in:
Chris Lattner 2001-07-20 19:14:41 +00:00
parent e3ad3575b0
commit a137f87051
4 changed files with 26 additions and 0 deletions

View File

@ -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!");

View File

@ -39,4 +39,9 @@
#include "llvm/Optimizations/InductionVars.h"
//===----------------------------------------------------------------------===//
// LevelChange - Code lowering and raising
//
#include "llvm/Optimizations/LevelChange.h"
#endif

View File

@ -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!");

View File

@ -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!");