X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcodeGen%2FCgUtils.hs;h=ab39080c16ed325afb9b0db2cedc5e1213f0bc0e;hb=84923cc7de2a93c22a2f72daf9ac863959efae13;hp=2f69927db00e7c891057d35854ce0a579ea69751;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/codeGen/CgUtils.hs b/compiler/codeGen/CgUtils.hs index 2f69927..ab39080 100644 --- a/compiler/codeGen/CgUtils.hs +++ b/compiler/codeGen/CgUtils.hs @@ -2,7 +2,7 @@ -- -- Code generator utilities; mostly monadic -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -34,33 +34,29 @@ module CgUtils ( #include "HsVersions.h" import CgMonad -import TyCon ( TyCon, tyConName ) -import Id ( Id ) -import Constants ( wORD_SIZE ) -import SMRep ( CgRep, StgWord, hALF_WORD_SIZE_IN_BITS, ByteOff, - WordOff, idCgRep ) +import TyCon +import Id +import Constants +import SMRep import PprCmm ( {- instances -} ) import Cmm import CLabel import CmmUtils -import MachOp ( MachRep(..), wordRep, MachOp(..), MachHint(..), - mo_wordOr, mo_wordAnd, mo_wordNe, mo_wordEq, - mo_wordULt, mo_wordUGt, mo_wordUGe, machRepByteWidth ) -import ForeignCall ( CCallConv(..) ) -import Literal ( Literal(..) ) -import CLabel ( CLabel, mkStringLitLabel ) -import Digraph ( SCC(..), stronglyConnComp ) -import ListSetOps ( assocDefault ) -import Util ( filterOut, sortLe ) -import DynFlags ( DynFlags(..), HscTarget(..) ) -import Packages ( HomeModules ) -import FastString ( LitString, FastString, bytesFS ) +import MachOp +import ForeignCall +import Literal +import Digraph +import ListSetOps +import Util +import DynFlags +import FastString +import PackageConfig import Outputable -import Char ( ord ) -import DATA_BITS -import DATA_WORD ( Word8 ) -import Maybe ( isNothing ) +import Data.Char +import Data.Bits +import Data.Word +import Data.Maybe ------------------------------------------------------------------------- -- @@ -213,11 +209,11 @@ addToMemE rep ptr n -- ------------------------------------------------------------------------- -tagToClosure :: HomeModules -> TyCon -> CmmExpr -> CmmExpr -tagToClosure hmods tycon tag +tagToClosure :: PackageId -> TyCon -> CmmExpr -> CmmExpr +tagToClosure this_pkg tycon tag = CmmLoad (cmmOffsetExprW closure_tbl tag) wordRep where closure_tbl = CmmLit (CmmLabel lbl) - lbl = mkClosureTableLabel hmods (tyConName tycon) + lbl = mkClosureTableLabel this_pkg (tyConName tycon) ------------------------------------------------------------------------- -- @@ -488,7 +484,6 @@ mk_switch tag_expr branches mb_deflt lo_tag hi_tag via_C -- a 2-branch switch always turns into an if. small = n_tags <= 4 dense = n_branches > (n_tags `div` 2) - exhaustive = n_tags == n_branches n_branches = length branches -- ignore default slots at each end of the range if there's