3-One Pass and Multi Pass Compiler
3-One Pass and Multi Pass Compiler
Compiler Design
KCS502
by
DR PARUL YADAV
• Also collects information about the source program and stores it in symbol table, which
is passed along with the IR to the synthesis phase
Two Pass Compiler
• Constructs the desired target program from IR and the information in the symbol table
Multi Pass Compiler
Multi Pass Compiler
Multi Pass Compiler Middle End:
• Performs optimization like
Removal of useless or
unreachable code
Discovering and propagating
constant values
Relocation of computation to
a less frequently executed place
(out of loop)
specializing a computation
based on the context
• Most optimization efforts are
focused on this part.
•Enable generic optimizations to be
shared between versions of compiler
supporting different languages and
target processes
Multi Pass Compiler Back End:
• Performs more optimizations that
are for a particular computer like
Inline expansion
Dead code elimination
Constant propagation
Loop transformation etc.
• Variables are selected for the
registers
• Generates code for a particular
processor and OS
• Involves resources and storage
decisions
Optimization is optional.
Phases and Passes
Phase:
In an implementation of compiler
portions of one or more phases are
combined into modules, called as
Pass.