Attempting to write an LLVM backend. No good tutorial available

3k Views Asked by At

I am trying to write an LLVM backend for my custom processor that I have designed recently.

I tried to follow the official tutorial at http://llvm.org/docs/WritingAnLLVMBackend.html

But it is so vague, so incomplete and blurry that I failed to follow it.

I then started to search for other tutorials online and all of them suffer from the same symptoms of the original tutorial. It seems the authors assume lots of pre-readings and write their tutorials without necessary preliminary explanations.

How can I find a tutorial or anything that can set me up to write a functional backend in LLVM?

-- Update: I see two down votes and two up votes. The down votes says my question is not related to programming. I wonder how the moderators have concluded that writing a compiler is not related to programming.

1

There are 1 best solutions below

0
alexanius On

I've came across the same problem and there is no good tutorials indeed. But hope some of them I've found should help you if it is still actual or anyone else who read this.

First of all there is a common advice to copy-paste an existing backend and modify it for your CPU. But this is not a good practice because you don't understand what you are doing. So I've found a book with short description of llvm architecture. It can help you much. Also there is a step-by-step tutorial for implementing backend for CPU0 processor. Other sources are miscelantious slides that could be easyly found by yourself.