Calls of which the actual and formal parameters do not match

are no longer substituted inline.
This commit is contained in:
bal 1985-02-20 15:01:02 +00:00
parent 2a4b3fd616
commit 469d075e77
3 changed files with 9 additions and 6 deletions

View file

@ -124,9 +124,8 @@ pass2(cnam,space)
ccf = openfile(ccname,"r");
while ((c = getcall(cf)) != (call_p) 0) {
/* process all calls */
if (SUITABLE(c->cl_proc)) {
if (SUITABLE(c->cl_proc) && anal_params(c)) {
/* called proc. may be put in line */
anal_params(c);
/* see which parameters may be put in line */
assign_ratio(c); /* assign a rank */
a = abstract(c); /* abstract essential info */

View file

@ -131,7 +131,7 @@ STATIC bool too_expensive(fm,act)
return (OFTEN_USED(fm) && !is_simple(act->ac_exp));
}
anal_params(c)
bool anal_params(c)
call_p c;
{
/* Determine which of the actual parameters of a
@ -144,12 +144,13 @@ anal_params(c)
int inlpars = 0;
p = c->cl_proc; /* the called procedure */
if (!INLINE_PARS(p) || !match_pars(p->P_FORMALS, c->cl_actuals)) {
if (!match_pars(p->P_FORMALS, c->cl_actuals)) return FALSE;
if (!INLINE_PARS(p)) {
for (act = c->cl_actuals; act != (actual_p) 0;
act = act->ac_next) {
NOT_INLINE(act);
}
return; /* "# of inline pars." field in cl_flags remains 0 */
return TRUE; /* "# of inline pars." field in cl_flags remains 0 */
}
for (act = c->cl_actuals, form = p->P_FORMALS; act != (actual_p) 0;
act = act->ac_next, form = form->f_next) {
@ -163,6 +164,7 @@ anal_params(c)
}
if (inlpars > 15) inlpars = 15; /* We've only got 4 bits! */
c->cl_flags |= inlpars; /* number of inline parameters */
return TRUE;
}

View file

@ -1,6 +1,8 @@
extern anal_params(); /* (call_p c)
extern bool anal_params(); /* (call_p c)
* See which parameters of the call
* may be expanded in line.
* If the formals and actuals do not
* match, return FALSE
*/
extern assign_ratio(); /* (call_p c)
* Assigna ratio number to the call,