Skip to content

Commit 54c1954

Browse files
authored
[GlobalISel] Revise 'assignCustomValue' interface (#77824)
- Previously, 'assignCustomValue' requests the number of assigned VAs minus 1 is returned and treats 0 as the assignment failure. However, under that arrangment, we cannot tell a successful *single* VA custom assignment from the failure case. - This change requests that 'assignCustomValue' just return the number of all VAs assigned, including the first WA so that it won't be ambigous to tell the failure case from the single VA custom assignment.
1 parent a2af374 commit 54c1954

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ class CallLowering {
291291
/// \p If the handler wants the assignments to be delayed until after
292292
/// mem loc assignments, then it sets \p Thunk to the thunk to do the
293293
/// assignment.
294-
/// \return The number of \p VAs that have been assigned after the first
295-
/// one, and which should therefore be skipped from further
294+
/// \return The number of \p VAs that have been assigned including the
295+
/// first one, and which should therefore be skipped from further
296296
/// processing.
297297
virtual unsigned assignCustomValue(ArgInfo &Arg, ArrayRef<CCValAssign> VAs,
298298
std::function<void()> *Thunk = nullptr) {

llvm/lib/CodeGen/GlobalISel/CallLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ bool CallLowering::handleAssignments(ValueHandler &Handler,
694694
DelayedOutgoingRegAssignments.emplace_back(Thunk);
695695
if (!NumArgRegs)
696696
return false;
697-
j += NumArgRegs;
697+
j += (NumArgRegs - 1);
698698
continue;
699699
}
700700

llvm/lib/Target/ARM/ARMCallLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ struct ARMOutgoingValueHandler : public CallLowering::OutgoingValueHandler {
166166
assignValueToReg(NewRegs[0], VA.getLocReg(), VA);
167167
assignValueToReg(NewRegs[1], NextVA.getLocReg(), NextVA);
168168
};
169-
return 1;
169+
return 2;
170170
}
171171
assignValueToReg(NewRegs[0], VA.getLocReg(), VA);
172172
assignValueToReg(NewRegs[1], NextVA.getLocReg(), NextVA);
173-
return 1;
173+
return 2;
174174
}
175175

176176
MachineInstrBuilder MIB;
@@ -341,7 +341,7 @@ struct ARMIncomingValueHandler : public CallLowering::IncomingValueHandler {
341341

342342
MIRBuilder.buildMergeLikeInstr(Arg.Regs[0], NewRegs);
343343

344-
return 1;
344+
return 2;
345345
}
346346

347347
/// Marking a physical register as used is different between formal

llvm/lib/Target/Mips/MipsCallLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ MipsIncomingValueHandler::assignCustomValue(CallLowering::ArgInfo &Arg,
185185

186186
markPhysRegUsed(VALo.getLocReg());
187187
markPhysRegUsed(VAHi.getLocReg());
188-
return 1;
188+
return 2;
189189
}
190190

191191
namespace {

llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ struct RISCVOutgoingValueHandler : public CallLowering::OutgoingValueHandler {
146146

147147
if (Thunk) {
148148
*Thunk = assignFunc;
149-
return 1;
149+
return 2;
150150
}
151151

152152
assignFunc();
153-
return 1;
153+
return 2;
154154
}
155155

156156
private:
@@ -266,7 +266,7 @@ struct RISCVIncomingValueHandler : public CallLowering::IncomingValueHandler {
266266

267267
MIRBuilder.buildMergeLikeInstr(Arg.Regs[0], NewRegs);
268268

269-
return 1;
269+
return 2;
270270
}
271271

272272
/// How the physical register gets marked varies between formal

0 commit comments

Comments
 (0)