From 37323ea050c72aab86f01de04374844c8f66c3a2 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 9 Apr 2008 20:41:43 +0000 Subject: [PATCH] add pointers to the wiki for the rules about C prototypes --- compiler/cmm/CLabel.hs | 6 ++---- compiler/cmm/PprC.hs | 3 +++ includes/StgMiscClosures.h | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index a3c2634..f9a94b7 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -446,6 +446,8 @@ entryLblToInfoLbl l = pprPanic "CLabel.entryLblToInfoLbl" (pprCLabel l) -- ----------------------------------------------------------------------------- -- Does a CLabel need declaring before use or not? +-- +-- See wiki:Commentary/Compiler/Backends/PprC#Prototypes needsCDecl :: CLabel -> Bool -- False <=> it's pre-declared; don't bother @@ -463,10 +465,6 @@ needsCDecl ModuleRegdLabel = False needsCDecl (StringLitLabel _) = False needsCDecl (AsmTempLabel _) = False needsCDecl (RtsLabel _) = False - -- RTS labels are declared in RTS header files. Otherwise we'd need - -- to give types for each label reference in the RTS .cmm files - -- somehow; when generating .cmm code we know the types of labels (info, - -- entry etc.) but for hand-written .cmm code we don't. needsCDecl l@(ForeignLabel _ _ _) = not (isMathFun l) needsCDecl (CC_Label _) = True needsCDecl (CCS_Label _) = True diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index e46e0e7..8a2da23 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -16,6 +16,8 @@ -- -- Print Cmm as real C, for -fvia-C -- +-- See wiki:Commentary/Compiler/Backends/PprC +-- -- This is simpler than the old PprAbsC, because Cmm is "macro-expanded" -- relative to the old AbstractC, and many oddities/decorations have -- disappeared from the data type. @@ -206,6 +208,7 @@ pprStmt stmt = case stmt of where ppr_fn = parens (cCast (pprCFunType (char '*') cconv results args) fn) + -- See wiki:Commentary/Compiler/Backends/PprC#Prototypes maybe_proto = case fn of CmmLit (CmmLabel lbl) | not (isMathFun lbl) -> diff --git a/includes/StgMiscClosures.h b/includes/StgMiscClosures.h index 756e2b6..10e4638 100644 --- a/includes/StgMiscClosures.h +++ b/includes/StgMiscClosures.h @@ -8,6 +8,8 @@ * our Cmm code generator doesn't know how to generate local symbols * for the RTS bits (it assumes all RTS symbols are external). * + * See wiki:Commentary/Compiler/Backends/PprC#Prototypes + * * --------------------------------------------------------------------------*/ #ifndef STGMISCCLOSURES_H -- 1.7.10.4