Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Show First 20 Lines • Show All 1,380 Lines • ▼ Show 20 Lines | void Cost::RateFormula(const Formula &F, | ||||
// If we don't count instruction cost exit here. | // If we don't count instruction cost exit here. | ||||
if (!InsnsCost) { | if (!InsnsCost) { | ||||
assert(isValid() && "invalid cost"); | assert(isValid() && "invalid cost"); | ||||
return; | return; | ||||
} | } | ||||
// Treat every new register that exceeds TTI.getNumberOfRegisters() - 1 as | // Treat every new register that exceeds TTI.getNumberOfRegisters() - 1 as | ||||
// additional instruction (at least fill). | // additional instruction (at least fill). | ||||
unsigned TTIRegNum = TTI->getNumberOfRegisters(false) - 1; | // TODO: Need distinguish register class? | ||||
unsigned TTIRegNum = TTI->getNumberOfRegisters( | |||||
hfinkel: This can be:
unsigned TTIRegNum = TTI->getNumberOfRegisters(TTI->getRegisterClassForType(F. | |||||
TTI->getRegisterClassForType(F.getType(), false)) - 1; | |||||
if (C.NumRegs > TTIRegNum) { | if (C.NumRegs > TTIRegNum) { | ||||
// Cost already exceeded TTIRegNum, then only newly added register can add | // Cost already exceeded TTIRegNum, then only newly added register can add | ||||
// new instructions. | // new instructions. | ||||
if (PrevNumRegs > TTIRegNum) | if (PrevNumRegs > TTIRegNum) | ||||
C.Insns += (C.NumRegs - PrevNumRegs); | C.Insns += (C.NumRegs - PrevNumRegs); | ||||
else | else | ||||
C.Insns += (C.NumRegs - TTIRegNum); | C.Insns += (C.NumRegs - TTIRegNum); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 4,374 Lines • Show Last 20 Lines |
This can be: