[LLVMdev] Simple stack machine

Chris Lattner clattner at apple.com
Fri Nov 21 08:33:15 PST 2008


On Nov 21, 2008, at 7:01 AM, Matthijs Kooijman wrote:

> Hi all,
>
> we're looking around a bit for a small and simple stack-based  
> architecture,
> that we could use as a sidekick to the DSP processor we are  
> developing.
>
> We've been looking at ZPU for a bit, but are also considering  
> developing our
> own hardware for this (possibly very much tuned to LLVM). Of course,  
> that
> would also mean building an LLVM backend. I guess having a very  
> simple backend
> would also server LLVM well, as an example backend and one to base new
> architectures on.
>
> Now, on to my real question. Is there any LLVM backend for a (simple)
> stackbased machine? Anyone working on something like this? Anything  
> we can use
> (either directly, or as an example and/or to get an idea how much  
> work would
> be involved)?

Hi Matthijs,

My approach for this sort of machine would be to build a normal target  
machine.  Follow the approach the x86 backend uses for its register  
stack: have two sets of instructions.  Pre "stackifying", the  
instructions take registers, afterwards they take implicit stack  
slots.  Run the stackifier immediately after register allocation and  
you should be good,

-Chris



More information about the llvm-dev mailing list