From: Ian Lynagh Date: Sat, 30 Apr 2011 11:03:28 +0000 (+0100) Subject: Don't expose the cas definition to .hc files X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=470bedbbe60db2b9cc85dccafb6e06d9a841419d Don't expose the cas definition to .hc files 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. --- diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index 901b13b..c62f0ea 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -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 diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index d363cef..10f4e8b 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -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 diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h index f1b0422..52fd6f1 100644 --- a/includes/stg/SMP.h +++ b/includes/stg/SMP.h @@ -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)))