[LLVMdev] Types in TableGen instruction selection patterns

Jakob Stoklund Olesen stoklund at 2pi.dk
Sun Mar 24 12:50:02 PDT 2013

I have updated TableGen to support a new format for instruction selection patterns.


  def : Pat<(subc IntRegs:$b, IntRegs:$c), (SUBCCrr IntRegs:$b, IntRegs:$c)>;


  def : Pat<(subc i32:$b, i32:$c), (SUBCCrr $b, $c)>;

Since the pattern matching happens on a DAG with type labels, not register classes, I think it makes more sense to specify types directly on the input patterns. The new syntax also helps avoid the problem where TableGen emits lots of type inference errors when multiple types are added to a register class.

In the output pattern, it is no longer necessary to duplicate the register classes or types of register operands.

For immediate operands, the 'imm' tag is still required:

  def : Pat<(subc i32:$b, simm13:$val), (SUBCCri $b, imm:$val)>;

I would like for the old register class notation to go away eventually.


More information about the llvm-dev mailing list