mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-18 09:51:40 +00:00
[qfcc] Record actual statements in a function
This is to help with building ud-chains as I suspect I won't be all that interested in defs from the dummy blocks.
This commit is contained in:
parent
74e15fc582
commit
0c116b8ff0
3 changed files with 6 additions and 2 deletions
|
@ -118,6 +118,7 @@ typedef struct function_s {
|
||||||
int num_vars; ///< total number of variables referenced
|
int num_vars; ///< total number of variables referenced
|
||||||
struct set_s *global_vars;///< set indicating which vars are global
|
struct set_s *global_vars;///< set indicating which vars are global
|
||||||
struct set_s *param_vars; ///< set indicating which vars are params
|
struct set_s *param_vars; ///< set indicating which vars are params
|
||||||
|
struct set_s *real_statements;///< actual statements for ud-chaining
|
||||||
struct statement_s **statements;
|
struct statement_s **statements;
|
||||||
int num_statements;
|
int num_statements;
|
||||||
int pseudo_addr;///< pseudo address space for flow analysis
|
int pseudo_addr;///< pseudo address space for flow analysis
|
||||||
|
|
|
@ -108,12 +108,12 @@ typedef enum {
|
||||||
typedef struct statement_s {
|
typedef struct statement_s {
|
||||||
struct statement_s *next;
|
struct statement_s *next;
|
||||||
st_type_t type;
|
st_type_t type;
|
||||||
|
int number; ///< number of this statement in function
|
||||||
const char *opcode;
|
const char *opcode;
|
||||||
operand_t *opa;
|
operand_t *opa;
|
||||||
operand_t *opb;
|
operand_t *opb;
|
||||||
operand_t *opc;
|
operand_t *opc;
|
||||||
struct expr_s *expr; ///< source expression for this statement
|
struct expr_s *expr; ///< source expression for this statement
|
||||||
int number; ///< number of this statement in function
|
|
||||||
operand_t *use; ///< list of auxiliary operands used
|
operand_t *use; ///< list of auxiliary operands used
|
||||||
operand_t *def; ///< list of auxiliary operands defined
|
operand_t *def; ///< list of auxiliary operands defined
|
||||||
operand_t *kill; ///< list of auxiliary operands killed
|
operand_t *kill; ///< list of auxiliary operands killed
|
||||||
|
|
|
@ -530,9 +530,12 @@ flow_build_statements (function_t *func)
|
||||||
|
|
||||||
func->statements = malloc (num_statements * sizeof (statement_t *));
|
func->statements = malloc (num_statements * sizeof (statement_t *));
|
||||||
func->num_statements = num_statements;
|
func->num_statements = num_statements;
|
||||||
|
func->real_statements = set_new ();
|
||||||
for (sblock = func->sblock; sblock; sblock = sblock->next) {
|
for (sblock = func->sblock; sblock; sblock = sblock->next) {
|
||||||
for (s = sblock->statements; s; s = s->next)
|
for (s = sblock->statements; s; s = s->next) {
|
||||||
func->statements[s->number] = s;
|
func->statements[s->number] = s;
|
||||||
|
set_add (func->real_statements, s->number);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue