[PATCH] D55055: [TableGen] Preserve order of output operands in DAGISelMatcherGen

Eugene Sharygin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 29 08:22:39 PST 2018


eush created this revision.
eush added reviewers: andreadb, bjope, hfinkel, RKSimon.

This fixes support in DAGISelMatcher backend for DAG nodes with multiple
result values. Previously the order of results in selected DAG nodes always
matched the order of results in ISel patterns. After the change the order of
results matches the order of operands in OutOperandList instead.

For example, given this definition from the attached test case:

  def INSTR : Instruction {
    let OutOperandList = (outs GPR:$r1, GPR:$r0);
    let InOperandList = (ins GPR:$t0, GPR:$t1);
    let Pattern = [(set i32:$r0, i32:$r1, (udivrem i32:$t0, i32:$t1))];
  }

the DAGISelMatcher backend currently produces a matcher that creates INSTR
nodes with the first result `$r0` and the second result `$r1`, contrary to the
order in the OutOperandList. The order of operands in OutOperandList does not
matter at all, which is unexpected (and unfortunate) because the order of
results of a DAG node does matters, perhaps a lot.

With this change, if the order in OutOperandList does not match the order in
Pattern, DAGISelMatcherGen emits CompleteMatch opcodes with the order of
results taken from OutOperandList. Backend writers can use it to express
result reorderings in TableGen.

If the order in OutOperandList matches the order in Pattern, the result of
DAGISelMatcherGen is unaffected.


Repository:
  rL LLVM

https://reviews.llvm.org/D55055

Files:
  test/TableGen/dag-isel-res-order.td
  utils/TableGen/CodeGenDAGPatterns.cpp
  utils/TableGen/CodeGenDAGPatterns.h
  utils/TableGen/DAGISelMatcherGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55055.175874.patch
Type: text/x-patch
Size: 8192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181129/017bd32f/attachment.bin>


More information about the llvm-commits mailing list