On 01/10/15 09:35, Matthew Fortune wrote:
I guess so. I took the phrasing below for (high:m exp) to mean that high
only made sense when used with lo_sum.
True. But one can use a single high with different lo_sum expressions
when those lo_sum expressions are related.
So you might have a single high such as
(high (symbol_ref "x"))
That feeds multiple lo_sum expressions like
(lo_sum (reg) (symbol_ref "x"))
(lo_sum (reg) (const (plus (symbol_ref "x") (const_int 4))))
(lo_sum (reg) (const (plus (symbol_ref "x") (const_int 8))))
(lo_sum (reg) (const (plus (symbol_ref "x") (const_int 12)))
IIRC this gets implemented in either the move expander or a
legitimize_address hook. You start with a high/lo_sum pair for each
reference. However, you rewrite the high part to chop off low bits.
That makes many of the high expressions become common subexpressions and
they get removed by CSE in the expected ways.
You have to be careful for overflows and such. I don't recall the
precise rules there, but it was the source of problems with interfacing
with the optimizing PA linker.
Jeff