mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-20 10:43:29 +00:00
Kill all dag nodes on pointer assignment.
It's brutal, but it works and is conservatively correct.
This commit is contained in:
parent
f83cf1748f
commit
ef0f30935f
2 changed files with 17 additions and 0 deletions
|
@ -58,6 +58,7 @@ typedef struct dagnode_s {
|
|||
int topo; ///< topological sort order
|
||||
struct set_s *parents; ///< empty if root node
|
||||
int cost; ///< cost of this node in temp vars
|
||||
unsigned killed:1; ///< node is unavailable for cse
|
||||
st_type_t type; ///< type of node (st_node = leaf)
|
||||
daglabel_t *label; ///< ident/const if leaf node, or operator
|
||||
etype_t tl;
|
||||
|
|
|
@ -229,6 +229,8 @@ node (operand_t *op)
|
|||
if (op->o.label->daglabel)
|
||||
node = op->o.label->daglabel->dagnode;
|
||||
}
|
||||
if (node && node->killed)
|
||||
node = 0;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
@ -238,6 +240,8 @@ dagnode_match (const dagnode_t *n, const daglabel_t *op,
|
|||
{
|
||||
int i;
|
||||
|
||||
if (n->killed)
|
||||
return 0;
|
||||
if (n->label->opcode != op->opcode)
|
||||
return 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
|
@ -364,6 +368,16 @@ dag_set_live_vars (set_t *live_vars, dag_t *dag, dagnode_t *n)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dag_kill_nodes (dag_t *dag, dagnode_t *n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dag->num_nodes; i++)
|
||||
dag->nodes[i]->killed = 1;
|
||||
n->killed = 0;
|
||||
}
|
||||
|
||||
dag_t *
|
||||
dag_create (flownode_t *flownode)
|
||||
{
|
||||
|
@ -445,6 +459,8 @@ dag_create (flownode_t *flownode)
|
|||
}
|
||||
if (n->type == st_func)
|
||||
dag_set_live_vars (live_vars, dag, n);
|
||||
if (n->type == st_ptrassign)
|
||||
dag_kill_nodes (dag, n);
|
||||
}
|
||||
|
||||
nodes = malloc (dag->num_nodes * sizeof (dagnode_t *));
|
||||
|
|
Loading…
Reference in a new issue