1 //===- DAGISelMatcher.cpp - Representation of DAG pattern matcher ---------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "DAGISelMatcher.h"
11 #include "CodeGenDAGPatterns.h"
12 #include "CodeGenTarget.h"
13 #include "llvm/Support/raw_ostream.h"
16 void MatcherNode::dump() const {
20 void EmitNodeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
21 OS.indent(indent) << "EmitNode: Src = " << *Pattern.getSrcPattern() << "\n";
22 OS.indent(indent) << "EmitNode: Dst = " << *Pattern.getDstPattern() << "\n";
25 void MatcherNode::printNext(raw_ostream &OS, unsigned indent) const {
27 return Next->print(OS, indent);
28 OS.indent(indent) << "<null next field>\n";
32 void PushMatcherNode::print(raw_ostream &OS, unsigned indent) const {
33 OS.indent(indent) << "Push\n";
34 printNext(OS, indent+2);
35 Failure->print(OS, indent);
38 void RecordMatcherNode::print(raw_ostream &OS, unsigned indent) const {
39 OS.indent(indent) << "Record\n";
40 printNext(OS, indent);
43 void MoveChildMatcherNode::print(raw_ostream &OS, unsigned indent) const {
44 OS.indent(indent) << "MoveChild " << ChildNo << '\n';
45 printNext(OS, indent);
48 void MoveParentMatcherNode::print(raw_ostream &OS, unsigned indent) const {
49 OS.indent(indent) << "MoveParent\n";
50 printNext(OS, indent);
53 void CheckSameMatcherNode::print(raw_ostream &OS, unsigned indent) const {
54 OS.indent(indent) << "CheckSame " << MatchNumber << '\n';
55 printNext(OS, indent);
58 void CheckPatternPredicateMatcherNode::
59 print(raw_ostream &OS, unsigned indent) const {
60 OS.indent(indent) << "CheckPatternPredicate " << Predicate << '\n';
61 printNext(OS, indent);
64 void CheckPredicateMatcherNode::print(raw_ostream &OS, unsigned indent) const {
65 OS.indent(indent) << "CheckPredicate " << PredName << '\n';
66 printNext(OS, indent);
69 void CheckOpcodeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
70 OS.indent(indent) << "CheckOpcode " << OpcodeName << '\n';
71 printNext(OS, indent);
74 void CheckTypeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
75 OS.indent(indent) << "CheckType " << getEnumName(Type) << '\n';
76 printNext(OS, indent);
79 void CheckIntegerMatcherNode::print(raw_ostream &OS, unsigned indent) const {
80 OS.indent(indent) << "CheckInteger " << Value << '\n';
81 printNext(OS, indent);
84 void CheckCondCodeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
85 OS.indent(indent) << "CheckCondCode ISD::" << CondCodeName << '\n';
86 printNext(OS, indent);
89 void CheckValueTypeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
90 OS.indent(indent) << "CheckValueType MVT::" << TypeName << '\n';
91 printNext(OS, indent);
94 void CheckComplexPatMatcherNode::print(raw_ostream &OS, unsigned indent) const {
95 OS.indent(indent) << "CheckComplexPat " << Pattern.getSelectFunc() << '\n';
96 printNext(OS, indent);
99 void CheckAndImmMatcherNode::print(raw_ostream &OS, unsigned indent) const {
100 OS.indent(indent) << "CheckAndImm " << Value << '\n';
101 printNext(OS, indent);
104 void CheckOrImmMatcherNode::print(raw_ostream &OS, unsigned indent) const {
105 OS.indent(indent) << "CheckOrImm " << Value << '\n';
106 printNext(OS, indent);
109 void CheckFoldableChainNodeMatcherNode::print(raw_ostream &OS,
110 unsigned indent) const {
111 OS.indent(indent) << "CheckFoldableChainNode\n";
112 printNext(OS, indent);
115 void CheckChainCompatibleMatcherNode::print(raw_ostream &OS,
116 unsigned indent) const {
117 OS.indent(indent) << "CheckChainCompatibleMatcherNode " << PreviousOp << "\n";
118 printNext(OS, indent);