Fix handling of function calls that return void
authorChris Lattner <sabre@nondot.org>
Wed, 4 Dec 2002 23:50:28 +0000 (23:50 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 4 Dec 2002 23:50:28 +0000 (23:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4925 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/InstSelectSimple.cpp
lib/Target/X86/X86ISelSimple.cpp

index 2f701ed8d3dfaa627ed17abdf010d008a3f9b1a5..1cfa0a56af37ccbcec995c6283b9e76796588922 100644 (file)
@@ -434,15 +434,17 @@ ISel::visitCallInst (CallInst & CI)
   // 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);
+  if (CI.getType() != Type::VoidTy) {
+    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);
+    }
   }
 }
 
index 2f701ed8d3dfaa627ed17abdf010d008a3f9b1a5..1cfa0a56af37ccbcec995c6283b9e76796588922 100644 (file)
@@ -434,15 +434,17 @@ ISel::visitCallInst (CallInst & CI)
   // 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);
+  if (CI.getType() != Type::VoidTy) {
+    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);
+    }
   }
 }