I'm new to LLVM Backend development and I'm discovering some of its working by modifying an existing backend, compiling the llvm-project and observing the changes brought to the binaries and their effect on source code compilation. I wanted to know how can I swap the ADD and SUB instructions in the RISCV assemblies so that when I compile a C code that does the sum of numbers, the binary actually does the difference of those two numbers. I learned that this can't be done by simply swapping the ADD and SUB definitions in RISCVInstrInfo.td but rather should be done at the time llvm generates assembly from the IR.
(I found it very challenging to read the documentation of the CodeGenerator and SelectionDAG - which I will eventually do in order to learn more on how the backends work)