[llvm-dev] Way to print all the properties of a given def

Rail Shafigulin via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 19 15:34:57 PST 2015


Does anybody know is there is a way to print all the property values for a
given def?

For example I have a following instruction definition in the .td file

let isReturn = 1, isTerminator = 1, hasDelaySlot=1, isBarrier = 1,
isCodeGenOnly = 1, Inst = 0x44004800 in {
  def RET : InstBR<0x1, (outs), (ins),
                   "l.jr\tr9",
                   [(retflag)]>;
}

Ultimately when I track it down the def tracks down to class Instruction in
include/llvm/Target/Target.td, ie.

class Instruction {
  string Namespace = "";

  dag OutOperandList;       // An dag containing the MI def operand list.
  dag InOperandList;        // An dag containing the MI use operand list.
  string AsmString = "";    // The .s format to print the instruction with.

  // Pattern - Set to the DAG pattern for this instruction, if we know of
one,
  // otherwise, uninitialized.
  list<dag> Pattern;

  // The follow state will eventually be inferred automatically from the
  // instruction pattern.

  list<Register> Uses = []; // Default to using no non-operand registers
  list<Register> Defs = []; // Default to modifying no non-operand registers
  ...
  ...
  ...
  /// UseNamedOperandTable - If set, the operand indices of this instruction
  /// can be queried via the getNamedOperandIdx() function which is
generated
  /// by TableGen.
  bit UseNamedOperandTable = 0;
}

Does anybody know if there is a way to print all those settings for my
instruction in the following format:

def RET {
  string Namespace = "My Arch Namespace";

  dag OutOperandList = (outs);       // An dag containing the MI def
operand list.
  dag InOperandList = (ins);        //  An dag containing the MI use
operand list.
  string AsmString = ".jr\tr9";    // The
  ....
  ....
  ....
}


Any help is appreciated.

-- 
R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151119/6eeef625/attachment.html>


More information about the llvm-dev mailing list