Run through clang-format.

This commit is contained in:
David Given 2016-08-21 19:38:54 +02:00
parent 1b66b63eae
commit 918f300513

View file

@ -56,8 +56,7 @@ int Sbig_caller,Sdispensable,Schangedcallee,Sbigcallee,Sspace,Szeroratio;
* The call descriptors are put in a file (calfile).
*/
pass1(lnam,bnam,cnam)
char *lnam, *bnam, *cnam;
pass1(lnam, bnam, cnam) char* lnam, *bnam, *cnam;
{
FILE* f, *gf, *cf, *ccf; /* The EM input, the basic block graph,
* the call-list file and the calcnt file.
@ -76,13 +75,16 @@ pass1(lnam,bnam,cnam)
/* use information from the procedure table to
* see which calls certainly cannot be expanded.
*/
while(TRUE) {
while (TRUE)
{
laddr = ftell(f);
if (!getunit(gf,f,&kind,&g,&l,&curproc,TRUE)) break;
if (!getunit(gf, f, &kind, &g, &l, &curproc, TRUE))
break;
/* Read the control flow graph and EM text of
* one procedure and analyze it.
*/
if (kind == LDATA) {
if (kind == LDATA)
{
remunit(LDATA, (proc_p)0, l);
continue;
}
@ -94,7 +96,8 @@ pass1(lnam,bnam,cnam)
/* address of graph in basic block file */
curproc->P_SIZE = proclength(curproc); /* #instructions */
total_size += curproc->P_SIZE;
if (BIG_PROC(curproc)) {
if (BIG_PROC(curproc))
{
/* curproc is too large to be expanded in line */
UNSUITABLE(curproc);
}
@ -113,20 +116,15 @@ pass1(lnam,bnam,cnam)
fclose(ccf);
}
/* P A S S 2
*
* Pass 2 reads the calfile and determines which calls should
* be expanded in line. It does not use the EM text.
*/
STATIC char cname2[128] = TMP_DIR;
pass2(cnam,space)
char *cnam;
pass2(cnam, space) char* cnam;
long space;
{
FILE* cf, *cf2, *ccf;
@ -135,9 +133,11 @@ pass2(cnam,space)
cf = openfile(cnam, "r");
cf2 = openfile(cname2, "w");
ccf = openfile(ccname, "r");
while ((c = getcall(cf)) != (call_p) 0) {
while ((c = getcall(cf)) != (call_p)0)
{
/* process all calls */
if (SUITABLE(c->cl_proc) && anal_params(c)) {
if (SUITABLE(c->cl_proc) && anal_params(c))
{
/* called proc. may be put in line */
/* see which parameters may be put in line */
assign_ratio(c); /* assign a rank */
@ -145,23 +145,29 @@ pass2(cnam,space)
append_abstract(a, a->cl_caller);
/* put it in call-list of calling proc. */
putcall(c, cf2, (short)0);
} else {
}
else
{
rem_call(c);
}
}
select_calls(fproc, ccf, space);
fclose(cf); if (! kp_temps) unlink(cnam);
fclose(cf);
if (!kp_temps)
unlink(cnam);
fclose(cf2);
fclose(ccf); if (! kp_temps) unlink(ccname);
fclose(ccf);
if (!kp_temps)
unlink(ccname);
cf2 = openfile(cname2, "r");
add_actuals(fproc, cf2);
cleancals(fproc); /* remove calls that were not selected */
/* add actual parameters to each selected call */
fclose(cf2); if (! kp_temps) unlink(cname2);
fclose(cf2);
if (!kp_temps)
unlink(cname2);
}
/* P A S S 3
*
* pass 3 reads the substitution file and performs all
@ -170,9 +176,7 @@ pass2(cnam,space)
* EM textfile.
*/
pass3(lnam,lnam2)
char *lnam,*lnam2;
pass3(lnam, lnam2) char* lnam, *lnam2;
{
bool verbose = TRUE;
FILE* lfile, *lfilerand, *lfile2, *sfile;
@ -183,23 +187,30 @@ pass3(lnam,lnam2)
lfile = openfile(lnam, "r");
lfilerand = openfile(lnam, "r");
lfile2 = openfile(lnam2, "w");
if (verbose) {
if (verbose)
{
sfile = openfile(sname, "w");
}
mesregs = Lempty_set();
while ((l = get_text(lfile,&curproc)) != (line_p) 0) {
if (curproc == (proc_p) 0) {
while ((l = get_text(lfile, &curproc)) != (line_p)0)
{
if (curproc == (proc_p)0)
{
/* Just a data-unit; no real instructions */
putlines(l->l_next, lfile2);
oldline(l);
continue;
}
if (IS_DISPENSABLE(curproc)) {
if (IS_DISPENSABLE(curproc))
{
liquidate(curproc, l->l_next);
} else {
}
else
{
startscan = l->l_next;
lastcid = 0;
for (c = curproc->P_CALS; c != (call_p) 0; c = next) {
for (c = curproc->P_CALS; c != (call_p)0; c = next)
{
next = c->cl_cdr;
cal = scan_to_cal(startscan, c->cl_id - lastcid);
assert(cal != (line_p)0);
@ -208,9 +219,12 @@ pass3(lnam,lnam2)
lastcid = c->cl_id;
/* next CAL after current one */
substitute(lfilerand, c, cal, l->l_next);
if (verbose) {
if (verbose)
{
putcall(c, sfile, 0);
} else {
}
else
{
rem_call(c);
}
}
@ -222,13 +236,14 @@ pass3(lnam,lnam2)
}
fclose(lfile);
fclose(lfile2);
if (verbose) {
if (verbose)
{
fclose(sfile);
if (! kp_temps) unlink(sname);
if (!kp_temps)
unlink(sname);
}
}
STATIC il_extptab(ptab)
proc_p ptab;
{
@ -238,7 +253,8 @@ STATIC il_extptab(ptab)
register proc_p p;
for (p = ptab; p != (proc_p) 0; p = p->p_next) {
for (p = ptab; p != (proc_p)0; p = p->p_next)
{
p->p_extend = newilpx();
p->P_ORGLABELS = p->p_nrlabels;
p->P_ORGLOCALS = p->p_localbytes;
@ -252,7 +268,8 @@ STATIC il_cleanptab(ptab)
register proc_p p;
for (p = ptab; p != (proc_p) 0; p = p->p_next) {
for (p = ptab; p != (proc_p)0; p = p->p_next)
{
oldilpx(p->p_extend);
}
}
@ -282,12 +299,13 @@ Sdiagnostics()
}
#endif
il_flags(p)
char *p;
il_flags(p) char* p;
{
switch (*p++)
{
switch(*p++) {
case 's':
while (*p != '\0') {
while (*p != '\0')
{
space = 10 * space + *p++ - '0';
}
break;
@ -304,8 +322,7 @@ il_flags(p)
}
}
main(argc,argv)
int argc;
main(argc, argv) int argc;
char* argv[];
{
FILE* f;
@ -331,7 +348,8 @@ main(argc,argv)
putptable(fproc, f, FALSE);
report("inline substitutions", Ssubst);
#ifdef VERBOSE
if (verbose_flag) {
if (verbose_flag)
{
Sdiagnostics();
}
#endif