I'm trying figure out how to implement support for Small Data
Addressing (SDA) for an out-of-tree PowerPC target. The short
description of SDA is that small globals are gathered in the same
memory area and addressed using a base register + an offset. From what
I've seen the Hexagon target already support this but as that target
doesn't seem to support writing object files it doesn't take me all
My plan has been:
1. Use custom lowering for GlobalAddress and insert a target specific
ADDR_SDA node if the object pointed to is suitable for SDA. The target
specific node gets a TargetGlobalAddress node as leaf.
2. Use a pattern to match the graph "set->load->ADDR_SDA" and create a
load instruction with fixed base register from this pattern. The
pattern is similar to the one I use for the normal load instruction.
When I tried to implement this I hit an assert during tablegenning
which claims that "set" is an unknown node.
If I compare this approach with Hexagon it instead matches against
"atomic_load_32". I tried this too but then I don't have any
destination register available and can't use the load instruction.
If someone has a good picture of how to implement this I would really
appreciate some advice. I suspect other targets have similar
addressing modes and if so it would be nice to be pointed towards the
Thanks in advance!