As per title, I would like to modify LLVM such that, when compiling a C program, it can only select from the ARM instructions that I allow for. Other instructions, if possible, should be replaced by those in my set. If this is not possible, an error should be returned.
I have tried looking this up and have found virtually nothing. One problem I have is that when looking at stuff like tablegen in the LLVM/lib/target/arm it's not exactly clear what, if anything, to modify. Lib/IR contains some more stuff, but again, I'm not sure what to touch here.
I found a SO answer that (I'm pretty sure) modified the IR and inserted a call to expand a given instruction if possible. This is unreasonable, as my subset is relatively small. I'd have to include a *lot* of exclusion/expansion calls.
I also found some notes that suggest writing a pass to go and call erase from parent or something along those lines, but again, I'm not entirely sure what this means.
I'm familiar with the general architecture of how LLVM works, that is, frontend, transformation into IR, codegen, optimization passes, but that's about it. I'm not afraid of reading, either, so feel free to throw terms or links at me. I've briefly skimmed the manual and found the adding new instruction section, but I'm still somewhat confused as to how to lock out instructions like, say, fadd (floatingpoint add) so that doing so in C is an error in this modified compiler.
Thank you for the help.