5 ms·
> Though it is just an example, and not normative, it is very clear from the wording that the locus of valid optimizations is the translation unit. I don't thi
by __david__ 12y ago
> Though it is just an example, and not normative, it is very clear from the wording that the locus of valid optimizations is the translation unit.
I don't think that's clear at all. As you said, it's just an example.
> Phase 8 only consists of resolving references; the last semantic analysis takes place in phase 7.
Why do you think that the only place you can optimize is during the "semantic analysis" phase?
To me the phrase "All such translator output is collected into a program image" (from step 8) is vague enough to not rule out optimization during "collection".
- kazinator 12y agoThe word "all" in "all such translator output" seems to rule out removing any code, such as the zero memset. "Translator output" suggests that translation is complete and we just have its output to link together. Optimization is "semantic analysis"; you cannot optimize without reasoning about meaning, and optimization also implies that translation is still going on: the output of earlier translation is still being tweaked, with regard to the meaning of the original source.