[PATCH] D69077: [gicombiner] Add the MatchDag structure and parse instruction DAG's from the input

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 18:36:55 PDT 2019


dsanders created this revision.
dsanders added reviewers: volkan, bogner.
Herald added subscribers: mgrang, mgorny.
Herald added a project: LLVM.

The MatchDag structure is a representation of the checks that need to be
performed and the dependencies that limit when they can happen.

There are two kinds of node in the MatchDag:

- Instrs - Represent a MachineInstr
- Predicates - Represent a check that needs to be performed (i.e. opcode, is register, same machine operand, etc.)

and two kinds of edges:

- (Traversal) Edges - Represent a register that can be traversed to find one instr from another
- Predicate Dependency Edges - Indicate that a predicate requires a piece of information to be tested.

For example, the matcher:
 (match (MOV $t, $s),

  (MOV $d, $t))

with MOV declared as an instruction of the form:

  %dst = MOV %src1

becomes the following MatchDag with the following instruction nodes:

  __anon0_0 // $t=getOperand(0), $s=getOperand(1)
  __anon0_1 // $d=getOperand(0), $t=getOperand(1)

traversal edges:

  __anon0_1[src1] --[t]--> __anon0_0[dst]

predicate nodes:

  <<$mi.getOpcode() == MOV>>:$__anonpred0_2
  <<$mi.getOpcode() == MOV>>:$__anonpred0_3

and predicate dependencies:

  __anon0_0 ==> __anonpred0_2[mi]
  __anon0_0 ==> __anonpred0_3[mi]

The result of this parse is currently unused but can be tested
using -gicombiner-stop-after-parse as done in parse-match-pattern.td. The
dump for testing includes a graphviz format dump to allow the rule to be
viewed visually.

Later on, these MatchDag's will be used to generate code and to build an
efficient decision tree.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69077

Files:
  llvm/test/TableGen/GICombinerEmitter/match-invalid.td
  llvm/test/TableGen/GICombinerEmitter/parse-match-pattern.td
  llvm/utils/TableGen/GICombinerEmitter.cpp
  llvm/utils/TableGen/GlobalISel/CMakeLists.txt
  llvm/utils/TableGen/GlobalISel/GIMatchDag.cpp
  llvm/utils/TableGen/GlobalISel/GIMatchDag.h
  llvm/utils/TableGen/GlobalISel/GIMatchDagEdge.cpp
  llvm/utils/TableGen/GlobalISel/GIMatchDagEdge.h
  llvm/utils/TableGen/GlobalISel/GIMatchDagInstr.cpp
  llvm/utils/TableGen/GlobalISel/GIMatchDagInstr.h
  llvm/utils/TableGen/GlobalISel/GIMatchDagOperands.cpp
  llvm/utils/TableGen/GlobalISel/GIMatchDagOperands.h
  llvm/utils/TableGen/GlobalISel/GIMatchDagPredicate.cpp
  llvm/utils/TableGen/GlobalISel/GIMatchDagPredicate.h
  llvm/utils/TableGen/GlobalISel/GIMatchDagPredicateDependencyEdge.cpp
  llvm/utils/TableGen/GlobalISel/GIMatchDagPredicateDependencyEdge.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69077.225339.patch
Type: text/x-patch
Size: 68017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191017/ab6ea66c/attachment.bin>


More information about the llvm-commits mailing list