[LLVMdev] Legalizing SelectionDAGs with illegal pointer type

David Siegel david.siegel at artcom.de
Sat Jun 27 07:09:02 PDT 2015


Hi,

I recently started helping with the LLVM AVR backend [1]. The AVR is an 8 bit core with pointer type i16. That makes pointers illegal in the SelectionDAG. As far as I understand it, it is the backends job to legalize these nodes by using the ReplaceNodeResults/LowerOperation callbacks. Is that about right?

I have the feeling that the symbolic nodes carrying pointers, like FrameIndex are special and I have no idea how to properly legalize them. Is that even possible? Is it possible without modifying core LLVM? If it requires modifying core would that be a welcome contribution?

One approach could be to build FrameIndex nodes with two result values instead of one, providing the pointer as a pair. Does that make sense? I think in a way it does since at least the AVR load/store instructions in fact use a register pair. Has anybody been down that road?

For the curious the code I'm talking about is on a branch [2].

Thanks for your help,

d

[1] AVR backend: https://github.com/avr-llvm/llvm
[2] Pure 8 bit branch: https://github.com/avr-llvm/llvm/pull/129



More information about the llvm-dev mailing list