Answers are grounded in this paper and cite their sources.
Demonstrates improved code optimization with peephole optimizer in naive code generators, indicating enhanced performance.
Peephole optimizers improve object code by replacing certain sequences of instructions with better sequences. This paper describes PO, a peephole optimizer that uses a symbolic machine description to simulate pairs of adjacent instructions, replacing them, where possible, with an equivalent single instruction. As a result of this organization, PO is machine independent and can be described formally and concisely: when PO is finished, no instruction, and no pair of adjacent instructions, can be replaced with a cheaper single instruction that has the same effect. This thoroughness allows PO to relieve code generators of much case analysis; for example, they might produce only load/add-register sequences and rely on PO to, where possible, discard them in favor or add-memory, add-immediate, or increment instructions. Experiments indicate that naive code generators can give good code if used with PO.
No takes yet. Share an insight, caveat, or question.
Davidson et al. (1980) studied this question.
Synapse has enriched 10 related papers. Consider them for comparative context: