I am currently trying to learn llvm backend development by writing a backend for a “toy” target. So far I have been able to write the required target description (.td) files for my backend by going through the code files of already supported backends. The tutorial at llvm official site is of no help. I tried to understand CPU0 architecture example by jonathan but it was of no use either. I tried to follow the book : "Learn LLVM 12 " but it also fails to explain clearly the steps after writing (.td) files. All the talks at LLVM youtube channel just give an abstract idea and don’t go into required details.
Can u guys please point me to an effective source which clearly explains the other steps needed for backend development ?
I am not aware of other sources than the ones you listed, sorry.
If you already have created the td files for your target, then I assume that you also created the basic infrastructure required for it (CMake files, TargetMachine, ISelLowering class etc.). Into which problem do you run now? I think it is easier to ask a concrete question here than just looking for an effective tutorial.
Up to date easy to follow examples for this is always going to be a tough problem. I’m not aware of any beyond the ones you’ve referenced.
A more brute force approach is to look at a recently added target and wherever they added a thing, do that too. Off the top of my head M68k is what I’d choose:
$ git log --reverse llvm/lib/Target/M68k/
(CSKY is newer but I’m not sure how complete that is)
It’s haphazard and you might not understand why you’re adding a particular thing (neither would I, despite having tried this before). But that’s where you can ask specific questions as redstar said. Hey this target adds one of these, what does it even do? etc.