mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-21 19:20:50 +00:00
Add support for constant propogation of multiplies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
622f740a7d
commit
b5bcbc3bef
@ -42,6 +42,11 @@ class TemplateRules : public ConstRules {
|
||||
return SubClassName::Sub((const ArgType *)V1, (const ArgType *)V2);
|
||||
}
|
||||
|
||||
virtual ConstPoolVal *mul(const ConstPoolVal *V1,
|
||||
const ConstPoolVal *V2) const {
|
||||
return SubClassName::Mul((const ArgType *)V1, (const ArgType *)V2);
|
||||
}
|
||||
|
||||
virtual ConstPoolBool *lessthan(const ConstPoolVal *V1,
|
||||
const ConstPoolVal *V2) const {
|
||||
return SubClassName::LessThan((const ArgType *)V1, (const ArgType *)V2);
|
||||
@ -56,11 +61,12 @@ class TemplateRules : public ConstRules {
|
||||
inline static ConstPoolVal *Add(const ArgType *V1, const ArgType *V2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline static ConstPoolVal *Sub(const ArgType *V1, const ArgType *V2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline static ConstPoolVal *Mul(const ArgType *V1, const ArgType *V2) {
|
||||
return 0;
|
||||
}
|
||||
inline static ConstPoolBool *LessThan(const ArgType *V1, const ArgType *V2) {
|
||||
return 0;
|
||||
}
|
||||
@ -138,6 +144,13 @@ struct DirectRules
|
||||
return new ConstPoolClass(*Ty, Result);
|
||||
}
|
||||
|
||||
inline static ConstPoolVal *Mul(const ConstPoolClass *V1,
|
||||
const ConstPoolClass *V2) {
|
||||
BuiltinType Result = (BuiltinType)V1->getValue() *
|
||||
(BuiltinType)V2->getValue();
|
||||
return new ConstPoolClass(*Ty, Result);
|
||||
}
|
||||
|
||||
inline static ConstPoolBool *LessThan(const ConstPoolClass *V1,
|
||||
const ConstPoolClass *V2) {
|
||||
bool Result = (BuiltinType)V1->getValue() < (BuiltinType)V2->getValue();
|
||||
|
Loading…
x
Reference in New Issue
Block a user