brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 85cb5bb Raw
86 lines · plain
1// RUN: llvm-tblgen -gen-instr-info -I %p/../../include %s | FileCheck %s2 3// CHECK: ABCForm_A4// CHECK-NOT: ABCForm_A5 6//7// include Target.td for InstrMapping class and define minimally required objects8//9 10include "llvm/Target/Target.td"11 12class DFVReg<string n> : Register<n> {13  let Namespace = "DFV";14}15 16def R0 : DFVReg<"r0">;17def DFVRegClass : RegisterClass<"DFV",[i32],0,(add R0)>;18def DFVInstrInfo : InstrInfo;19 20def DFVTest : Target {21  let InstructionSet = DFVInstrInfo;22}23 24//25// Define a number of a InstrMappings with repeated ValueCol fields26//27 28class ABCRel;29 30def getAFormFromBForm : InstrMapping {31  let FilterClass = "ABCRel";32  let RowFields = ["BaseName"];33  let ColFields = ["ABCForm"];34  let KeyCol = ["B"];35  let ValueCols = [["A"]];36}37 38def getAFormFromCForm : InstrMapping {39  let FilterClass = "ABCRel";40  let RowFields = ["BaseName"];41  let ColFields = ["ABCForm"];42  let KeyCol = ["C"];43  let ValueCols = [["A"]];44}45 46def getAFormFromDForm : InstrMapping {47  let FilterClass = "ABCRel";48  let RowFields = ["BaseName"];49  let ColFields = ["ABCForm"];50  let KeyCol = ["D"];51  let ValueCols = [["A"]];52}53 54def getAFormFromEForm : InstrMapping {55  let FilterClass = "ABCRel";56  let RowFields = ["BaseName"];57  let ColFields = ["ABCForm"];58  let KeyCol = ["E"];59  let ValueCols = [["A"]];60}61 62class I : Instruction {63  let Namespace = "DFV";64  let OutOperandList = (outs);65  let InOperandList = (ins);66 67  string BaseName = "";68  string ABCForm = "";69}70 71class isAForm { string ABCForm = "A"; }72class isBForm { string ABCForm = "B"; }73class isCForm { string ABCForm = "C"; }74class isDForm { string ABCForm = "D"; }75class isEForm { string ABCForm = "E"; }76 77let BaseName = "0" in {78  def A0 : I, ABCRel, isAForm;79  def B0 : I, ABCRel, isBForm;80  def C0 : I, ABCRel, isCForm;81  def D0 : I, ABCRel, isDForm;82  def E0 : I, ABCRel, isEForm;83}84 85defm : RemapAllTargetPseudoPointerOperands<DFVRegClass>;86