needsCDecl, isReadOnly, isAsmTemp, externallyVisibleCLabel,
pprCLabel
-
-#ifdef GRAN
- , isSlowEntryCCodeBlock
+#if ! OMIT_NATIVE_CODEGEN
+ , pprCLabel_asm
#endif
-
- -- and to make the interface self-sufficient...
) where
import Ubiq{-uitous-}
+import AbsCLoop ( CtrlReturnConvention(..),
+ ctrlReturnConvAlg
+ )
+#if ! OMIT_NATIVE_CODEGEN
+import NcgLoop ( underscorePrefix, fmtAsmLbl )
+#endif
+import CStrings ( pp_cSEP )
import Id ( externallyVisibleId, cmpId_withSpecDataCon,
isDataCon, isDictFunId,
- isConstMethodId_maybe, isClassOpId,
+ isConstMethodId_maybe,
isDefaultMethodId_maybe,
isSuperDictSelId_maybe, fIRST_TAG,
- DataCon(..), ConTag(..), Id
+ ConTag(..), GenId{-instance Outputable-}
)
import Maybes ( maybeToBool )
+import PprStyle ( PprStyle(..) )
+import PprType ( showTyCon, GenType{-instance Outputable-} )
+import Pretty ( prettyToUn )
+import TyCon ( TyCon{-instance Eq-} )
+import Unique ( showUnique, pprUnique, Unique{-instance Eq-} )
import Unpretty -- NOTE!! ********************
-{-
-import Outputable
-import Pretty ( ppNil, ppChar, ppStr, ppPStr, ppDouble, ppInt,
- ppInteger, ppBeside, ppIntersperse, prettyToUn
- )
-#ifdef USE_ATTACK_PRAGMAS
-import CharSeq
-#endif
-import Unique ( pprUnique, showUnique, Unique )
-import Util
-
--- Sigh... Shouldn't this file (CLabel) live in codeGen?
-import CgRetConv ( CtrlReturnConvention(..), ctrlReturnConvAlg )
--}
+import Util ( assertPanic )
\end{code}
things we want to find out:
| isDataCon id = True
| is_ConstMethodId id = True -- These are here to ensure splitting works
| isDictFunId id = True -- when these values have not been exported
- | isClassOpId id = True
| is_DefaultMethodId id = True
| is_SuperDictSelId id = True
| otherwise = externallyVisibleId id
where
- is_ConstMethodId id = maybeToBool (isConstMethodId_maybe id)
+ is_ConstMethodId id = maybeToBool (isConstMethodId_maybe id)
is_DefaultMethodId id = maybeToBool (isDefaultMethodId_maybe id)
- is_SuperDictSelId id = maybeToBool (isSuperDictSelId_maybe id)
+ is_SuperDictSelId id = maybeToBool (isSuperDictSelId_maybe id)
\end{code}
-These GRAN functions are needed for spitting out GRAN_FETCH() at the
+OLD?: These GRAN functions are needed for spitting out GRAN_FETCH() at the
right places. It is used to detect when the abstractC statement of an
CCodeBlock actually contains the code for a slow entry point. -- HWL
-\begin{code}
-#ifdef GRAN
-
-isSlowEntryCCodeBlock :: CLabel -> Bool
-isSlowEntryCCodeBlock _ = False
--- Worth keeping? ToDo (WDP)
-
-#endif {-GRAN-}
-\end{code}
-
We need at least @Eq@ for @CLabels@, because we want to avoid
duplicate declarations in generating C (see @labelSeenTE@ in
@PprAbsC@).
\begin{code}
+-- specialised for PprAsm: saves lots of arg passing in NCG
+#if ! OMIT_NATIVE_CODEGEN
+pprCLabel_asm = pprCLabel (PprForAsm underscorePrefix fmtAsmLbl)
+#endif
+
pprCLabel :: PprStyle -> CLabel -> Unpretty
-pprCLabel (PprForAsm _ _ fmtAsmLbl) (AsmTempLabel u)
+pprCLabel (PprForAsm _ fmtAsmLbl) (AsmTempLabel u)
= uppStr (fmtAsmLbl (_UNPK_ (showUnique u)))
-pprCLabel (PprForAsm sw_chker prepend_cSEP _) lbl
+pprCLabel (PprForAsm prepend_cSEP _) lbl
= if prepend_cSEP
then uppBeside pp_cSEP prLbl
else prLbl
where
- prLbl = pprCLabel (PprForC sw_chker) lbl
+ prLbl = pprCLabel PprForC lbl
pprCLabel sty (TyConLabel tc UnvecConUpdCode)
= uppBesides [uppPStr SLIT("ret"), pp_cSEP, uppStr (showTyCon sty tc),
RednCounts -> uppPStr SLIT("ct")
)
\end{code}
-