[LLVMdev] Creating an LLVM backend for a very small stack machine

Wesley J. Landaker wjl at icecavern.net
Mon Feb 23 07:38:35 PST 2009


On Sunday 22 February 2009 23:18:25 Chris Lattner wrote:
> Have you seen:
> http://llvm.org/docs/WritingAnLLVMBackend.html

I have, and it's certainly helpful. Since the Kalescope tutorial is so 
amazingly easy to work through that it makes me jealous for a similar 
tutorial on the backend. But I'm definitely not complaining. =)

> If you're targeting a stack machine, I'd strongly recommend not using
> the llvm register allocators and just run you own custom stackifier
> pass instead.

After reading  
<http://www.llvm.org/docs/CodeGenerator.html#regAlloc_ssaDecon> is correct 
to say that if I don't use an existing LLVM register allocation pass, that 
I would need to do my stackification directly on the SSA form? 

Could/should I still reuse parts like the PHIElimination pass? It sounded 
sort of like this was very coupled with the register allocators.

I'm was initial sort of thinking that for a first (unoptimized) cut I might 
be able to just use the "simple" built-in allocator that spills every 
value, then replace that afterwards with a stack-based allocator. Does that 
sound practical, or would I be painting myself into a corner in the first 
step?

Anyway, I'm just trying to make sure I'm taking the right approach before I 
run head first into any dead ends. Ultimately, I'd rather do things "right" 
than "fast", since in my experience, "right" takes less time in the long 
run. ;)

-- 
Wesley J. Landaker <wjl at icecavern.net> <xmpp:wjl at icecavern.net>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090223/2fbc155e/attachment.sig>


More information about the llvm-dev mailing list