Only generate FIL when needed
This commit is contained in:
parent
cfd6bca270
commit
a7a80689bf
|
@ -311,8 +311,8 @@ CodeCall(nd)
|
||||||
and result is already done.
|
and result is already done.
|
||||||
*/
|
*/
|
||||||
register t_node *left = nd->nd_left;
|
register t_node *left = nd->nd_left;
|
||||||
register t_node *right = nd->nd_right;
|
|
||||||
register t_type *result_tp;
|
register t_type *result_tp;
|
||||||
|
int needs_fn;
|
||||||
|
|
||||||
if (left->nd_type == std_type) {
|
if (left->nd_type == std_type) {
|
||||||
CodeStd(nd);
|
CodeStd(nd);
|
||||||
|
@ -321,8 +321,8 @@ CodeCall(nd)
|
||||||
|
|
||||||
assert(IsProcCall(left));
|
assert(IsProcCall(left));
|
||||||
|
|
||||||
if (right) {
|
if (nd->nd_right) {
|
||||||
CodeParameters(ParamList(left->nd_type), right);
|
CodeParameters(ParamList(left->nd_type), nd->nd_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(left->nd_class) {
|
switch(left->nd_class) {
|
||||||
|
@ -333,11 +333,13 @@ CodeCall(nd)
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
C_lxl((arith) (proclevel - level));
|
C_lxl((arith) (proclevel - level));
|
||||||
}
|
}
|
||||||
|
needs_fn = left->nd_def->df_scope->sc_defmodule;
|
||||||
C_cal(NameOfProc(left->nd_def));
|
C_cal(NameOfProc(left->nd_def));
|
||||||
break;
|
break;
|
||||||
}}
|
}}
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
default:
|
default:
|
||||||
|
needs_fn = 1;
|
||||||
CodePExpr(left);
|
CodePExpr(left);
|
||||||
C_cai();
|
C_cai();
|
||||||
}
|
}
|
||||||
|
@ -350,7 +352,7 @@ CodeCall(nd)
|
||||||
}
|
}
|
||||||
else C_lfr(sz);
|
else C_lfr(sz);
|
||||||
}
|
}
|
||||||
DoFilename();
|
DoFilename(needs_fn);
|
||||||
DoLineno(nd);
|
DoLineno(nd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ GetDefinitionModule(id, incr)
|
||||||
t_scopelist *vis;
|
t_scopelist *vis;
|
||||||
char *fn = FileName;
|
char *fn = FileName;
|
||||||
int ln = LineNumber;
|
int ln = LineNumber;
|
||||||
t_scope *newsc = CurrentScope;
|
t_scope *newsc;
|
||||||
|
|
||||||
level += incr;
|
level += incr;
|
||||||
df = lookup(id, GlobalScope, D_IMPORTED, 0);
|
df = lookup(id, GlobalScope, D_IMPORTED, 0);
|
||||||
|
@ -105,13 +105,14 @@ GetDefinitionModule(id, incr)
|
||||||
ForeignFlag = 0;
|
ForeignFlag = 0;
|
||||||
DefId = id;
|
DefId = id;
|
||||||
open_scope(CLOSEDSCOPE);
|
open_scope(CLOSEDSCOPE);
|
||||||
|
newsc = CurrentScope;
|
||||||
vis = CurrVis;
|
vis = CurrVis;
|
||||||
|
newsc->sc_defmodule = incr;
|
||||||
if (!strcmp(id->id_text, "SYSTEM")) {
|
if (!strcmp(id->id_text, "SYSTEM")) {
|
||||||
do_SYSTEM();
|
do_SYSTEM();
|
||||||
df = lookup(id, GlobalScope, D_IMPORTED, 0);
|
df = lookup(id, GlobalScope, D_IMPORTED, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newsc = CurrentScope;
|
|
||||||
if (!is_anon_idf(id) && GetFile(id->id_text)) {
|
if (!is_anon_idf(id) && GetFile(id->id_text)) {
|
||||||
|
|
||||||
DefModule();
|
DefModule();
|
||||||
|
|
|
@ -28,6 +28,9 @@ struct scope {
|
||||||
struct def *sc_def; /* list of definitions in this scope */
|
struct def *sc_def; /* list of definitions in this scope */
|
||||||
arith sc_off; /* offsets of variables in this scope */
|
arith sc_off; /* offsets of variables in this scope */
|
||||||
char sc_scopeclosed; /* flag indicating closed or open scope */
|
char sc_scopeclosed; /* flag indicating closed or open scope */
|
||||||
|
char sc_defmodule; /* flag set is this scope is from a separate
|
||||||
|
definition module
|
||||||
|
*/
|
||||||
int sc_level; /* level of this scope */
|
int sc_level; /* level of this scope */
|
||||||
struct def *sc_definedby; /* The def structure defining this scope */
|
struct def *sc_definedby; /* The def structure defining this scope */
|
||||||
struct node *sc_end; /* node to remember line number of end of scope */
|
struct node *sc_end; /* node to remember line number of end of scope */
|
||||||
|
|
|
@ -117,12 +117,12 @@ DoLineno(nd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DoFilename()
|
DoFilename(needed)
|
||||||
{
|
{
|
||||||
static label filename_label = 0;
|
static label filename_label = 0;
|
||||||
|
|
||||||
oldlineno = 0;
|
oldlineno = 0; /* always invalidate remembered line number */
|
||||||
if (! options['L']) {
|
if (needed && ! options['L']) {
|
||||||
|
|
||||||
if (! filename_label) {
|
if (! filename_label) {
|
||||||
filename_label = 1;
|
filename_label = 1;
|
||||||
|
@ -185,7 +185,7 @@ WalkModule(module)
|
||||||
for (; nd; nd = nd->nd_left) {
|
for (; nd; nd = nd->nd_left) {
|
||||||
C_cal(nd->nd_def->mod_vis->sc_scope->sc_name);
|
C_cal(nd->nd_def->mod_vis->sc_scope->sc_name);
|
||||||
}
|
}
|
||||||
DoFilename();
|
DoFilename(1);
|
||||||
}
|
}
|
||||||
WalkDefList(sc->sc_def, MkCalls);
|
WalkDefList(sc->sc_def, MkCalls);
|
||||||
proclevel++;
|
proclevel++;
|
||||||
|
@ -230,7 +230,12 @@ WalkProcedure(procedure)
|
||||||
C_ms_par(procedure->df_type->prc_nbpar);
|
C_ms_par(procedure->df_type->prc_nbpar);
|
||||||
TmpOpen(procscope);
|
TmpOpen(procscope);
|
||||||
DoPriority();
|
DoPriority();
|
||||||
DoFilename(); /* ??? only when this procedure is exported? */
|
/* generate code for filename only when the procedure can be
|
||||||
|
exported, either directly or by taking the address.
|
||||||
|
This cannot be done if the level is not zero (because in
|
||||||
|
this case it is a nested procedure).
|
||||||
|
*/
|
||||||
|
DoFilename(! procscope->sc_level);
|
||||||
|
|
||||||
func_type = tp = RemoveEqual(ResultType(procedure->df_type));
|
func_type = tp = RemoveEqual(ResultType(procedure->df_type));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue