aboutsummaryrefslogtreecommitdiff
path: root/backend/backendconvert.icl
diff options
context:
space:
mode:
authormartinw2000-10-04 15:13:36 +0000
committermartinw2000-10-04 15:13:36 +0000
commit09ffb02f9a682e8278987e9803817107d4124de4 (patch)
tree995f984abf4db9fbae822f7c22f2aa9a4db1f3fc /backend/backendconvert.icl
parentadded new function to print function names like "c;102;13" as "comprehesion [... (diff)
-added position information for let bindings for better error messages
(changes are commented with "MW0") git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@248 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backend/backendconvert.icl')
-rw-r--r--backend/backendconvert.icl33
1 files changed, 22 insertions, 11 deletions
diff --git a/backend/backendconvert.icl b/backend/backendconvert.icl
index e998a46..af8e1f8 100644
--- a/backend/backendconvert.icl
+++ b/backend/backendconvert.icl
@@ -535,13 +535,17 @@ instance declareVars FreeVar where
declareVars freeVar (_, varHeap)
= declareVariable BELhsNodeId freeVar.fv_info_ptr freeVar.fv_name.id_name varHeap
-instance declareVars (Bind Expression FreeVar) where
- declareVars :: (Bind Expression FreeVar) !DeclVarsInput -> BackEnder
- declareVars {bind_src=App {app_symb, app_args=[Var _:_]}, bind_dst=freeVar} (aliasDummyId, varHeap)
+// MW0instance declareVars (Bind Expression FreeVar) where
+instance declareVars LetBind where
+// MW0 declareVars :: (Bind Expression FreeVar) !DeclVarsInput -> BackEnder
+ declareVars :: LetBind !DeclVarsInput -> BackEnder
+// MW0 declareVars {bind_src=App {app_symb, app_args=[Var _:_]}, bind_dst=freeVar} (aliasDummyId, varHeap)
+ declareVars {lb_src=App {app_symb, app_args=[Var _:_]}, lb_dst=freeVar} (aliasDummyId, varHeap)
| app_symb.symb_name==aliasDummyId
= identity // we have an alias. Don't declare the same variable twice
= declareVariable BERhsNodeId freeVar.fv_info_ptr freeVar.fv_name.id_name varHeap
- declareVars {bind_dst=freeVar} (_, varHeap)
+// MW0 declareVars {bind_dst=freeVar} (_, varHeap)
+ declareVars {lb_dst=freeVar} (_, varHeap)
= declareVariable BERhsNodeId freeVar.fv_info_ptr freeVar.fv_name.id_name varHeap
declareVariable :: Int (Ptr VarInfo) {#Char} VarHeap -> BackEnder
@@ -1244,13 +1248,15 @@ defineLhsNodeDef freeVar pattern nodeDefs varHeap
(beNodeDef variable_sequence_number (convertPattern pattern varHeap))
(return nodeDefs) be
-collectNodeDefs :: Ident Expression -> [Bind Expression FreeVar]
+// MW0 collectNodeDefs :: Ident Expression -> [Bind Expression FreeVar]
+collectNodeDefs :: Ident Expression -> [LetBind]
collectNodeDefs aliasDummyId (Let {let_strict_binds, let_lazy_binds})
= filterStrictAlias let_strict_binds let_lazy_binds
where
filterStrictAlias [] let_lazy_binds
= let_lazy_binds
- filterStrictAlias [strict_bind=:{bind_src=App app}:strict_binds] let_lazy_binds
+// MW0 filterStrictAlias [strict_bind=:{bind_src=App app}:strict_binds] let_lazy_binds
+ filterStrictAlias [strict_bind=:{lb_src=App app}:strict_binds] let_lazy_binds
| app.app_symb.symb_name==aliasDummyId
// the compiled source was a strict alias like "#! x = y"
= case hd app.app_args of
@@ -1259,7 +1265,8 @@ collectNodeDefs aliasDummyId (Let {let_strict_binds, let_lazy_binds})
-> filterStrictAlias strict_binds let_lazy_binds
hd_app_args
// the node is not an alias anymore: remove just the _dummyForStrictAlias call
- -> [{ strict_bind & bind_src = hd_app_args } : filterStrictAlias strict_binds let_lazy_binds]
+// MW0 -> [{ strict_bind & bind_src = hd_app_args } : filterStrictAlias strict_binds let_lazy_binds]
+ -> [{ strict_bind & lb_src = hd_app_args } : filterStrictAlias strict_binds let_lazy_binds]
filterStrictAlias [strict_bind:strict_binds] let_lazy_binds
= [strict_bind: filterStrictAlias strict_binds let_lazy_binds]
collectNodeDefs _ _
@@ -1269,18 +1276,22 @@ convertRhsNodeDefs :: Ident Expression Int VarHeap -> BEMonad BENodeDefP
convertRhsNodeDefs aliasDummyId expr main_dcl_module_n varHeap
= convertNodeDefs (collectNodeDefs aliasDummyId expr) varHeap
where
- convertNodeDefs :: [Bind Expression FreeVar] VarHeap -> BEMonad BENodeDefP
+// MW0 convertNodeDefs :: [Bind Expression FreeVar] VarHeap -> BEMonad BENodeDefP
+ convertNodeDefs :: [LetBind] VarHeap -> BEMonad BENodeDefP
convertNodeDefs binds varHeap
= sfoldr (beNodeDefs o flip convertNodeDef varHeap) beNoNodeDefs binds
where
- convertNodeDef :: !(Bind Expression FreeVar) VarHeap -> BEMonad BENodeDefP
- convertNodeDef {bind_src=expr, bind_dst=freeVar} varHeap
+// MW0 convertNodeDef :: !(Bind Expression FreeVar) VarHeap -> BEMonad BENodeDefP
+ convertNodeDef :: !LetBind VarHeap -> BEMonad BENodeDefP
+// MW0 convertNodeDef {bind_src=expr, bind_dst=freeVar} varHeap
+ convertNodeDef {lb_src=expr, lb_dst=freeVar} varHeap
= \be0 -> let (variable_sequence_number,be) = getVariableSequenceNumber freeVar.fv_info_ptr varHeap be0 in
beNodeDef variable_sequence_number (convertExpr expr main_dcl_module_n varHeap) be
collectStrictNodeIds :: Expression -> [FreeVar]
collectStrictNodeIds (Let {let_strict_binds, let_expr})
- = [bind_dst \\ {bind_dst} <- let_strict_binds]
+// MW0 = [bind_dst \\ {bind_dst} <- let_strict_binds]
+ = [lb_dst \\ {lb_dst} <- let_strict_binds]
collectStrictNodeIds _
= []