mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-02 09:31:12 +00:00
Nuke the return type flow calculations.
They've proven to be unnecessary with the recent symbol/def changes.
This commit is contained in:
parent
3f3b501c58
commit
08b27efe33
3 changed files with 0 additions and 97 deletions
|
@ -82,10 +82,6 @@ typedef struct flownode_s {
|
||||||
struct set_s *in;
|
struct set_s *in;
|
||||||
struct set_s *out;
|
struct set_s *out;
|
||||||
} init_vars;
|
} init_vars;
|
||||||
struct {
|
|
||||||
etype_t in;
|
|
||||||
etype_t out; ///< if different from in, then block defines
|
|
||||||
} return_type; ///< type of .return for this node
|
|
||||||
struct sblock_s *sblock; ///< original statement block
|
struct sblock_s *sblock; ///< original statement block
|
||||||
struct dag_s *dag; ///< dag for this node
|
struct dag_s *dag; ///< dag for this node
|
||||||
} flownode_t;
|
} flownode_t;
|
||||||
|
@ -116,7 +112,6 @@ struct sblock_s *flow_generate (flowgraph_t *graph);
|
||||||
void dump_dot_flow (void *g, const char *filename);
|
void dump_dot_flow (void *g, const char *filename);
|
||||||
void dump_dot_flow_dags (void *g, const char *filename);
|
void dump_dot_flow_dags (void *g, const char *filename);
|
||||||
void dump_dot_flow_live (void *g, const char *filename);
|
void dump_dot_flow_live (void *g, const char *filename);
|
||||||
void dump_dot_flow_return (void *g, const char *filename);
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
@ -200,23 +200,10 @@ print_flow_node_live (dstring_t *dstr, flowgraph_t *graph, flownode_t *node,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
print_flow_node_return (dstring_t *dstr, flowgraph_t *graph, flownode_t *node,
|
|
||||||
int level)
|
|
||||||
{
|
|
||||||
int indent = level * 2 + 2;
|
|
||||||
|
|
||||||
dasprintf (dstr, "%*s\"fn_%p\" [label=\"%d (%d)\\n%s\\n%s\"];\n",
|
|
||||||
indent, "", node, node->id, node->dfn,
|
|
||||||
pr_type_name[node->return_type.in],
|
|
||||||
pr_type_name[node->return_type.out]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static flow_dot_t flow_dot_methods[] = {
|
static flow_dot_t flow_dot_methods[] = {
|
||||||
{"", print_flow_node, print_flow_edge},
|
{"", print_flow_node, print_flow_edge},
|
||||||
{"dag", print_flow_node_dag, print_flow_edge_dag},
|
{"dag", print_flow_node_dag, print_flow_edge_dag},
|
||||||
{"live", print_flow_node_live, print_flow_edge},
|
{"live", print_flow_node_live, print_flow_edge},
|
||||||
{"return", print_flow_node_return, print_flow_edge},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -267,9 +254,3 @@ dump_dot_flow_live (void *g, const char *filename)
|
||||||
{
|
{
|
||||||
print_flowgraph (&flow_dot_methods[2], (flowgraph_t *) g, filename);
|
print_flowgraph (&flow_dot_methods[2], (flowgraph_t *) g, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
dump_dot_flow_return (void *g, const char *filename)
|
|
||||||
{
|
|
||||||
print_flowgraph (&flow_dot_methods[3], (flowgraph_t *) g, filename);
|
|
||||||
}
|
|
||||||
|
|
|
@ -533,78 +533,6 @@ flow_uninitialized (flowgraph_t *graph)
|
||||||
set_delete (predecessors);
|
set_delete (predecessors);
|
||||||
}
|
}
|
||||||
|
|
||||||
static etype_t
|
|
||||||
get_function_type (operand_t *op)
|
|
||||||
{
|
|
||||||
type_t *type = &type_void;
|
|
||||||
|
|
||||||
//FIXME fuction type casts?
|
|
||||||
if (op->op_type == op_def) {
|
|
||||||
type = op->o.def->type;
|
|
||||||
if (type->type != ev_func)
|
|
||||||
internal_error (0, "not a function symbol");
|
|
||||||
type = type->t.func.type;
|
|
||||||
} else if (op->op_type == op_value) {
|
|
||||||
if (op->o.value->type != ev_func)
|
|
||||||
internal_error (0, "not a function value");
|
|
||||||
type = op->o.value->v.func_val.type;
|
|
||||||
} else if (op->op_type == op_temp) {
|
|
||||||
type = op->o.tempop.type;
|
|
||||||
if (type->type != ev_func)
|
|
||||||
internal_error (0, "not a function temp");
|
|
||||||
type = type->t.func.type;
|
|
||||||
} else {
|
|
||||||
internal_error (0, "don't know how to extract function type");
|
|
||||||
}
|
|
||||||
// fixme temps?
|
|
||||||
return low_level_type (type);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
flow_set_return_type (flownode_t *node, etype_t type)
|
|
||||||
{
|
|
||||||
statement_t *st = (statement_t *) node->sblock->tail;
|
|
||||||
node->return_type.in = type;
|
|
||||||
node->return_type.out = node->return_type.in;
|
|
||||||
if (node->sblock->statements
|
|
||||||
&& statement_is_call (st))
|
|
||||||
node->return_type.out = get_function_type (st->opa);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
flow_return_type (flowgraph_t *graph)
|
|
||||||
{
|
|
||||||
etype_t return_type;
|
|
||||||
etype_t old_rtype;
|
|
||||||
flownode_t *node;
|
|
||||||
set_iter_t *pred_iter;
|
|
||||||
flownode_t *pred;
|
|
||||||
int i;
|
|
||||||
int changed;
|
|
||||||
|
|
||||||
do {
|
|
||||||
changed = 0;
|
|
||||||
node = graph->nodes[0];
|
|
||||||
flow_set_return_type (node, ev_void);
|
|
||||||
for (i = 1; i < graph->num_nodes; i++) {
|
|
||||||
node = graph->nodes[graph->dfo[i]];
|
|
||||||
return_type = ev_type_count;
|
|
||||||
old_rtype = node->return_type.in;
|
|
||||||
for (pred_iter = set_first (node->predecessors); pred_iter;
|
|
||||||
pred_iter = set_next (pred_iter)) {
|
|
||||||
pred = graph->nodes[pred_iter->member];
|
|
||||||
if (return_type == ev_type_count)
|
|
||||||
return_type = pred->return_type.out;
|
|
||||||
if (return_type != pred->return_type.out)
|
|
||||||
return_type = ev_void;
|
|
||||||
}
|
|
||||||
flow_set_return_type (node, return_type);
|
|
||||||
if (return_type != old_rtype)
|
|
||||||
changed = 1;
|
|
||||||
}
|
|
||||||
} while (changed);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
flow_build_dags (flowgraph_t *graph)
|
flow_build_dags (flowgraph_t *graph)
|
||||||
{
|
{
|
||||||
|
@ -646,7 +574,6 @@ flow_data_flow (flowgraph_t *graph)
|
||||||
}
|
}
|
||||||
flow_live_vars (graph);
|
flow_live_vars (graph);
|
||||||
flow_uninitialized (graph);
|
flow_uninitialized (graph);
|
||||||
flow_return_type (graph);
|
|
||||||
flow_build_dags (graph);
|
flow_build_dags (graph);
|
||||||
if (options.block_dot.flow)
|
if (options.block_dot.flow)
|
||||||
dump_dot ("flow", graph, dump_dot_flow);
|
dump_dot ("flow", graph, dump_dot_flow);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue