[LLVMdev] Targetting a virtual machine having no registers

Kay Roepke
Wed, 15 Nov 2006 18:36:31 -0000

Hi *!

I am writing a C compiler to target the Lego Mindstorms NXT virtual
machine. While I was implementing the optimizer and code generator I
realized that it might be useful to use LLVM for this.
The question I have is related to writing a LLVM target for this
architecture. I have read most of the documentation available on the
website and read through portions of the code (including some
TableGen interfaces for the various targets existing) but I have one
unanswered question:
As I'm targetting a virtual machine that doesn't have any registers,
only memory addresses and immediates, how would I reflect that in the
code?
Could I just specify that I don't have any registers and expect LLVM
to be happy with that?

Furthermore, I would only have global variables whose access I'd have
to arbitrate through mutexes. I imagine I could leave out anything
regarding stack frames as well (this seems to be internal to each
target).

The instruction set is very limited, and pretty high level, but I
don't think that will be a problem at all.

Thanks in advance for your advice!

cheers,

-k
--
Kay Röpke