[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Dec 4 17:46:00 PST 2002


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.50 -> 1.51

---
Log message:

Implement initial support for return values from call instructions


---
Diffs of the changes:

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.50 llvm/lib/Target/X86/InstSelectSimple.cpp:1.51
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.50	Wed Dec  4 13:22:53 2002
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Wed Dec  4 17:45:28 2002
@@ -430,6 +430,20 @@
   // 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...





More information about the llvm-commits mailing list