[LLVMdev] A few questions from a newbie

Peter Bacon peter.b.bacon at gmail.com
Sun Apr 19 22:35:04 PDT 2009


Hello, I am learning to write a new backend for LLVM and have a few simple
questions.

1) What are the differences between 'constant' and 'targetconstant',
'globaladdress' and 'targetglobaladdress'? It is not clear from the document
when and which should be used.

2) 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090419/bf2ef241/attachment.html>


More information about the llvm-dev mailing list