aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/InstSelectSimple.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-05-12 16:35:04 +0000
committerChris Lattner <sabre@nondot.org>2004-05-12 16:35:04 +0000
commit2b10b08ad623148fd6f7dcb7f2436bbe866c36d1 (patch)
tree2b4063a1b3519250b748d049664186a7d5a528b6 /lib/Target/X86/InstSelectSimple.cpp
parent587992721c3112c94000722941748cf46cd0bce6 (diff)
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
Diffstat (limited to 'lib/Target/X86/InstSelectSimple.cpp')
-rw-r--r--lib/Target/X86/InstSelectSimple.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp
index 8fbeeb7f2e..cba90bbb96 100644
--- a/lib/Target/X86/InstSelectSimple.cpp
+++ b/lib/Target/X86/InstSelectSimple.cpp
@@ -1207,7 +1207,7 @@ void ISel::promote32(unsigned targetReg, const ValueRecord &VR) {
// copy.
if (ConstantInt *CI = dyn_cast<ConstantInt>(Val)) {
int TheVal = CI->getRawValue() & 0xFFFFFFFF;
- BuildMI(BB, X86::MOV32ri, 1, targetReg).addImm(TheVal);
+ BuildMI(BB, X86::MOV32ri, 1, targetReg).addImm(TheVal);
return;
}
}
@@ -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.