Lines Matching refs:tree
72 void emitStaticMatcher(DagNode tree, std::string funcName);
76 void emitMatchLogic(DagNode tree, StringRef opName);
86 void emitMatch(DagNode tree, StringRef name, int depth);
89 void emitStaticMatchCall(DagNode tree, StringRef name);
96 void emitNativeCodeMatch(DagNode tree, StringRef name, int depth);
100 void emitOpMatch(DagNode tree, StringRef opName, int depth);
105 void emitOperandMatch(DagNode tree, StringRef opName, StringRef operandName,
111 void emitEitherOperandMatch(DagNode tree, DagNode eitherArgTree,
117 void emitAttributeMatch(DagNode tree, StringRef opName, int argIndex,
152 StringRef handleReplaceWithValue(DagNode tree);
168 TrailingDirectives getTrailingDirectives(DagNode tree);
174 std::string handleLocationDirective(DagNode tree);
184 std::string handleOpCreation(DagNode tree, int resultIndex, int depth);
216 void collectOps(DagNode tree, llvm::SmallPtrSetImpl<const Operator *> &ops);
350 void PatternEmitter::emitStaticMatcher(DagNode tree, std::string funcName) { in emitStaticMatcher() argument
359 pattern.collectBoundSymbols(tree, symbolInfoMap, /*isSrcPattern=*/true); in emitStaticMatcher()
370 emitMatch(tree, "op0", /*depth=*/1); in emitStaticMatcher()
378 void PatternEmitter::emitMatch(DagNode tree, StringRef name, int depth) { in emitMatch() argument
379 if (tree.isNativeCodeCall()) { in emitMatch()
380 emitNativeCodeMatch(tree, name, depth); in emitMatch()
384 if (tree.isOperation()) { in emitMatch()
385 emitOpMatch(tree, name, depth); in emitMatch()
392 void PatternEmitter::emitStaticMatchCall(DagNode tree, StringRef opName) { in emitStaticMatchCall() argument
393 std::string funcName = staticMatcherHelper.getMatcherName(tree); in emitStaticMatchCall()
409 pattern.collectBoundSymbols(tree, localSymbolMap, /*isSrcPattern=*/true); in emitStaticMatchCall()
433 void PatternEmitter::emitNativeCodeMatch(DagNode tree, StringRef opName, in emitNativeCodeMatch() argument
436 LLVM_DEBUG(tree.print(llvm::dbgs())); in emitNativeCodeMatch()
444 if (staticMatcherHelper.useStaticMatcher(tree) && in emitNativeCodeMatch()
445 !staticMatcherHelper.getMatcherName(tree).empty()) { in emitNativeCodeMatch()
446 emitStaticMatchCall(tree, opName); in emitNativeCodeMatch()
460 for (int i = 0, e = tree.getNumArgs(); i != e; ++i) { in emitNativeCodeMatch()
462 if (DagNode argTree = tree.getArgAsNestedDag(i)) { in emitNativeCodeMatch()
468 auto leaf = tree.getArgAsLeaf(i); in emitNativeCodeMatch()
479 auto tail = getTrailingDirectives(tree); in emitNativeCodeMatch()
484 auto fmt = tree.getNativeCodeTemplate(); in emitNativeCodeMatch()
496 for (int i = 0, e = tree.getNumArgs() - tail.numDirectives; i != e; ++i) { in emitNativeCodeMatch()
497 auto name = tree.getArgName(i); in emitNativeCodeMatch()
503 for (int i = 0, e = tree.getNumArgs() - tail.numDirectives; i != e; ++i) { in emitNativeCodeMatch()
507 if (DagNode argTree = tree.getArgAsNestedDag(i)) { in emitNativeCodeMatch()
514 DagLeaf leaf = tree.getArgAsLeaf(i); in emitNativeCodeMatch()
533 i, tree.getNativeCodeTemplate(), in emitNativeCodeMatch()
542 void PatternEmitter::emitOpMatch(DagNode tree, StringRef opName, int depth) { in emitOpMatch() argument
543 Operator &op = tree.getDialectOp(opMap); in emitOpMatch()
557 if (staticMatcherHelper.useStaticMatcher(tree) && in emitOpMatch()
558 !staticMatcherHelper.getMatcherName(tree).empty()) { in emitOpMatch()
559 emitStaticMatchCall(tree, opName); in emitOpMatch()
581 auto name = tree.getSymbol(); in emitOpMatch()
585 for (int i = 0, e = tree.getNumArgs(), nextOperand = 0; i != e; ++i) { in emitOpMatch()
590 if (DagNode argTree = tree.getArgAsNestedDag(i)) { in emitOpMatch()
592 emitEitherOperandMatch(tree, argTree, castedName, i, nextOperand, in emitOpMatch()
628 emitOperandMatch(tree, castedName, operandName.str(), in emitOpMatch()
629 /*operandMatcher=*/tree.getArgAsLeaf(i), in emitOpMatch()
630 /*argName=*/tree.getArgName(i), in emitOpMatch()
634 emitAttributeMatch(tree, opName, i, depth); in emitOpMatch()
644 void PatternEmitter::emitOperandMatch(DagNode tree, StringRef opName, in emitOperandMatch() argument
648 Operator &op = tree.getDialectOp(opMap); in emitOperandMatch()
684 auto res = symbolInfoMap.findBoundSymbol(argName, tree, op, argIndex); in emitOperandMatch()
689 void PatternEmitter::emitEitherOperandMatch(DagNode tree, DagNode eitherArgTree, in emitEitherOperandMatch() argument
696 Operator &op = tree.getDialectOp(opMap); in emitEitherOperandMatch()
727 emitOperandMatch(tree, opName, /*operandName=*/formatv("v{0}", i).str(), in emitEitherOperandMatch()
757 void PatternEmitter::emitAttributeMatch(DagNode tree, StringRef opName, in emitAttributeMatch() argument
759 Operator &op = tree.getDialectOp(opMap); in emitAttributeMatch()
786 auto matcher = tree.getArgAsLeaf(argIndex); in emitAttributeMatch()
819 auto name = tree.getArgName(argIndex); in emitAttributeMatch()
844 void PatternEmitter::emitMatchLogic(DagNode tree, StringRef opName) { in emitMatchLogic() argument
847 emitMatch(tree, opName, depth); in emitMatchLogic()
919 void PatternEmitter::collectOps(DagNode tree, in collectOps() argument
922 if (tree.isOperation()) { in collectOps()
923 const Operator &op = tree.getDialectOp(opMap); in collectOps()
930 for (unsigned i = 0, e = tree.getNumArgs(); i != e; ++i) in collectOps()
931 if (auto child = tree.getArgAsNestedDag(i)) in collectOps()
1132 StringRef PatternEmitter::handleReplaceWithValue(DagNode tree) { in handleReplaceWithValue() argument
1133 assert(tree.isReplaceWithValue()); in handleReplaceWithValue()
1135 if (tree.getNumArgs() != 1) { in handleReplaceWithValue()
1140 if (!tree.getSymbol().empty()) { in handleReplaceWithValue()
1144 return tree.getArgName(0); in handleReplaceWithValue()
1147 std::string PatternEmitter::handleLocationDirective(DagNode tree) { in handleLocationDirective() argument
1148 assert(tree.isLocationDirective()); in handleLocationDirective()
1149 auto lookUpArgLoc = [this, &tree](int idx) { in handleLocationDirective()
1151 return symbolInfoMap.getValueAndRangeUse(tree.getArgName(idx), lookupFmt); in handleLocationDirective()
1154 if (tree.getNumArgs() == 0) in handleLocationDirective()
1158 if (!tree.getSymbol().empty()) in handleLocationDirective()
1161 if (tree.getNumArgs() == 1) { in handleLocationDirective()
1162 DagLeaf leaf = tree.getArgAsLeaf(0); in handleLocationDirective()
1175 for (int i = 0, e = tree.getNumArgs(); i != e; ++i) { in handleLocationDirective()
1176 DagLeaf leaf = tree.getArgAsLeaf(i); in handleLocationDirective()
1246 std::string PatternEmitter::handleReplaceWithNativeCodeCall(DagNode tree, in handleReplaceWithNativeCodeCall() argument
1249 LLVM_DEBUG(tree.print(llvm::dbgs())); in handleReplaceWithNativeCodeCall()
1252 auto fmt = tree.getNativeCodeTemplate(); in handleReplaceWithNativeCodeCall()
1256 auto tail = getTrailingDirectives(tree); in handleReplaceWithNativeCodeCall()
1261 for (int i = 0, e = tree.getNumArgs() - tail.numDirectives; i != e; ++i) { in handleReplaceWithNativeCodeCall()
1262 if (tree.isNestedDagArg(i)) { in handleReplaceWithNativeCodeCall()
1264 handleResultPattern(tree.getArgAsNestedDag(i), i, depth + 1)); in handleReplaceWithNativeCodeCall()
1267 handleOpArgument(tree.getArgAsLeaf(i), tree.getArgName(i))); in handleReplaceWithNativeCodeCall()
1291 if (tree.getNumReturnsOfNativeCode() != 0) { in handleReplaceWithNativeCodeCall()
1294 SymbolInfoMap::getValuePackName(tree.getSymbol()).str(); in handleReplaceWithNativeCodeCall()
1298 symbolInfoMap.bindValues(varName, tree.getNumReturnsOfNativeCode()); in handleReplaceWithNativeCodeCall()
1304 if (!tree.getSymbol().empty()) in handleReplaceWithNativeCodeCall()
1305 symbol = tree.getSymbol().str(); in handleReplaceWithNativeCodeCall()
1332 PatternEmitter::getTrailingDirectives(DagNode tree) { in getTrailingDirectives() argument
1336 auto numPatArgs = tree.getNumArgs(); in getTrailingDirectives()
1338 auto dagArg = tree.getArgAsNestedDag(i); in getTrailingDirectives()
1376 std::string PatternEmitter::handleOpCreation(DagNode tree, int resultIndex, in handleOpCreation() argument
1379 LLVM_DEBUG(tree.print(llvm::dbgs())); in handleOpCreation()
1382 Operator &resultOp = tree.getDialectOp(opMap); in handleOpCreation()
1384 auto numPatArgs = tree.getNumArgs(); in handleOpCreation()
1386 auto tail = getTrailingDirectives(tree); in handleOpCreation()
1404 for (int i = 0, e = tree.getNumArgs() - tail.numDirectives; i != e; ++i) { in handleOpCreation()
1405 if (auto child = tree.getArgAsNestedDag(i)) in handleOpCreation()
1416 if (tree.getSymbol().empty()) { in handleOpCreation()
1421 resultValue = std::string(tree.getSymbol()); in handleOpCreation()
1445 createAggregateLocalVarsForOpArgs(tree, childNodeNames, depth); in handleOpCreation()
1465 createSeparateLocalVarsForOpArgs(tree, childNodeNames); in handleOpCreation()
1469 supplyValuesForOpArgs(tree, childNodeNames, depth); in handleOpCreation()
1484 createAggregateLocalVarsForOpArgs(tree, childNodeNames, depth); in handleOpCreation()