Add multiply as a supported constant propogation operation

Include the LevelChange.h header in AllOpts.h

llvm-svn: 211
This commit is contained in:
Chris Lattner 2001-07-20 19:14:41 +00:00
parent 64a234bc26
commit e3d4a4fa44
2 changed files with 12 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