[all-commits] [llvm/llvm-project] 390c8b: [gicombiner] Add the MatchDag structure and parse ...

Daniel Sanders via All-commits all-commits at lists.llvm.org
Tue Dec 17 07:28:15 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 390c8baa5440dda8907688d9ef860f6982bd925f
      https://github.com/llvm/llvm-project/commit/390c8baa5440dda8907688d9ef860f6982bd925f
  Author: Daniel Sanders <daniel_l_sanders at apple.com>
  Date:   2019-12-17 (Tue, 17 Dec 2019)

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

  Log Message:
  -----------
  [gicombiner] Add the MatchDag structure and parse instruction DAG's from the input

Summary:
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.

Reviewers: volkan, bogner

Reviewed By: volkan

Subscribers: arsenm, mgorny, mgrang, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69077




More information about the All-commits mailing list