SUIF's C front end is based on the lcc front-end, heavily modified to produce SUIF output. The first pass, snoot, performs initial parsing and lexing and outputs a SUIF file with possibly non-conformant data structures. A second pass, porky, eliminates such artifacts, rendering the output of snoot into standard SUIF.
Modifying snoot to accept the new keywords and constructs was fairly straight-forward, since the syntax for these constructs had been deliberately chosen to resemble existing C syntax forms. Specifically:
Figures and illustrate what the modified snoot transforms quasistatic constructs into --- for brevity of presentation, I have approximated the SUIF-format annotations in the s2c output by using C-style comments. By making both quasistatic variables and quasistatic parameters explicitly const, the programmer cannot accidentally mutate their values. Although it would be desirable to prevent the programmer from referencing a quasistatic variable as an integer value, I saw no easy way to prevent such mis-usage. Note also how a qif-qelse chain is parsed into nested if statements in Figure . This would be a matter of concern for run-time efficiency except that gcc with the -O option is known to do constant-propagation and dead-code-elimination, and does disambiguating such nested if statements to a single clause, leaving no residual run-time selection overhead.
Figure: Modified snoot pass example input.
Figure: Quasistatic constructs rendered into SUIF by modified snoot.