mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
Remove the auxfunction manipulation from the compiler proper.
It was broken code in the first place (realloc and pointers), and is redundant with the new linking process.
This commit is contained in:
parent
16103f9018
commit
02a70ebe1c
5 changed files with 8 additions and 41 deletions
|
@ -50,10 +50,11 @@ typedef struct overloaded_function_s {
|
||||||
|
|
||||||
typedef struct function_s {
|
typedef struct function_s {
|
||||||
struct function_s *next;
|
struct function_s *next;
|
||||||
pr_auxfunction_t *aux; ///< debug info;
|
|
||||||
int builtin; ///< if non 0, call an internal function
|
int builtin; ///< if non 0, call an internal function
|
||||||
int code; ///< first statement
|
int code; ///< first statement
|
||||||
int function_num;
|
int function_num;
|
||||||
|
int line_info;
|
||||||
|
int local_defs;
|
||||||
string_t s_file; ///< source file with definition
|
string_t s_file; ///< source file with definition
|
||||||
string_t s_name;
|
string_t s_name;
|
||||||
int temp_num; ///< number for next temp var
|
int temp_num; ///< number for next temp var
|
||||||
|
|
|
@ -117,20 +117,6 @@ line_info (char *text)
|
||||||
pr.source_file = ReuseString (strip_path (str));
|
pr.source_file = ReuseString (strip_path (str));
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_auxfunction_t *
|
|
||||||
new_auxfunction (void)
|
|
||||||
{
|
|
||||||
if (pr.num_auxfunctions == pr.auxfunctions_size) {
|
|
||||||
pr.auxfunctions_size += 1024;
|
|
||||||
pr.auxfunctions = realloc (pr.auxfunctions,
|
|
||||||
pr.auxfunctions_size
|
|
||||||
* sizeof (pr_auxfunction_t));
|
|
||||||
}
|
|
||||||
memset (&pr.auxfunctions[pr.num_auxfunctions], 0,
|
|
||||||
sizeof (pr_auxfunction_t));
|
|
||||||
return &pr.auxfunctions[pr.num_auxfunctions++];
|
|
||||||
}
|
|
||||||
|
|
||||||
pr_lineno_t *
|
pr_lineno_t *
|
||||||
new_lineno (void)
|
new_lineno (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,7 +182,7 @@ emit_statement (statement_t *statement)
|
||||||
print_statement (statement);
|
print_statement (statement);
|
||||||
internal_error (statement->expr, "ice ice baby");
|
internal_error (statement->expr, "ice ice baby");
|
||||||
}
|
}
|
||||||
if (options.code.debug && current_func->aux) {
|
if (options.code.debug) {
|
||||||
expr_t *e = statement->expr;
|
expr_t *e = statement->expr;
|
||||||
pr_uint_t line = (e ? e->line : pr.source_line) - lineno_base;
|
pr_uint_t line = (e ? e->line : pr.source_line) - lineno_base;
|
||||||
|
|
||||||
|
|
|
@ -523,8 +523,6 @@ add_function (function_t *f)
|
||||||
*pr.func_tail = f;
|
*pr.func_tail = f;
|
||||||
pr.func_tail = &f->next;
|
pr.func_tail = &f->next;
|
||||||
f->function_num = pr.num_functions++;
|
f->function_num = pr.num_functions++;
|
||||||
if (options.code.debug)
|
|
||||||
f->aux = new_auxfunction ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function_t *
|
function_t *
|
||||||
|
@ -556,14 +554,10 @@ begin_function (symbol_t *sym, const char *nicename, symtab_t *parent,
|
||||||
}
|
}
|
||||||
sym->s.func->code = pr.code->size;
|
sym->s.func->code = pr.code->size;
|
||||||
|
|
||||||
if (options.code.debug && sym->s.func->aux) {
|
if (options.code.debug) {
|
||||||
pr_lineno_t *lineno = new_lineno ();
|
pr_lineno_t *lineno = new_lineno ();
|
||||||
sym->s.func->aux->source_line = sym->s.func->def->line;
|
sym->s.func->line_info = lineno - pr.linenos;
|
||||||
sym->s.func->aux->line_info = lineno - pr.linenos;
|
sym->s.func->local_defs = pr.num_locals;
|
||||||
sym->s.func->aux->local_defs = pr.num_locals;
|
|
||||||
sym->s.func->aux->return_type = sym->type->t.func.type->type;
|
|
||||||
|
|
||||||
lineno->fa.func = sym->s.func->aux - pr.auxfunctions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_scope (sym, parent);
|
build_scope (sym, parent);
|
||||||
|
@ -640,18 +634,6 @@ build_function (function_t *f)
|
||||||
void
|
void
|
||||||
finish_function (function_t *f)
|
finish_function (function_t *f)
|
||||||
{
|
{
|
||||||
if (f->aux) {
|
|
||||||
def_t *def;
|
|
||||||
f->aux->function = f->function_num;
|
|
||||||
if (f->symtab && f->symtab->space) {
|
|
||||||
for (def = f->symtab->space->defs; def; def = def->next) {
|
|
||||||
if (def->name) {
|
|
||||||
def_to_ddef (def, new_local (), 0);
|
|
||||||
f->aux->num_locals++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -660,8 +642,7 @@ emit_function (function_t *f, expr_t *e)
|
||||||
sblock_t *sblock;
|
sblock_t *sblock;
|
||||||
|
|
||||||
f->code = pr.code->size;
|
f->code = pr.code->size;
|
||||||
if (f->aux)
|
lineno_base = f->def->line;
|
||||||
lineno_base = f->aux->source_line;
|
|
||||||
sblock = make_statements (e);
|
sblock = make_statements (e);
|
||||||
emit_statements (sblock);
|
emit_statements (sblock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,8 +267,7 @@ qfo_encode_functions (qfo_t *qfo, qfo_def_t **defs, qfo_reloc_t **relocs,
|
||||||
qfo_init_data_space (qfo, defs, relocs, space++, f->symtab->space);
|
qfo_init_data_space (qfo, defs, relocs, space++, f->symtab->space);
|
||||||
q->locals_space = f->symtab->space->qfo_space;
|
q->locals_space = f->symtab->space->qfo_space;
|
||||||
}
|
}
|
||||||
if (f->aux)
|
q->line_info = f->line_info;
|
||||||
q->line_info = f->aux->line_info;
|
|
||||||
q->relocs = *relocs - qfo->relocs;
|
q->relocs = *relocs - qfo->relocs;
|
||||||
q->num_relocs = qfo_encode_relocs (f->refs, relocs, q - qfo->funcs);
|
q->num_relocs = qfo_encode_relocs (f->refs, relocs, q - qfo->funcs);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue