newLabel,
newFunctionName,
newImport,
-
lookupLabel,
lookupName,
import CgMonad
import CLabel
-import Cmm
+import OldCmm
-import BasicTypes
+-- import BasicTypes
import BlockId
import FastString
import Module
newLabel :: FastString -> ExtFCode BlockId
newLabel name = do
u <- code newUnique
- addLabel name (BlockId u)
- return (BlockId u)
+ addLabel name (mkBlockId u)
+ return (mkBlockId u)
-- | Add add a local function to the environment.
-- | Add an imported foreign label to the list of local declarations.
-- If this is done at the start of the module the declaration will scope
-- over the whole module.
--- CLabel's labelDynamic classifies these labels as dynamic, hence the
--- code generator emits PIC code for them.
-newImport :: (Maybe PackageId, FastString) -> ExtFCode ()
-newImport (Nothing, name)
- = addVarDecl name (CmmLit (CmmLabel (mkForeignLabel name Nothing True IsFunction)))
+newImport
+ :: (FastString, CLabel)
+ -> ExtFCode ()
+
+newImport (name, cmmLabel)
+ = addVarDecl name (CmmLit (CmmLabel cmmLabel))
-newImport (Just pkg, name)
- = addVarDecl name (CmmLit (CmmLabel (mkCmmCodeLabel pkg name)))
-- | Lookup the BlockId bound to the label with this name.
-- If one hasn't been bound yet, create a fresh one based on the
return $
case lookupUFM env name of
Just (Label l) -> l
- _other -> BlockId (newTagUnique (getUnique name) 'L')
+ _other -> mkBlockId (newTagUnique (getUnique name) 'L')
-- | Lookup the location of a named variable.