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

llvm-svn: 13494
This commit is contained in:
Chris Lattner 2004-05-12 16:35:04 +00:00
parent 66219abac7
commit e2d382e1a4
1 changed files with 7 additions and 1 deletions

View File

@ -1405,6 +1405,12 @@ void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI,
unsigned ArgReg;
switch (getClassB(Args[i].Ty)) {
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:
if (Args[i].Val && isa<ConstantInt>(Args[i].Val)) {
// Zero/Sign extend constant, then stuff into memory.