Compiler code optimization: AST vs. IR -
, define ir 3-address code type representation (i realize 1 can mean ast representation well).
it understanding that, when writing best-practice compiler imperative language, code optimization happens both on ast (probably best using visitor pattern), , on ir produced ast.
(a) correct?
(b) type of optimization steps best handled on ast before producing ir? (reference article/a list online welcome long deals imperative language)
the compiler i'm working on decaf (which might know) has deep cfg (single) class inheritance; i'll add features not part of such type coercion. hand-coded (using no tools whatsoever). not homework; writing fun.
(a) yes.
(b) constant folding 1 example; cse another; in fact expression evaluation. ir-phase optimizations more results flow analysis.
Comments
Post a Comment