NaplesPUInstrInfo.td
NuPlusInstrInfo.td and NuPlusInstrFormats.td describe the nu+ instructions and the patterns to transform LLVM IR into machine code. The NuPlusInstrInfo.td contains the instructions definition and the patterns necessary for the translation from the LLVM IR to the nu+ machine code.
The files "compiler/include/llvm/Target/Target.td" and "compiler/include/llvm/Target/TargetSelectionDAG.td" contain the Tablegen classes used for the description.
Instructions definition
The instructions are the definition of the classes contained in the NuPlusInstrFormats.td file. The definition is done by selecting the appropriate class or multiclass and specifying the required arguments such as the opcode, the asm radix and the pattern to match. Usually the classes define require only to specify a particular node, since the pattern is already defined.
Lets consider the definition of the integer ADD instructions. According to the ISA, the ADD instruction has some variations depending on the operands' nature; e.g. they can be both stored in two 32-bit scalar registers or one of them is a 9-bit immediate. However, all these variations are encapsulated in the FArithInt_TwoOp multiclass. Thus, the ADD instruction is instantiated specifying the asm radix add, the operand add and the opcode 4.
defm ADD : FArithInt_TwoOp<"add", add, 4>;