From decc3845c5dbb91f9c39768bb4839cc12529fbac Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 13 Dec 2012 14:43:43 +0900 Subject: [PATCH] Kill any aliases when assigning to an aliased def. Temps aren't supported yet :P The alias defs themselves aren't killed (still want any assignments to occur) but rather, their nodes are. Also, edges to the alias defs' nodes are added to the assigning node. Fixes structlive.r :) --- tools/qfcc/source/dags.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/qfcc/source/dags.c b/tools/qfcc/source/dags.c index 61708fff0..ec750788b 100644 --- a/tools/qfcc/source/dags.c +++ b/tools/qfcc/source/dags.c @@ -405,6 +405,35 @@ op_is_identifier (operand_t *op) return 1; } +static int +dag_kill_aliases_visit (def_t *def, void *_node) +{ + dagnode_t *node = (dagnode_t *) _node; + daglabel_t *label; + + label = def->daglabel; + if (label && label->dagnode) { + set_add (node->edges, label->dagnode->number); + set_remove (node->edges, node->number); + label->dagnode->killed = 1; + } + return 0; +} + +static void +dag_kill_aliases (daglabel_t *l) +{ + operand_t *op = l->op; + + if (op->op_type == op_temp) { + } else if (op->op_type == op_def) { + if (op->o.def->alias || op->o.def->alias_defs) + def_visit_all (op->o.def, 1, dag_kill_aliases_visit, l->dagnode); + } else { + internal_error (0, "rvalue assignment?"); + } +} + static void dagnode_attach_label (dagnode_t *n, daglabel_t *l) { @@ -423,6 +452,7 @@ dagnode_attach_label (dagnode_t *n, daglabel_t *l) l->live = 0; // remove live forcing on assignment l->dagnode = n; set_add (n->identifiers, l->number); + dag_kill_aliases (l); } static int