mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-14 00:40:55 +00:00
[qfcc] Increase flow operand count to 5
MOVEP instructions have up to 5 operands: 2 pointers, the count, and 0-2 referenced variables (when known).
This commit is contained in:
parent
fa2cbc72d8
commit
dec2e6249e
4 changed files with 17 additions and 12 deletions
|
@ -102,9 +102,10 @@ typedef struct flowgraph_s {
|
||||||
|
|
||||||
flowvar_t *flow_get_var (struct operand_s *op);
|
flowvar_t *flow_get_var (struct operand_s *op);
|
||||||
|
|
||||||
|
#define FLOW_OPERANDS 5
|
||||||
void flow_analyze_statement (struct statement_s *s, struct set_s *use,
|
void flow_analyze_statement (struct statement_s *s, struct set_s *use,
|
||||||
struct set_s *def, struct set_s *kill,
|
struct set_s *def, struct set_s *kill,
|
||||||
struct operand_s *operands[4]);
|
struct operand_s *operands[FLOW_OPERANDS]);
|
||||||
|
|
||||||
void flow_data_flow (struct function_s *func);
|
void flow_data_flow (struct function_s *func);
|
||||||
|
|
||||||
|
|
|
@ -700,6 +700,8 @@ dag_create (flownode_t *flownode)
|
||||||
dagnode_t **nodes;
|
dagnode_t **nodes;
|
||||||
daglabel_t **labels;
|
daglabel_t **labels;
|
||||||
int num_statements = 0;
|
int num_statements = 0;
|
||||||
|
int num_nodes;
|
||||||
|
int num_lables;
|
||||||
set_t *live_vars = set_new ();
|
set_t *live_vars = set_new ();
|
||||||
|
|
||||||
flush_daglabels ();
|
flush_daglabels ();
|
||||||
|
@ -713,14 +715,16 @@ dag_create (flownode_t *flownode)
|
||||||
|
|
||||||
dag = new_dag ();
|
dag = new_dag ();
|
||||||
dag->flownode = flownode;
|
dag->flownode = flownode;
|
||||||
// at most 4 per statement
|
// at most FLOW_OPERANDS per statement
|
||||||
dag->nodes = alloca (num_statements * 4 * sizeof (dagnode_t));
|
num_nodes = num_statements * FLOW_OPERANDS;
|
||||||
// at most 4 per statement, + return + params
|
dag->nodes = alloca (num_nodes * sizeof (dagnode_t));
|
||||||
dag->labels = alloca (num_statements * (4 + 1 + 8) * sizeof (daglabel_t));
|
// at most FLOW_OPERANDS per statement, + return + params
|
||||||
|
num_lables = num_statements * (FLOW_OPERANDS + 1 + 8);
|
||||||
|
dag->labels = alloca (num_lables * sizeof (daglabel_t));
|
||||||
dag->roots = set_new ();
|
dag->roots = set_new ();
|
||||||
|
|
||||||
for (s = block->statements; s; s = s->next) {
|
for (s = block->statements; s; s = s->next) {
|
||||||
operand_t *operands[4];
|
operand_t *operands[FLOW_OPERANDS];
|
||||||
dagnode_t *n = 0, *children[3] = {0, 0, 0};
|
dagnode_t *n = 0, *children[3] = {0, 0, 0};
|
||||||
daglabel_t *op, *lx;
|
daglabel_t *op, *lx;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -69,10 +69,10 @@ flow_statement (dstring_t *dstr, statement_t *s)
|
||||||
set_t *def = set_new ();
|
set_t *def = set_new ();
|
||||||
set_t *kill = set_new ();
|
set_t *kill = set_new ();
|
||||||
set_t *ops = set_new ();
|
set_t *ops = set_new ();
|
||||||
operand_t *operands[4];
|
operand_t *operands[FLOW_OPERANDS];
|
||||||
|
|
||||||
flow_analyze_statement (s, use, def, kill, operands);
|
flow_analyze_statement (s, use, def, kill, operands);
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < FLOW_OPERANDS; i++) {
|
||||||
if (operands[i]) {
|
if (operands[i]) {
|
||||||
set_add (ops, i);
|
set_add (ops, i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -509,7 +509,7 @@ static void
|
||||||
flow_build_vars (function_t *func)
|
flow_build_vars (function_t *func)
|
||||||
{
|
{
|
||||||
statement_t *s;
|
statement_t *s;
|
||||||
operand_t *operands[4];
|
operand_t *operands[FLOW_OPERANDS];
|
||||||
int num_vars = 0;
|
int num_vars = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
set_t *stuse;
|
set_t *stuse;
|
||||||
|
@ -1052,7 +1052,7 @@ flow_add_op_var (set_t *set, operand_t *op, int is_use)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
flow_analyize_pointer_operand (operand_t *ptrop, set_t *def,
|
flow_analyize_pointer_operand (operand_t *ptrop, set_t *def,
|
||||||
operand_t *operands[4])
|
operand_t *operands[FLOW_OPERANDS])
|
||||||
{
|
{
|
||||||
if (ptrop->op_type == op_value && ptrop->o.value->lltype == ev_pointer) {
|
if (ptrop->op_type == op_value && ptrop->o.value->lltype == ev_pointer) {
|
||||||
ex_pointer_t *ptr = &ptrop->o.value->v.pointer;
|
ex_pointer_t *ptr = &ptrop->o.value->v.pointer;
|
||||||
|
@ -1082,7 +1082,7 @@ flow_analyize_pointer_operand (operand_t *ptrop, set_t *def,
|
||||||
|
|
||||||
void
|
void
|
||||||
flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
|
flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
|
||||||
operand_t *operands[4])
|
operand_t *operands[FLOW_OPERANDS])
|
||||||
{
|
{
|
||||||
int i, start, calln = -1;
|
int i, start, calln = -1;
|
||||||
|
|
||||||
|
@ -1093,7 +1093,7 @@ flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
|
||||||
if (kill)
|
if (kill)
|
||||||
set_empty (kill);
|
set_empty (kill);
|
||||||
if (operands) {
|
if (operands) {
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < FLOW_OPERANDS; i++)
|
||||||
operands[i] = 0;
|
operands[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue