diff options
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmmExtCode.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/codeGen/StgCmmExtCode.hs b/compiler/codeGen/StgCmmExtCode.hs index 2c36442639..5057f1c8c4 100644 --- a/compiler/codeGen/StgCmmExtCode.hs +++ b/compiler/codeGen/StgCmmExtCode.hs @@ -103,16 +103,18 @@ getEnv :: CmmParse Env getEnv = EC $ \e s -> return (s, e) +addDecl :: FastString -> Named -> ExtCode +addDecl name named = EC $ \_ s -> return ((name, named) : s, ()) + + -- | Add a new variable to the list of local declarations. -- The CmmExpr says where the value is stored. addVarDecl :: FastString -> CmmExpr -> ExtCode -addVarDecl var expr - = EC $ \_ s -> return ((var, VarN expr):s, ()) +addVarDecl var expr = addDecl var (VarN expr) -- | Add a new label to the list of local declarations. addLabel :: FastString -> BlockId -> ExtCode -addLabel name block_id - = EC $ \_ s -> return ((name, LabelN block_id):s, ()) +addLabel name block_id = addDecl name (LabelN block_id) -- | Create a fresh local variable of a given type. @@ -144,8 +146,7 @@ newFunctionName -> PackageId -- ^ package of the current module -> ExtCode -newFunctionName name pkg - = EC $ \_ s -> return ((name, FunN pkg):s, ()) +newFunctionName name pkg = addDecl name (FunN pkg) -- | Add an imported foreign label to the list of local declarations. |