diff options
author | Chris Lattner <sabre@nondot.org> | 2002-12-04 23:45:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-12-04 23:45:28 +0000 |
commit | a324364f043e462562ef3e0e40459c526ef8bd0c (patch) | |
tree | 59a4b73ef3e7f816d85dfbb34ebb6648858cd1da /lib/Target/X86/InstSelectSimple.cpp | |
parent | 06f8aecc882b90d23206233fe95b2df6078f987c (diff) |
Implement initial support for return values from call instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/InstSelectSimple.cpp')
-rw-r--r-- | lib/Target/X86/InstSelectSimple.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp index 55bf65b2f5..2f701ed8d3 100644 --- a/lib/Target/X86/InstSelectSimple.cpp +++ b/lib/Target/X86/InstSelectSimple.cpp @@ -430,6 +430,20 @@ ISel::visitCallInst (CallInst & CI) // Adjust the stack by `bytesPushed' amount if non-zero if (bytesPushed > 0) BuildMI (BB, X86::ADDri32, 2).addReg(X86::ESP).addZImm(bytesPushed); + + // If there is a return value, scavenge the result from the location the call + // leaves it in... + // + switch (getClass(CI.getType())) { + case cInt: + BuildMI(BB, X86::MOVrr32, 1, getReg(CI)).addReg(X86::EAX); + break; + + default: + std::cerr << "Cannot get return value for call of type '" + << *CI.getType() << "'\n"; + visitInstruction(CI); + } } /// visitSimpleBinary - Implement simple binary operators for integral types... |