Difference between revisions of "NaplesPUInstrFormats.td"
(→Instruction Formats) |
|||
Line 17: | Line 17: | ||
An example is the '''FArithInt_TwoOp''' multiclass. It is used with arithmetic instructions with two integer operands. When FArithInt_TwoOp instrcution is defined, Talbegen automatically instantiate all the possible variations according to the classes contained in the multiclass definition. | An example is the '''FArithInt_TwoOp''' multiclass. It is used with arithmetic instructions with two integer operands. When FArithInt_TwoOp instrcution is defined, Talbegen automatically instantiate all the possible variations according to the classes contained in the multiclass definition. | ||
− | However, there is also a '''Pseudo''' class | + | However, there is also a '''Pseudo''' class which can be used for nodes that cannot be translated into machine nodes through a pattern but require other transformations. |
== Custom Nodes == | == Custom Nodes == |
Revision as of 15:50, 30 September 2017
NuPlusInstrFormats.td and NuPlusInstrInfo.td describe the nu+ instructions and the patterns to transform LLVM IR into machine code. The NuPlusInstrFormats.td contains the classes that describe the nu+ instruction formats, support classes that facilitates the instructions definition and also the definition nodes which make the pattern recognition easier.
The files "compiler/include/llvm/Target/Target.td" and "compiler/include/llvm/Target/TargetSelectionDAG.td" contain the Tablegen classes used for the decription.
Instruction Formats
An instruction is specified in TableGen by the class Instruction, which contains the following fields:
- Output operands, this contains the output value(s) defined by the instruction as a result of its computation;
- Input operands, this holds all the input value(s) used by the instruction as its input operands;
- Assembly string,this stores the string that is recognized by the assembler or that is printed by the disassembler;
- DAG pattern, this is the DAG pattern of machine-independent SelectionDAG nodes that is matched by the instruction selector to produce an instance of the corresponding target-specific instruction.
To handle the nu+ ISA complexity, a hierarchy of classes has been created. Each level of the hierarchy refines an aspect of the nu+ instruction formats. For example the FR_TwoOp_Unmasked_32 class refines the FR class providing an easy way to define unmasked instructions of type R that takes two 32-bit operands.
The instruction formats classes are then used to create instruction multiclasses. In this way all the possible variants are generated with a single instruction definition. An example is the FArithInt_TwoOp multiclass. It is used with arithmetic instructions with two integer operands. When FArithInt_TwoOp instrcution is defined, Talbegen automatically instantiate all the possible variations according to the classes contained in the multiclass definition.
However, there is also a Pseudo class which can be used for nodes that cannot be translated into machine nodes through a pattern but require other transformations.