Mostly-fix Trac #2595: updates for existentials
[ghc-hetmet.git] / compiler / cmm / CLabel.hs
index 3c06129..0c3c007 100644 (file)
@@ -90,6 +90,7 @@ module CLabel (
 
        mkForeignLabel,
         addLabelSize,
 
        mkForeignLabel,
         addLabelSize,
+        foreignLabelStdcallInfo,
 
        mkCCLabel, mkCCSLabel,
 
 
        mkCCLabel, mkCCSLabel,
 
@@ -111,6 +112,8 @@ module CLabel (
        pprCLabel
     ) where
 
        pprCLabel
     ) where
 
+#include "HsVersions.h"
+
 import StaticFlags
 import Packages
 import DataCon
 import StaticFlags
 import Packages
 import DataCon
@@ -370,6 +373,10 @@ addLabelSize (ForeignLabel str _ is_dynamic) sz
 addLabelSize label _
   = label
 
 addLabelSize label _
   = label
 
+foreignLabelStdcallInfo :: CLabel -> Maybe Int
+foreignLabelStdcallInfo (ForeignLabel _ info _) = info
+foreignLabelStdcallInfo _lbl = Nothing
+
        -- Cost centres etc.
 
 mkCCLabel      cc              = CC_Label cc
        -- Cost centres etc.
 
 mkCCLabel      cc              = CC_Label cc
@@ -493,8 +500,16 @@ isMathFun (ForeignLabel fs _ _) = fs `elem` math_funs
         (fsLit "cosf"),   (fsLit "tanf"),  (fsLit "sinhf"),
         (fsLit "coshf"),  (fsLit "tanhf"), (fsLit "asinf"),
         (fsLit "acosf"),  (fsLit "atanf"), (fsLit "logf"),
         (fsLit "cosf"),   (fsLit "tanf"),  (fsLit "sinhf"),
         (fsLit "coshf"),  (fsLit "tanhf"), (fsLit "asinf"),
         (fsLit "acosf"),  (fsLit "atanf"), (fsLit "logf"),
-        (fsLit "expf"),   (fsLit "sqrtf")
-   ]
+        (fsLit "expf"),   (fsLit "sqrtf"), (fsLit "frexp"),
+        (fsLit "modf"),   (fsLit "ilogb"), (fsLit "copysign"),
+        (fsLit "remainder"), (fsLit "nextafter"), (fsLit "logb"),
+        (fsLit "cbrt"),   (fsLit "atanh"), (fsLit "asinh"),
+        (fsLit "acosh"),  (fsLit "lgamma"),(fsLit "hypot"),
+        (fsLit "erfc"),   (fsLit "erf"),   (fsLit "trunc"),
+        (fsLit "round"),  (fsLit "fmod"),  (fsLit "floor"),
+        (fsLit "fabs"),   (fsLit "ceil"),  (fsLit "log10"),
+        (fsLit "ldexp"),  (fsLit "atan2"), (fsLit "rint")
+    ]
 isMathFun _ = False
 
 -- -----------------------------------------------------------------------------
 isMathFun _ = False
 
 -- -----------------------------------------------------------------------------
@@ -513,6 +528,8 @@ externallyVisibleCLabel (PlainModuleInitLabel _)= True
 externallyVisibleCLabel ModuleRegdLabel    = False
 externallyVisibleCLabel (RtsLabel _)      = True
 externallyVisibleCLabel (ForeignLabel _ _ _) = True
 externallyVisibleCLabel ModuleRegdLabel    = False
 externallyVisibleCLabel (RtsLabel _)      = True
 externallyVisibleCLabel (ForeignLabel _ _ _) = True
+externallyVisibleCLabel (IdLabel name SRT)   = False
+                         -- SRTs don't need to be external
 externallyVisibleCLabel (IdLabel name _)     = isExternalName name
 externallyVisibleCLabel (CC_Label _)      = True
 externallyVisibleCLabel (CCS_Label _)     = True
 externallyVisibleCLabel (IdLabel name _)     = isExternalName name
 externallyVisibleCLabel (CC_Label _)      = True
 externallyVisibleCLabel (CCS_Label _)     = True