• Home
  • Raw
  • Download

Lines Matching refs:OS

55                            unsigned StartIdx, formatted_raw_ostream &OS);
57 void EmitPredicateFunctions(formatted_raw_ostream &OS);
59 void EmitHistogram(const Matcher *N, formatted_raw_ostream &OS);
62 formatted_raw_ostream &OS);
115 static uint64_t EmitVBRValue(uint64_t Val, raw_ostream &OS) { in EmitVBRValue() argument
117 OS << Val << ", "; in EmitVBRValue()
124 OS << (Val&127) << "|128,"; in EmitVBRValue()
128 OS << Val; in EmitVBRValue()
130 OS << "/*" << InVal << "*/"; in EmitVBRValue()
131 OS << ", "; in EmitVBRValue()
139 formatted_raw_ostream &OS) { in EmitMatcher() argument
140 OS.PadToColumn(Indent*2); in EmitMatcher()
152 OS << "OPC_Scope, "; in EmitMatcher()
156 OS << "/*" << CurrentIdx << "*/"; in EmitMatcher()
157 OS.PadToColumn(Indent*2) << "/*Scope*/ "; in EmitMatcher()
159 OS.PadToColumn(Indent*2); in EmitMatcher()
174 raw_svector_ostream OS(TmpBuf); in EmitMatcher() local
175 formatted_raw_ostream FOS(OS); in EmitMatcher()
182 CurrentIdx += EmitVBRValue(ChildSize, OS); in EmitMatcher()
184 OS << "/*->" << CurrentIdx+ChildSize << "*/"; in EmitMatcher()
187 OS.PadToColumn(CommentIndent) << "// " << SM->getNumChildren() in EmitMatcher()
191 OS << '\n' << TmpBuf.str(); in EmitMatcher()
197 OS << "/*" << CurrentIdx << "*/"; in EmitMatcher()
198 OS.PadToColumn(Indent*2) << "0, "; in EmitMatcher()
200 OS << "/*End of Scope*/"; in EmitMatcher()
201 OS << '\n'; in EmitMatcher()
206 OS << "OPC_RecordNode,"; in EmitMatcher()
208 OS.PadToColumn(CommentIndent) << "// #" in EmitMatcher()
211 OS << '\n'; in EmitMatcher()
215 OS << "OPC_RecordChild" << cast<RecordChildMatcher>(N)->getChildNo() in EmitMatcher()
218 OS.PadToColumn(CommentIndent) << "// #" in EmitMatcher()
221 OS << '\n'; in EmitMatcher()
225 OS << "OPC_RecordMemRef,\n"; in EmitMatcher()
229 OS << "OPC_CaptureGlueInput,\n"; in EmitMatcher()
233 OS << "OPC_MoveChild, " << cast<MoveChildMatcher>(N)->getChildNo() << ",\n"; in EmitMatcher()
237 OS << "OPC_MoveParent,\n"; in EmitMatcher()
241 OS << "OPC_CheckSame, " in EmitMatcher()
246 OS << "OPC_CheckChild" in EmitMatcher()
253 OS << "OPC_CheckPatternPredicate, " << getPatternPredicate(Pred) << ','; in EmitMatcher()
255 OS.PadToColumn(CommentIndent) << "// " << Pred; in EmitMatcher()
256 OS << '\n'; in EmitMatcher()
261 OS << "OPC_CheckPredicate, " << getNodePredicate(Pred) << ','; in EmitMatcher()
263 OS.PadToColumn(CommentIndent) << "// " << Pred.getFnName(); in EmitMatcher()
264 OS << '\n'; in EmitMatcher()
269 OS << "OPC_CheckOpcode, TARGET_VAL(" in EmitMatcher()
279 OS << "OPC_SwitchOpcode "; in EmitMatcher()
282 OS << "OPC_SwitchType "; in EmitMatcher()
287 OS << "/*" << NumCases << " cases */"; in EmitMatcher()
288 OS << ", "; in EmitMatcher()
315 raw_svector_ostream OS(TmpBuf); in EmitMatcher() local
316 formatted_raw_ostream FOS(OS); in EmitMatcher()
325 OS << "/*" << CurrentIdx << "*/"; in EmitMatcher()
326 OS.PadToColumn(Indent*2); in EmitMatcher()
328 OS << (isa<SwitchOpcodeMatcher>(N) ? in EmitMatcher()
333 CurrentIdx += EmitVBRValue(ChildSize, OS); in EmitMatcher()
336 OS << "TARGET_VAL(" << SOM->getCaseOpcode(i).getEnumName() << "),"; in EmitMatcher()
338 OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i)) << ','; in EmitMatcher()
343 OS << "// ->" << CurrentIdx+ChildSize; in EmitMatcher()
344 OS << '\n'; in EmitMatcher()
345 OS << TmpBuf.str(); in EmitMatcher()
351 OS << "/*" << CurrentIdx << "*/"; in EmitMatcher()
352 OS.PadToColumn(Indent*2) << "0, "; in EmitMatcher()
354 OS << (isa<SwitchOpcodeMatcher>(N) ? in EmitMatcher()
357 OS << '\n'; in EmitMatcher()
365 OS << "OPC_CheckType, " in EmitMatcher()
370 OS << "OPC_CheckChild" in EmitMatcher()
376 OS << "OPC_CheckInteger, "; in EmitMatcher()
377 unsigned Bytes=1+EmitVBRValue(cast<CheckIntegerMatcher>(N)->getValue(), OS); in EmitMatcher()
378 OS << '\n'; in EmitMatcher()
382 OS << "OPC_CheckChild" << cast<CheckChildIntegerMatcher>(N)->getChildNo() in EmitMatcher()
385 OS); in EmitMatcher()
386 OS << '\n'; in EmitMatcher()
390 OS << "OPC_CheckCondCode, ISD::" in EmitMatcher()
395 OS << "OPC_CheckValueType, MVT::" in EmitMatcher()
402 OS << "OPC_CheckComplexPat, /*CP*/" << getComplexPat(Pattern) << ", /*#*/" in EmitMatcher()
406 OS.PadToColumn(CommentIndent) << "// " << Pattern.getSelectFunc(); in EmitMatcher()
407 OS << ":$" << CCPM->getName(); in EmitMatcher()
409 OS << " #" << CCPM->getFirstResult()+i; in EmitMatcher()
412 OS << " + chain result"; in EmitMatcher()
414 OS << '\n'; in EmitMatcher()
419 OS << "OPC_CheckAndImm, "; in EmitMatcher()
420 unsigned Bytes=1+EmitVBRValue(cast<CheckAndImmMatcher>(N)->getValue(), OS); in EmitMatcher()
421 OS << '\n'; in EmitMatcher()
426 OS << "OPC_CheckOrImm, "; in EmitMatcher()
427 unsigned Bytes = 1+EmitVBRValue(cast<CheckOrImmMatcher>(N)->getValue(), OS); in EmitMatcher()
428 OS << '\n'; in EmitMatcher()
433 OS << "OPC_CheckFoldableChainNode,\n"; in EmitMatcher()
438 OS << "OPC_EmitInteger, " in EmitMatcher()
440 unsigned Bytes = 2+EmitVBRValue(Val, OS); in EmitMatcher()
441 OS << '\n'; in EmitMatcher()
447 OS << "OPC_EmitInteger, " in EmitMatcher()
459 OS << "OPC_EmitRegister2, " << getEnumName(Matcher->getVT()) << ", "; in EmitMatcher()
460 OS << "TARGET_VAL(" << getQualifiedName(Reg->TheDef) << "),\n"; in EmitMatcher()
463 OS << "OPC_EmitRegister, " << getEnumName(Matcher->getVT()) << ", "; in EmitMatcher()
465 OS << getQualifiedName(Reg->TheDef) << ",\n"; in EmitMatcher()
467 OS << "0 "; in EmitMatcher()
469 OS << "/*zero_reg*/"; in EmitMatcher()
470 OS << ",\n"; in EmitMatcher()
477 OS << "OPC_EmitConvertToTarget, " in EmitMatcher()
487 OS << "OPC_EmitMergeInputChains1_" << MN->getNode(0) << ",\n"; in EmitMatcher()
491 OS << "OPC_EmitMergeInputChains, " << MN->getNumNodes() << ", "; in EmitMatcher()
493 OS << MN->getNode(i) << ", "; in EmitMatcher()
494 OS << '\n'; in EmitMatcher()
498 OS << "OPC_EmitCopyToReg, " in EmitMatcher()
505 OS << "OPC_EmitNodeXForm, " << getNodeXFormID(XF->getNodeXForm()) << ", " in EmitMatcher()
508 OS.PadToColumn(CommentIndent) << "// "<<XF->getNodeXForm()->getName(); in EmitMatcher()
509 OS <<'\n'; in EmitMatcher()
516 OS << (isa<EmitNodeMatcher>(EN) ? "OPC_EmitNode" : "OPC_MorphNodeTo"); in EmitMatcher()
517 OS << ", TARGET_VAL(" << EN->getOpcodeName() << "), 0"; in EmitMatcher()
519 if (EN->hasChain()) OS << "|OPFL_Chain"; in EmitMatcher()
520 if (EN->hasInFlag()) OS << "|OPFL_GlueInput"; in EmitMatcher()
521 if (EN->hasOutFlag()) OS << "|OPFL_GlueOutput"; in EmitMatcher()
522 if (EN->hasMemRefs()) OS << "|OPFL_MemRefs"; in EmitMatcher()
524 OS << "|OPFL_Variadic" << EN->getNumFixedArityOperands(); in EmitMatcher()
525 OS << ",\n"; in EmitMatcher()
527 OS.PadToColumn(Indent*2+4) << EN->getNumVTs(); in EmitMatcher()
529 OS << "/*#VTs*/"; in EmitMatcher()
530 OS << ", "; in EmitMatcher()
532 OS << getEnumName(EN->getVT(i)) << ", "; in EmitMatcher()
534 OS << EN->getNumOperands(); in EmitMatcher()
536 OS << "/*#Ops*/"; in EmitMatcher()
537 OS << ", "; in EmitMatcher()
540 NumOperandBytes += EmitVBRValue(EN->getOperand(i), OS); in EmitMatcher()
546 OS.PadToColumn(CommentIndent) << "// Results ="; in EmitMatcher()
549 OS << " #" << First+i; in EmitMatcher()
552 OS << '\n'; in EmitMatcher()
555 OS.PadToColumn(Indent*2) << "// Src: " in EmitMatcher()
558 OS.PadToColumn(Indent*2) << "// Dst: " in EmitMatcher()
562 OS << '\n'; in EmitMatcher()
568 OS << "OPC_MarkGlueResults, " << CFR->getNumNodes() << ", "; in EmitMatcher()
571 NumOperandBytes += EmitVBRValue(CFR->getNode(i), OS); in EmitMatcher()
572 OS << '\n'; in EmitMatcher()
577 OS << "OPC_CompleteMatch, " << CM->getNumResults() << ", "; in EmitMatcher()
580 NumResultBytes += EmitVBRValue(CM->getResult(i), OS); in EmitMatcher()
581 OS << '\n'; in EmitMatcher()
583 OS.PadToColumn(Indent*2) << "// Src: " in EmitMatcher()
586 OS.PadToColumn(Indent*2) << "// Dst: " in EmitMatcher()
589 OS << '\n'; in EmitMatcher()
599 formatted_raw_ostream &OS) { in EmitMatcherList() argument
603 OS << "/*" << CurrentIdx << "*/"; in EmitMatcherList()
604 unsigned MatcherSize = EmitMatcher(N, Indent, CurrentIdx, OS); in EmitMatcherList()
615 void MatcherTableEmitter::EmitPredicateFunctions(formatted_raw_ostream &OS) { in EmitPredicateFunctions() argument
618 OS << "bool CheckPatternPredicate(unsigned PredNo) const override {\n"; in EmitPredicateFunctions()
619 OS << " switch (PredNo) {\n"; in EmitPredicateFunctions()
620 OS << " default: llvm_unreachable(\"Invalid predicate in table?\");\n"; in EmitPredicateFunctions()
622 OS << " case " << i << ": return " << PatternPredicates[i] << ";\n"; in EmitPredicateFunctions()
623 OS << " }\n"; in EmitPredicateFunctions()
624 OS << "}\n\n"; in EmitPredicateFunctions()
636 OS << "bool CheckNodePredicate(SDNode *Node,\n"; in EmitPredicateFunctions()
637 OS << " unsigned PredNo) const override {\n"; in EmitPredicateFunctions()
638 OS << " switch (PredNo) {\n"; in EmitPredicateFunctions()
639 OS << " default: llvm_unreachable(\"Invalid predicate in table?\");\n"; in EmitPredicateFunctions()
645 OS << " case " << i << ": { // " << NodePredicates[i].getFnName() <<'\n'; in EmitPredicateFunctions()
647 OS << PredFn.getCodeToRunOnSDNode() << "\n }\n"; in EmitPredicateFunctions()
649 OS << " }\n"; in EmitPredicateFunctions()
650 OS << "}\n\n"; in EmitPredicateFunctions()
656 OS << "bool CheckComplexPattern(SDNode *Root, SDNode *Parent,\n"; in EmitPredicateFunctions()
657 OS << " SDValue N, unsigned PatternNo,\n"; in EmitPredicateFunctions()
658 OS << " SmallVectorImpl<std::pair<SDValue, SDNode*> > &Result) override {\n"; in EmitPredicateFunctions()
659 OS << " unsigned NextRes = Result.size();\n"; in EmitPredicateFunctions()
660 OS << " switch (PatternNo) {\n"; in EmitPredicateFunctions()
661 OS << " default: llvm_unreachable(\"Invalid pattern # in table?\");\n"; in EmitPredicateFunctions()
669 OS << " case " << i << ":\n"; in EmitPredicateFunctions()
670 OS << " Result.resize(NextRes+" << NumOps << ");\n"; in EmitPredicateFunctions()
671 OS << " return " << P.getSelectFunc(); in EmitPredicateFunctions()
673 OS << "("; in EmitPredicateFunctions()
677 OS << "Root, "; in EmitPredicateFunctions()
682 OS << "Parent, "; in EmitPredicateFunctions()
684 OS << "N"; in EmitPredicateFunctions()
686 OS << ", Result[NextRes+" << i << "].first"; in EmitPredicateFunctions()
687 OS << ");\n"; in EmitPredicateFunctions()
689 OS << " }\n"; in EmitPredicateFunctions()
690 OS << "}\n\n"; in EmitPredicateFunctions()
697 OS << "SDValue RunSDNodeXForm(SDValue V, unsigned XFormNo) override {\n"; in EmitPredicateFunctions()
698 OS << " switch (XFormNo) {\n"; in EmitPredicateFunctions()
699 OS << " default: llvm_unreachable(\"Invalid xform # in table?\");\n"; in EmitPredicateFunctions()
709 OS << " case " << i << ": { "; in EmitPredicateFunctions()
711 OS << "// " << NodeXForms[i]->getName(); in EmitPredicateFunctions()
712 OS << '\n'; in EmitPredicateFunctions()
716 OS << " SDNode *N = V.getNode();\n"; in EmitPredicateFunctions()
718 OS << " " << ClassName << " *N = cast<" << ClassName in EmitPredicateFunctions()
720 OS << Code << "\n }\n"; in EmitPredicateFunctions()
722 OS << " }\n"; in EmitPredicateFunctions()
723 OS << "}\n\n"; in EmitPredicateFunctions()
750 formatted_raw_ostream &OS) { in EmitHistogram() argument
757 OS << " // Opcode Histogram:\n"; in EmitHistogram()
759 OS << " // #"; in EmitHistogram()
761 case Matcher::Scope: OS << "OPC_Scope"; break; in EmitHistogram()
762 case Matcher::RecordNode: OS << "OPC_RecordNode"; break; in EmitHistogram()
763 case Matcher::RecordChild: OS << "OPC_RecordChild"; break; in EmitHistogram()
764 case Matcher::RecordMemRef: OS << "OPC_RecordMemRef"; break; in EmitHistogram()
765 case Matcher::CaptureGlueInput: OS << "OPC_CaptureGlueInput"; break; in EmitHistogram()
766 case Matcher::MoveChild: OS << "OPC_MoveChild"; break; in EmitHistogram()
767 case Matcher::MoveParent: OS << "OPC_MoveParent"; break; in EmitHistogram()
768 case Matcher::CheckSame: OS << "OPC_CheckSame"; break; in EmitHistogram()
769 case Matcher::CheckChildSame: OS << "OPC_CheckChildSame"; break; in EmitHistogram()
771 OS << "OPC_CheckPatternPredicate"; break; in EmitHistogram()
772 case Matcher::CheckPredicate: OS << "OPC_CheckPredicate"; break; in EmitHistogram()
773 case Matcher::CheckOpcode: OS << "OPC_CheckOpcode"; break; in EmitHistogram()
774 case Matcher::SwitchOpcode: OS << "OPC_SwitchOpcode"; break; in EmitHistogram()
775 case Matcher::CheckType: OS << "OPC_CheckType"; break; in EmitHistogram()
776 case Matcher::SwitchType: OS << "OPC_SwitchType"; break; in EmitHistogram()
777 case Matcher::CheckChildType: OS << "OPC_CheckChildType"; break; in EmitHistogram()
778 case Matcher::CheckInteger: OS << "OPC_CheckInteger"; break; in EmitHistogram()
779 case Matcher::CheckChildInteger: OS << "OPC_CheckChildInteger"; break; in EmitHistogram()
780 case Matcher::CheckCondCode: OS << "OPC_CheckCondCode"; break; in EmitHistogram()
781 case Matcher::CheckValueType: OS << "OPC_CheckValueType"; break; in EmitHistogram()
782 case Matcher::CheckComplexPat: OS << "OPC_CheckComplexPat"; break; in EmitHistogram()
783 case Matcher::CheckAndImm: OS << "OPC_CheckAndImm"; break; in EmitHistogram()
784 case Matcher::CheckOrImm: OS << "OPC_CheckOrImm"; break; in EmitHistogram()
786 OS << "OPC_CheckFoldableChainNode"; break; in EmitHistogram()
787 case Matcher::EmitInteger: OS << "OPC_EmitInteger"; break; in EmitHistogram()
788 case Matcher::EmitStringInteger: OS << "OPC_EmitStringInteger"; break; in EmitHistogram()
789 case Matcher::EmitRegister: OS << "OPC_EmitRegister"; break; in EmitHistogram()
790 case Matcher::EmitConvertToTarget: OS << "OPC_EmitConvertToTarget"; break; in EmitHistogram()
791 case Matcher::EmitMergeInputChains: OS << "OPC_EmitMergeInputChains"; break; in EmitHistogram()
792 case Matcher::EmitCopyToReg: OS << "OPC_EmitCopyToReg"; break; in EmitHistogram()
793 case Matcher::EmitNode: OS << "OPC_EmitNode"; break; in EmitHistogram()
794 case Matcher::MorphNodeTo: OS << "OPC_MorphNodeTo"; break; in EmitHistogram()
795 case Matcher::EmitNodeXForm: OS << "OPC_EmitNodeXForm"; break; in EmitHistogram()
796 case Matcher::MarkGlueResults: OS << "OPC_MarkGlueResults"; break; in EmitHistogram()
797 case Matcher::CompleteMatch: OS << "OPC_CompleteMatch"; break; in EmitHistogram()
800 OS.PadToColumn(40) << " = " << OpcodeFreq[i] << '\n'; in EmitHistogram()
802 OS << '\n'; in EmitHistogram()
809 formatted_raw_ostream OS(O); in EmitMatcherTable() local
811 OS << "// The main instruction selector code.\n"; in EmitMatcherTable()
812 OS << "SDNode *SelectCode(SDNode *N) {\n"; in EmitMatcherTable()
816 OS << " // Some target values are emitted as 2 bytes, TARGET_VAL handles\n"; in EmitMatcherTable()
817 OS << " // this.\n"; in EmitMatcherTable()
818 OS << " #define TARGET_VAL(X) X & 255, unsigned(X) >> 8\n"; in EmitMatcherTable()
819 OS << " static const unsigned char MatcherTable[] = {\n"; in EmitMatcherTable()
820 unsigned TotalSize = MatcherEmitter.EmitMatcherList(TheMatcher, 6, 0, OS); in EmitMatcherTable()
821 OS << " 0\n }; // Total Array size is " << (TotalSize+1) << " bytes\n\n"; in EmitMatcherTable()
823 MatcherEmitter.EmitHistogram(TheMatcher, OS); in EmitMatcherTable()
825 OS << " #undef TARGET_VAL\n"; in EmitMatcherTable()
826 OS << " return SelectCodeCommon(N, MatcherTable,sizeof(MatcherTable));\n}\n"; in EmitMatcherTable()
827 OS << '\n'; in EmitMatcherTable()
830 MatcherEmitter.EmitPredicateFunctions(OS); in EmitMatcherTable()