Commit e450656d by Jim Stichnoth

Subzero: Improve lowering of rematerializable call args.

Normally, if a call argument is a rematerializable Variable, it is rematerialized into a GPR (via the "lea" instruction) and then written into the appropriate arg space. This is appropriate for arguments passed on the stack, but for register arguments, it forces an unnecessary copy through another register. This CL allows that intermediate register copy to be removed. The resulting code looks cleaner, but it is unlikely to have much effect on performance - there really aren't register pressure issues because lots of scratch registers are available right before the call (which kills all scratch registers). BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/2080443002 .
parent 26c43064
...@@ -2618,7 +2618,8 @@ void TargetX86Base<TraitsType>::lowerCall(const InstCall *Instr) { ...@@ -2618,7 +2618,8 @@ void TargetX86Base<TraitsType>::lowerCall(const InstCall *Instr) {
// Materialize moves for arguments passed in GPRs. // Materialize moves for arguments passed in GPRs.
for (SizeT i = 0, NumGprArgs = GprArgs.size(); i < NumGprArgs; ++i) { for (SizeT i = 0, NumGprArgs = GprArgs.size(); i < NumGprArgs; ++i) {
const Type SignatureTy = GprArgs[i].first; const Type SignatureTy = GprArgs[i].first;
Operand *Arg = legalize(GprArgs[i].second); Operand *Arg =
legalize(GprArgs[i].second, Legal_Default | Legal_Rematerializable);
GprArgs[i].second = GprArgs[i].second =
legalizeToReg(Arg, Traits::getRegisterForGprArgNum(Arg->getType(), i)); legalizeToReg(Arg, Traits::getRegisterForGprArgNum(Arg->getType(), i));
assert(SignatureTy == IceType_i64 || SignatureTy == IceType_i32); assert(SignatureTy == IceType_i64 || SignatureTy == IceType_i32);
......
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