DAGISelMatcher.cpp revision 8ef9c7958ad7a23ad15d7ff59e1377aec10ca42a
1//===- DAGISelMatcher.cpp - Representation of DAG pattern matcher ---------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#include "DAGISelMatcher.h" 11#include "CodeGenDAGPatterns.h" 12#include "CodeGenTarget.h" 13#include "llvm/Support/raw_ostream.h" 14using namespace llvm; 15 16void MatcherNode::dump() const { 17 print(errs()); 18} 19 20void 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"; 23} 24 25void MatcherNode::printChild(raw_ostream &OS, unsigned indent) const { 26 if (Child) 27 return Child->print(OS, indent); 28 OS.indent(indent) << "<null child>\n"; 29} 30 31 32void PushMatcherNode::print(raw_ostream &OS, unsigned indent) const { 33 OS.indent(indent) << "Push\n"; 34 printChild(OS, indent+2); 35 Failure->print(OS, indent); 36} 37 38void RecordMatcherNode::print(raw_ostream &OS, unsigned indent) const { 39 OS.indent(indent) << "Record\n"; 40 printChild(OS, indent); 41} 42 43void MoveChildMatcherNode::print(raw_ostream &OS, unsigned indent) const { 44 OS.indent(indent) << "MoveChild " << ChildNo << '\n'; 45 printChild(OS, indent); 46} 47 48void MoveParentMatcherNode::print(raw_ostream &OS, unsigned indent) const { 49 OS.indent(indent) << "MoveParent\n"; 50 printChild(OS, indent); 51} 52 53void CheckSameMatcherNode::print(raw_ostream &OS, unsigned indent) const { 54 OS.indent(indent) << "CheckSame " << MatchNumber << '\n'; 55 printChild(OS, indent); 56} 57 58void CheckPatternPredicateMatcherNode:: 59print(raw_ostream &OS, unsigned indent) const { 60 OS.indent(indent) << "CheckPatternPredicate " << Predicate << '\n'; 61 printChild(OS, indent); 62} 63 64void CheckPredicateMatcherNode::print(raw_ostream &OS, unsigned indent) const { 65 OS.indent(indent) << "CheckPredicate " << PredName << '\n'; 66 printChild(OS, indent); 67} 68 69void CheckOpcodeMatcherNode::print(raw_ostream &OS, unsigned indent) const { 70 OS.indent(indent) << "CheckOpcode " << OpcodeName << '\n'; 71 printChild(OS, indent); 72} 73 74void CheckTypeMatcherNode::print(raw_ostream &OS, unsigned indent) const { 75 OS.indent(indent) << "CheckType " << getEnumName(Type) << '\n'; 76 printChild(OS, indent); 77} 78 79void CheckIntegerMatcherNode::print(raw_ostream &OS, unsigned indent) const { 80 OS.indent(indent) << "CheckInteger " << Value << '\n'; 81 printChild(OS, indent); 82} 83 84void CheckCondCodeMatcherNode::print(raw_ostream &OS, unsigned indent) const { 85 OS.indent(indent) << "CheckCondCode ISD::" << CondCodeName << '\n'; 86 printChild(OS, indent); 87} 88 89void CheckValueTypeMatcherNode::print(raw_ostream &OS, unsigned indent) const { 90 OS.indent(indent) << "CheckValueType MVT::" << TypeName << '\n'; 91 printChild(OS, indent); 92} 93 94void CheckComplexPatMatcherNode::print(raw_ostream &OS, unsigned indent) const { 95 OS.indent(indent) << "CheckComplexPat " << Pattern.getSelectFunc() << '\n'; 96 printChild(OS, indent); 97} 98 99void CheckAndImmMatcherNode::print(raw_ostream &OS, unsigned indent) const { 100 OS.indent(indent) << "CheckAndImm " << Value << '\n'; 101 printChild(OS, indent); 102} 103 104void CheckOrImmMatcherNode::print(raw_ostream &OS, unsigned indent) const { 105 OS.indent(indent) << "CheckOrImm " << Value << '\n'; 106 printChild(OS, indent); 107} 108 109void CheckFoldableChainNodeMatcherNode::print(raw_ostream &OS, 110 unsigned indent) const { 111 OS.indent(indent) << "CheckFoldableChainNode\n"; 112 printChild(OS, indent); 113} 114 115void CheckChainCompatibleMatcherNode::print(raw_ostream &OS, 116 unsigned indent) const { 117 OS.indent(indent) << "CheckChainCompatibleMatcherNode " << PreviousOp << "\n"; 118 printChild(OS, indent); 119} 120