I have implemented only ADD instruction for my target so far. How to test if it is generating the code that I am expecting? I saw the existing codegen lit tests for other targets and all of them were llvm IR instructions that was inside a function or main.
Is it even possible to test a single llvm instruction like add without having the function call and return support for the target?
If not, what is the best order of implementing the instructions so that each instruction could be tested as and when it is implemented?
For globalisel you can test selection of a single instruction and sidestep the ABI lowering code with a MIR test. Generally you need at minimum the ABI handling implemented to write a meaningful IR test