Add new LLVM code generator to GHC. (Version 2)
[ghc-hetmet.git] / compiler / codeGen / CgForeignCall.hs
index 879d043..ce689c4 100644 (file)
@@ -78,16 +78,9 @@ emitForeignCall results (CCall (CCallSpec target cconv safety)) args live
   where
       (call_args, cmm_target)
        = case target of
-
-          -- A target label known to be in the current package.
-          StaticTarget lbl 
-           -> ( args
-              , CmmLit (CmmLabel 
-                       (mkForeignLabel lbl call_size ForeignLabelInThisPackage IsFunction)))
-
           -- If the packageId is Nothing then the label is taken to be in the
           --   package currently being compiled.
-          PackageTarget lbl mPkgId
+          StaticTarget lbl mPkgId
            -> let labelSource 
                        = case mPkgId of
                                Nothing         -> ForeignLabelInThisPackage
@@ -129,9 +122,10 @@ emitForeignCall' safety results target args vols _srt ret
   | not (playSafe safety) = do
     temp_args <- load_args_into_temps args
     let (caller_save, caller_load) = callerSaveVolatileRegs vols
+    let caller_load' = if ret == CmmNeverReturns then [] else caller_load
     stmtsC caller_save
     stmtC (CmmCall target results temp_args CmmUnsafe ret)
-    stmtsC caller_load
+    stmtsC caller_load'
 
   | otherwise = do
     -- Both 'id' and 'new_base' are GCKindNonPtr because they're