-
Notifications
You must be signed in to change notification settings - Fork 32
PeepholeOptimizer
If you're writing the kind of operation that works with reg/op2/branchf
or reg/op2/setreg
, really the only place that should know about your code is the peephole optimizer.
Until the peephole optimizer gets rewritten, adding these operations is probably going to be gruesome. The peephole optimizer lives in source:trunk/larceny_src/src/Asm/Sparc/peepopt.sch, and it's a hand-coded decision tree.
You probably want to add your specialized operations in the peep-reg/op2/setreg
and peep-reg/op1/branchf
procedures, and maybe the immediate versions thereof as well.
This will get instruction sequences like the following:
reg rs1
op2 spiffy, rs2
setreg rd
into:
reg/op2/setreg internal:spiffy, rs1, rs2, rd
Another part of the compiler will have to figure out that it can generate spiffy
in the first place--it might be necessary to uncomment some stuff in representation analysis or ... something.