6c: reverse register allocation order to avoid having to spill AX,DX and CX

allocating AX,CX,DX last improves 64-bit multiplication-add
chains like a*b + c*d as the multiplication does not need to save
and restore AX and DX registers in most cases. reserving CX for
shifts also helps.
This commit is contained in:
cinap_lenrek 2017-01-08 17:41:10 +01:00
parent 28089ee035
commit c67d0c699f

View file

@ -343,9 +343,12 @@ regalloc(Node *n, Node *tn, Node *o)
if(i >= D_AX && i <= D_R15)
goto out;
}
for(i=D_AX; i<=D_R15; i++)
for(i=D_AX; i<=D_R15; i++){
i ^= 7;
if(reg[i] == 0 && !resvreg[i])
goto out;
i ^= 7;
}
diag(tn, "out of fixed registers");
goto err;