From: sewardj Date: Thu, 13 Jan 2000 15:22:58 +0000 (+0000) Subject: [project @ 2000-01-13 15:22:58 by sewardj] X-Git-Tag: Approximately_9120_patches~5298 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e929d7b06933c1daa80dbeee3f1318bf363fc73e;p=ghc-hetmet.git [project @ 2000-01-13 15:22:58 by sewardj] gentopcode: handle CClosureTbl. --- diff --git a/ghc/compiler/nativeGen/AbsCStixGen.lhs b/ghc/compiler/nativeGen/AbsCStixGen.lhs index 7c943b4..df6ea2e 100644 --- a/ghc/compiler/nativeGen/AbsCStixGen.lhs +++ b/ghc/compiler/nativeGen/AbsCStixGen.lhs @@ -16,12 +16,14 @@ import MachMisc import AbsCUtils ( getAmodeRep, mixedTypeLocn, nonemptyAbsC, mkAbsCStmts, mkAbsCStmtList ) +import PprAbsC ( dumpRealC ) import SMRep ( fixedItblSize, rET_SMALL, rET_BIG, rET_VEC_SMALL, rET_VEC_BIG ) import Constants ( mIN_UPD_SIZE ) -import CLabel ( CLabel, mkReturnInfoLabel, mkReturnPtLabel ) +import CLabel ( CLabel, mkReturnInfoLabel, mkReturnPtLabel, + mkClosureTblLabel, mkStaticClosureLabel ) import ClosureInfo ( infoTableLabelFromCI, entryLabelFromCI, fastLabelFromCI, closureUpdReqd, staticClosureNeedsLink @@ -33,10 +35,13 @@ import PrimRep ( isFloatingRep, PrimRep(..) ) import StixInfo ( genCodeInfoTable, genBitmapInfoTable ) import StixMacro ( macroCode, checkCode ) import StixPrim ( primCode, amodeToStix, amodeToStix' ) +import Outputable ( pprPanic ) import UniqSupply ( returnUs, thenUs, mapUs, getUniqueUs, UniqSM ) import Util ( naturalMergeSortLe ) import Panic ( panic ) +import TyCon ( tyConDataCons ) import BitSet ( intBS ) +import Name ( NamedThing(..) ) #ifdef REALLY_HASKELL_1_3 ord = fromEnum :: Char -> Int @@ -138,6 +143,13 @@ Here we handle top-level things, like @CCodeBlock@s and map (StInt . toInteger . intBS) mask) ] + gentopcode stmt@(CClosureTbl tycon) + = returnUs [ StSegment TextSegment + , StLabel (mkClosureTblLabel tycon) + , StData DataPtrRep (map (StCLbl . mkStaticClosureLabel . getName) + (tyConDataCons tycon) ) + ] + gentopcode absC = gencode absC `thenUs` \ code -> returnUs (StSegment TextSegment : code []) @@ -406,6 +418,8 @@ Finally, all of the disgusting AbstractC macros. gencode (CCallProfCCMacro macro _) = returnUs (\xs -> StComment macro : xs) + gencode other + = pprPanic "AbsCStixGen.gencode" (dumpRealC other) \end{code} Here, we generate a jump table if there are more than four (integer)