Notes to self


  1. LIR generation
  2. If any instruction is a CALL, annotate that we must save the RA register.
  3. Recognize all literals -2048 <= x <= 2047.
  4. Migrate constants: -2B <= x <= 2B but not -2048 <= x <= 2047 --> LUI/ADDI pairs
  5. Migrate big constants into constant pool for this procedure.
  6. If constant pool is non-empty, annotate that we must save/reset/restore GP.
  7. Insert SYNCs at basic block boundaries. [1]
  8. Decompose higher-level primitives until (more or less) one primitive maps to one CPU instruction.
  9. Assemble the remaining primitives into a symbolic assembly listing.
  10. Peephole optimize. Replace common phrases/idioms with shorter equivalents.
  11. Expand prolog, epilog.
  12. Generate final binary image from remaining (symbolic) assembly listing.

Notes 1. We may elide this step if we're careful to introduce them when first generating LIR code.