NaplesPUInstrFormats.td

From NaplesPU Documentation
Revision as of 12:07, 29 September 2017 by Catello (talk | contribs)
Jump to: navigation, search

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.