Towards Optimizing Code Generation by Domain-Sensitive Macro Expansion
user correction - Legacy Corrections
; Digital Systems Laboratory; Department of Computer Science and Engineering; Helsinki University of Technology; HELSINKI UNIVERSITY OF TECHNOLOGY; DIGITAL SYSTEMS LABORATORY
; Espoo, FINLAND
Many modern code generation methods use tree pattern matching with dynamic programming. However, especially in the case of an irregular special-purpose processor architecture their lack of transparency and stability may be problematic: it is difficult to predict the exact code generation result in advance, and the effects of a modification in the code generation rules may be surprisingly wide. In contrast, macro expansion techniques are intuitively transparent. When global variables are disallowed, macro expansion typically has the Church-Rosser property: the final expansion result is independent of the expansion order of the individual intermediate macro calls. Besides enabling parallel implementation, order-independence means stability: the effects of modifying a macro definition are guaranteed to remain local. The locality is actually the problem with macro expansion; code optimization is improved when an assembly language macro is sensitive to its context. For instance, it should...