The instruction selection pass recognizes opportunities for using
combined arithmetic and logical operations and addressing modes
offered by the target processor. For instance, the expression x + 1
can take advantage of the "immediate add" instruction of the processor,
and on the PowerPC, the expression (x >> 6) & 0xFF can be turned
into a "rotate and mask" instruction.
Instruction selection proceeds by bottom-up rewriting over expressions.
The source language is Cminor and the target language is CminorSel.
Instruction selection for operator applications. Most of the work
is done by the processor-specific smart constructors defined
in modules SelectOp and SelectLong.
We build a partial mapping from global identifiers to their definitions,
restricting ourselves to the globals we are interested in, namely
the external function declarations that are marked as runtime library
helpers.
This ensures that the mapping remains small and that lookup_helper
below is efficient.