Commit 562233c8 by John Porto

Subzero. ARM32. Implements the Availability Optimization.

Implements the Availability optimization: a = b x = f(a, c) becomes a = b x = f(b, c) This only triggers if b is an infinite-weight temporary, and it prevents a potential spill at the cost of higher register pressure. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1424873003 .
parent aa0b1a17
...@@ -3477,6 +3477,21 @@ Operand *TargetARM32::legalize(Operand *From, LegalMask Allowed, ...@@ -3477,6 +3477,21 @@ Operand *TargetARM32::legalize(Operand *From, LegalMask Allowed,
// legalize() allow a physical register. Legal_Flex converts registers to the // legalize() allow a physical register. Legal_Flex converts registers to the
// right type OperandARM32FlexReg as needed. // right type OperandARM32FlexReg as needed.
assert(Allowed & Legal_Reg); assert(Allowed & Legal_Reg);
// Copied ipsis literis from TargetX86Base<Machine>.
if (RegNum == Variable::NoRegister) {
if (Variable *Subst = getContext().availabilityGet(From)) {
// At this point we know there is a potential substitution available.
if (Subst->mustHaveReg() && !Subst->hasReg()) {
// At this point we know the substitution will have a register.
if (From->getType() == Subst->getType()) {
// At this point we know the substitution's register is compatible.
return Subst;
}
}
}
}
// Go through the various types of operands: OperandARM32Mem, // Go through the various types of operands: OperandARM32Mem,
// OperandARM32Flex, Constant, and Variable. Given the above assertion, if // OperandARM32Flex, Constant, and Variable. Given the above assertion, if
// type of operand is not legal (e.g., OperandARM32Mem and !Legal_Mem), we // type of operand is not legal (e.g., OperandARM32Mem and !Legal_Mem), we
...@@ -3734,6 +3749,7 @@ void TargetARM32::postLower() { ...@@ -3734,6 +3749,7 @@ void TargetARM32::postLower() {
if (Ctx->getFlags().getOptLevel() == Opt_m1) if (Ctx->getFlags().getOptLevel() == Opt_m1)
return; return;
markRedefinitions(); markRedefinitions();
Context.availabilityUpdate();
} }
void TargetARM32::makeRandomRegisterPermutation( void TargetARM32::makeRandomRegisterPermutation(
......
...@@ -91,8 +91,8 @@ entry: ...@@ -91,8 +91,8 @@ entry:
; OPTM1: call [[TARGET]] ; OPTM1: call [[TARGET]]
; ;
; ARM32-LABEL: CallIndirectGlobal ; ARM32-LABEL: CallIndirectGlobal
; ARM32: blx [[REGISTER:r.*]] ; ARM32: blx {{r.*}}
; ARM32: blx [[REGISTER]] ; ARM32: blx [[REGISTER:r[0-9]*]]
; ARM32: blx [[REGISTER]] ; ARM32: blx [[REGISTER]]
; ARM32: blx [[REGISTER]] ; ARM32: blx [[REGISTER]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment