diff options
author | johnvg | 2001-06-20 11:40:00 +0000 |
---|---|---|
committer | johnvg | 2001-06-20 11:40:00 +0000 |
commit | 5757b4c31ab864cc1976e286d4a7a69cf034ed76 (patch) | |
tree | 5dc701125684b5a61be2c0c4d001a1d08645657c /backend/backendconvert.icl | |
parent | optimise && and || (diff) |
optimise && and ||
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@490 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backend/backendconvert.icl')
-rw-r--r-- | backend/backendconvert.icl | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/backend/backendconvert.icl b/backend/backendconvert.icl index f769ce1..bf3d5a9 100644 --- a/backend/backendconvert.icl +++ b/backend/backendconvert.icl @@ -562,16 +562,12 @@ instance declareVars FreeVar where declareVars freeVar (_, varHeap) = declareVariable BELhsNodeId freeVar.fv_info_ptr freeVar.fv_name.id_name 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 + | not (isNilPtr app_symb.symb_name.id_info) && 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 -// MW0 declareVars {bind_dst=freeVar} (_, varHeap) declareVars {lb_dst=freeVar} (_, varHeap) = declareVariable BERhsNodeId freeVar.fv_info_ptr freeVar.fv_name.id_name varHeap @@ -605,8 +601,9 @@ instance declareVars Expression where = declareVars let_strict_binds dvInput o` declareVars let_lazy_binds dvInput o` declareVars let_expr dvInput - declareVars (Conditional {if_then, if_else}) dvInput - = declareVars if_then dvInput + declareVars (Conditional {if_cond, if_then, if_else}) dvInput + = declareVars if_cond dvInput + o` declareVars if_then dvInput o` declareVars if_else dvInput declareVars (Case caseExpr) dvInput = declareVars caseExpr dvInput @@ -1329,7 +1326,7 @@ convertRootExpr aliasDummyId (Let {let_expr}) main_dcl_module_n varHeap = convertRootExpr aliasDummyId let_expr main_dcl_module_n varHeap convertRootExpr aliasDummyId (Conditional {if_cond=cond, if_then=then, if_else=Yes else}) main_dcl_module_n varHeap = beGuardNode - (convertCondExpr cond main_dcl_module_n varHeap) + (convertRootExpr aliasDummyId cond main_dcl_module_n varHeap) (convertRhsNodeDefs aliasDummyId then main_dcl_module_n varHeap) (convertRhsStrictNodeIds then varHeap) (convertRootExpr aliasDummyId then main_dcl_module_n varHeap) @@ -1338,7 +1335,7 @@ convertRootExpr aliasDummyId (Conditional {if_cond=cond, if_then=then, if_else=Y (convertRootExpr aliasDummyId else main_dcl_module_n varHeap) convertRootExpr aliasDummyId (Conditional {if_cond=cond, if_then=then, if_else=No}) main_dcl_module_n varHeap = beGuardNode - (convertCondExpr cond main_dcl_module_n varHeap) + (convertRootExpr aliasDummyId cond main_dcl_module_n varHeap) (convertRhsNodeDefs aliasDummyId then main_dcl_module_n varHeap) (convertRhsStrictNodeIds then varHeap) (convertRootExpr aliasDummyId then main_dcl_module_n varHeap) @@ -1400,9 +1397,8 @@ collectNodeDefs aliasDummyId (Let {let_strict_binds, let_lazy_binds}) where filterStrictAlias [] let_lazy_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 + | not (isNilPtr app.app_symb.symb_name.id_info) && app.app_symb.symb_name==aliasDummyId // the compiled source was a strict alias like "#! x = y" = case hd app.app_args of Var _ @@ -1410,7 +1406,6 @@ 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 -// 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] |