Don't expose the cas definition to .hc files
authorIan Lynagh <igloo@earth.li>
Sat, 30 Apr 2011 11:03:28 +0000 (12:03 +0100)
committerIan Lynagh <igloo@earth.li>
Sat, 30 Apr 2011 11:03:28 +0000 (12:03 +0100)
This is more pleasant than having the C generator check whether the
function it's calling is cas, and not generate a prototype if so.

compiler/cmm/CLabel.hs
compiler/cmm/PprC.hs
includes/stg/SMP.h

index 901b13b..c62f0ea 100644 (file)
@@ -101,7 +101,7 @@ module CLabel (
         hasCAF,
        infoLblToEntryLbl, entryLblToInfoLbl, cvtToClosureLbl, cvtToSRTLbl,
        needsCDecl, isAsmTemp, maybeAsmTemp, externallyVisibleCLabel,
-        isMathFun, isCas,
+        isMathFun,
        isCFunctionLabel, isGcPtrLabel, labelDynamic,
 
        pprCLabel
@@ -590,14 +590,6 @@ maybeAsmTemp (AsmTempLabel uq)             = Just uq
 maybeAsmTemp _                                 = Nothing
 
 
--- | Check whether a label corresponds to our cas function.
---      We #include the prototype for this, so we need to avoid
---      generating out own C prototypes.
-isCas :: CLabel -> Bool
-isCas (CmmLabel pkgId fn _) = pkgId == rtsPackageId && fn == fsLit "cas"
-isCas _                     = False
-
-
 -- | Check whether a label corresponds to a C function that has 
 --      a prototype in a system header somehere, or is built-in
 --      to the C compiler. For these labels we avoid generating our
index d363cef..10f4e8b 100644 (file)
@@ -248,7 +248,7 @@ pprStmt stmt = case stmt of
                 | CmmNeverReturns <- ret ->
                     let myCall = pprCall (pprCLabel lbl) cconv results args safety
                     in (real_fun_proto lbl, myCall)
-                | not (isMathFun lbl || isCas lbl) ->
+                | not (isMathFun lbl) ->
                     let myCall = braces (
                                      pprCFunType (char '*' <> text "ghcFunPtr") cconv results args <> semi
                                   $$ text "ghcFunPtr" <+> equals <+> cast_fn <> semi
index f1b0422..52fd6f1 100644 (file)
@@ -306,6 +306,7 @@ load_load_barrier(void) {
 #define store_load_barrier() /* nothing */
 #define load_load_barrier()  /* nothing */
 
+#if !IN_STG_CODE || IN_STGCRUN
 INLINE_HEADER StgWord
 xchg(StgPtr p, StgWord w)
 {
@@ -337,6 +338,7 @@ atomic_dec(StgVolatilePtr p)
 {
     return --(*p);
 }
+#endif
 
 #define VOLATILE_LOAD(p) ((StgWord)*((StgWord*)(p)))