Hello, I am learning to write a new backend for LLVM and have a few simple questions.
-
What are the differences between ‘constant’ and ‘targetconstant’, ‘globaladdress’ and ‘targetglobaladdress’? It is not clear from the document when and which should be used.
-
On the processor I am working on, there is a ‘move reg, mem_addr’ instruction.
When I try to match it using the pattern [(set Int32Regs::reg, tglobaladdr::mem_addr)]. the code generated by tblgen cannot be compiled because there will be a switch statement that contains two cases for the ‘tglobaladdr’, one is hard-coded in by tblgen and the other is generated by tbglen following the pattern I specified. The compilation fails because of the two duplicated and conflicting cases.
When I try to match it using the pattern [(set Int32Regs::reg, globaladdr::mem_addr)], the corresponding DAG node generated does not take the mem_addr as an input. As a matter of fact, it takes itself as an input and forms cycle.
I am not sure if I explain the problems clearly. I can certainly provide more information if needed.
Thank you in advance.
P.B.