From 08b27efe3335ebe8030d702c34d27acd15728477 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 5 Dec 2012 19:56:10 +0900 Subject: [PATCH] Nuke the return type flow calculations. They've proven to be unnecessary with the recent symbol/def changes. --- tools/qfcc/include/flow.h | 5 --- tools/qfcc/source/dot_flow.c | 19 ---------- tools/qfcc/source/flow.c | 73 ------------------------------------ 3 files changed, 97 deletions(-) diff --git a/tools/qfcc/include/flow.h b/tools/qfcc/include/flow.h index 162d49020..17cc0fc1b 100644 --- a/tools/qfcc/include/flow.h +++ b/tools/qfcc/include/flow.h @@ -82,10 +82,6 @@ typedef struct flownode_s { struct set_s *in; struct set_s *out; } 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 dag_s *dag; ///< dag for this node } 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_dags (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); //@} diff --git a/tools/qfcc/source/dot_flow.c b/tools/qfcc/source/dot_flow.c index 8382691a7..141db49ac 100644 --- a/tools/qfcc/source/dot_flow.c +++ b/tools/qfcc/source/dot_flow.c @@ -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[] = { {"", print_flow_node, print_flow_edge}, {"dag", print_flow_node_dag, print_flow_edge_dag}, {"live", print_flow_node_live, print_flow_edge}, - {"return", print_flow_node_return, print_flow_edge}, }; 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); } - -void -dump_dot_flow_return (void *g, const char *filename) -{ - print_flowgraph (&flow_dot_methods[3], (flowgraph_t *) g, filename); -} diff --git a/tools/qfcc/source/flow.c b/tools/qfcc/source/flow.c index 05646442a..93756e17c 100644 --- a/tools/qfcc/source/flow.c +++ b/tools/qfcc/source/flow.c @@ -533,78 +533,6 @@ flow_uninitialized (flowgraph_t *graph) 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 flow_build_dags (flowgraph_t *graph) { @@ -646,7 +574,6 @@ flow_data_flow (flowgraph_t *graph) } flow_live_vars (graph); flow_uninitialized (graph); - flow_return_type (graph); flow_build_dags (graph); if (options.block_dot.flow) dump_dot ("flow", graph, dump_dot_flow);