mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-29 13:24:25 +00:00
Pass boolean constants into function calls more efficiently, generating:
mov DWORD PTR [%ESP + 4], 1 instead of: mov %EAX, 1 mov DWORD PTR [%ESP + 4], %EAX git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13494 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1405,6 +1405,12 @@ void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI,
|
|||||||
unsigned ArgReg;
|
unsigned ArgReg;
|
||||||
switch (getClassB(Args[i].Ty)) {
|
switch (getClassB(Args[i].Ty)) {
|
||||||
case cByte:
|
case cByte:
|
||||||
|
if (Args[i].Val && isa<ConstantBool>(Args[i].Val)) {
|
||||||
|
addRegOffset(BuildMI(BB, X86::MOV32mi, 5), X86::ESP, ArgOffset)
|
||||||
|
.addImm(Args[i].Val == ConstantBool::True);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// FALL THROUGH
|
||||||
case cShort:
|
case cShort:
|
||||||
if (Args[i].Val && isa<ConstantInt>(Args[i].Val)) {
|
if (Args[i].Val && isa<ConstantInt>(Args[i].Val)) {
|
||||||
// Zero/Sign extend constant, then stuff into memory.
|
// Zero/Sign extend constant, then stuff into memory.
|
||||||
|
@ -1405,6 +1405,12 @@ void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI,
|
|||||||
unsigned ArgReg;
|
unsigned ArgReg;
|
||||||
switch (getClassB(Args[i].Ty)) {
|
switch (getClassB(Args[i].Ty)) {
|
||||||
case cByte:
|
case cByte:
|
||||||
|
if (Args[i].Val && isa<ConstantBool>(Args[i].Val)) {
|
||||||
|
addRegOffset(BuildMI(BB, X86::MOV32mi, 5), X86::ESP, ArgOffset)
|
||||||
|
.addImm(Args[i].Val == ConstantBool::True);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// FALL THROUGH
|
||||||
case cShort:
|
case cShort:
|
||||||
if (Args[i].Val && isa<ConstantInt>(Args[i].Val)) {
|
if (Args[i].Val && isa<ConstantInt>(Args[i].Val)) {
|
||||||
// Zero/Sign extend constant, then stuff into memory.
|
// Zero/Sign extend constant, then stuff into memory.
|
||||||
|
Reference in New Issue
Block a user