aboutsummaryrefslogtreecommitdiff
path: root/backendC/CleanCompilerSources
diff options
context:
space:
mode:
authorjohnvg2003-02-20 13:47:55 +0000
committerjohnvg2003-02-20 13:47:55 +0000
commitf69ef634842167bfd384241e88cf0aee8f356a90 (patch)
treef8d67855514d245f865541af137e43b8cb8bb9f6 /backendC/CleanCompilerSources
parentimplement fusion of overloaded cons or nil (function) of overloaded lists, (diff)
don't generate abc code to build dictionary for overloaded Nil
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1321 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backendC/CleanCompilerSources')
-rw-r--r--backendC/CleanCompilerSources/codegen2.c18
-rw-r--r--backendC/CleanCompilerSources/codegen3.c12
2 files changed, 26 insertions, 4 deletions
diff --git a/backendC/CleanCompilerSources/codegen2.c b/backendC/CleanCompilerSources/codegen2.c
index f8d0d49..775f686 100644
--- a/backendC/CleanCompilerSources/codegen2.c
+++ b/backendC/CleanCompilerSources/codegen2.c
@@ -2898,6 +2898,22 @@ LabDef *unboxed_cons_label (SymbolP cons_symbol_p)
}
#endif
+#if STRICT_LISTS
+int simple_expression_without_node_ids (NodeP node_p)
+{
+ if (node_p->node_kind==NormalNode){
+ ArgP arg_p;
+
+ for_l (arg_p,node_p->node_arguments,arg_next)
+ if (!simple_expression_without_node_ids (arg_p->arg_node))
+ return False;
+
+ return True;
+ }
+ return False;
+}
+#endif
+
static void FillNormalNode (Node node,int *asp_p,int *bsp_p,NodeId update_node_id,CodeGenNodeIdsP code_gen_node_ids_p)
{
Symbol symb;
@@ -3082,7 +3098,7 @@ static void FillNormalNode (Node node,int *asp_p,int *bsp_p,NodeId update_node_i
return;
case nil_symb:
#if STRICT_LISTS
- if (symb->symb_head_strictness & 1){
+ if ((symb->symb_head_strictness & 1) && !simple_expression_without_node_ids (node->node_arguments->arg_node)){
BuildArg (node->node_arguments,asp_p,bsp_p,code_gen_node_ids_p);
GenPopA (1);
--*asp_p;
diff --git a/backendC/CleanCompilerSources/codegen3.c b/backendC/CleanCompilerSources/codegen3.c
index bbd9ceb..21c8703 100644
--- a/backendC/CleanCompilerSources/codegen3.c
+++ b/backendC/CleanCompilerSources/codegen3.c
@@ -707,6 +707,10 @@ static int CodeRhsNodeDefsAndRestoreNodeIdStates (Node root_node,NodeDefs defs,i
#define BETWEEN(l,h,v) ((unsigned)((v)-(l)) <= (unsigned)((h)-(l)))
+#if STRICT_LISTS
+extern int simple_expression_without_node_ids (NodeP node_p);
+#endif
+
static void CodeNormalRootNode (Node root,NodeId rootid,int asp,int bsp,CodeGenNodeIdsP code_gen_node_ids_p,StateS resultstate)
{
Symbol rootsymb;
@@ -792,9 +796,11 @@ static void CodeNormalRootNode (Node root,NodeId rootid,int asp,int bsp,CodeGenN
case nil_symb:
#if STRICT_LISTS
if (rootsymb->symb_head_strictness & 1){
- BuildArg (root->node_arguments,&asp,&bsp,code_gen_node_ids_p);
- GenPopA (1);
- --asp;
+ if (!simple_expression_without_node_ids (root->node_arguments->arg_node)){
+ BuildArg (root->node_arguments,&asp,&bsp,code_gen_node_ids_p);
+ GenPopA (1);
+ --asp;
+ }
if (resultstate.state_kind==StrictRedirection){
GenPopA (asp);