mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Give temporary variables unique names.
This commit is contained in:
parent
681ded9375
commit
68cdc904f5
2 changed files with 7 additions and 2 deletions
|
@ -56,6 +56,7 @@ typedef struct function_s {
|
|||
int function_num;
|
||||
string_t s_file; ///< source file with definition
|
||||
string_t s_name;
|
||||
int temp_num; ///< number for next temp var
|
||||
struct def_s *def;
|
||||
struct symbol_s *sym;
|
||||
struct symtab_s *symtab;
|
||||
|
|
|
@ -108,9 +108,13 @@ get_operand_def (expr_t *expr, operand_t *op)
|
|||
zero_def.type = &type_short;
|
||||
return &zero_def; //FIXME
|
||||
case op_temp:
|
||||
if (!op->o.def)
|
||||
op->o.def = new_def (".tmp", ev_types[op->type],
|
||||
if (!op->o.def) {
|
||||
const char *temp_name;
|
||||
|
||||
temp_name = va (".tmp%d", current_func->temp_num++);
|
||||
op->o.def = new_def (temp_name, ev_types[op->type],
|
||||
current_func->symtab->space, st_local);
|
||||
}
|
||||
return op->o.def;
|
||||
case op_pointer:
|
||||
def = op->o.pointer->def;
|
||||
|
|
Loading…
Reference in a new issue