Lines Matching refs:OS
60 unsigned StartIdx, formatted_raw_ostream &OS);
62 void EmitPredicateFunctions(formatted_raw_ostream &OS);
64 void EmitHistogram(const Matcher *N, formatted_raw_ostream &OS);
67 formatted_raw_ostream &OS);
133 static uint64_t EmitVBRValue(uint64_t Val, raw_ostream &OS) { in EmitVBRValue() argument
135 OS << Val << ", "; in EmitVBRValue()
142 OS << (Val&127) << "|128,"; in EmitVBRValue()
146 OS << Val; in EmitVBRValue()
148 OS << "/*" << InVal << "*/"; in EmitVBRValue()
149 OS << ", "; in EmitVBRValue()
157 formatted_raw_ostream &OS) { in EmitMatcher() argument
158 OS.PadToColumn(Indent*2); in EmitMatcher()
170 OS << "OPC_Scope, "; in EmitMatcher()
174 OS << "/*" << CurrentIdx << "*/"; in EmitMatcher()
175 OS.PadToColumn(Indent*2) << "/*Scope*/ "; in EmitMatcher()
177 OS.PadToColumn(Indent*2); in EmitMatcher()
192 raw_svector_ostream OS(TmpBuf); in EmitMatcher() local
193 formatted_raw_ostream FOS(OS); in EmitMatcher()
200 CurrentIdx += EmitVBRValue(ChildSize, OS); in EmitMatcher()
202 OS << "/*->" << CurrentIdx+ChildSize << "*/"; in EmitMatcher()
205 OS.PadToColumn(CommentIndent) << "// " << SM->getNumChildren() in EmitMatcher()
209 OS << '\n' << TmpBuf; in EmitMatcher()
215 OS << "/*" << CurrentIdx << "*/"; in EmitMatcher()
216 OS.PadToColumn(Indent*2) << "0, "; in EmitMatcher()
218 OS << "/*End of Scope*/"; in EmitMatcher()
219 OS << '\n'; in EmitMatcher()
224 OS << "OPC_RecordNode,"; in EmitMatcher()
226 OS.PadToColumn(CommentIndent) << "// #" in EmitMatcher()
229 OS << '\n'; in EmitMatcher()
233 OS << "OPC_RecordChild" << cast<RecordChildMatcher>(N)->getChildNo() in EmitMatcher()
236 OS.PadToColumn(CommentIndent) << "// #" in EmitMatcher()
239 OS << '\n'; in EmitMatcher()
243 OS << "OPC_RecordMemRef,\n"; in EmitMatcher()
247 OS << "OPC_CaptureGlueInput,\n"; in EmitMatcher()
253 OS << "OPC_MoveChild"; in EmitMatcher()
256 OS << ", "; in EmitMatcher()
257 OS << MCM->getChildNo() << ",\n"; in EmitMatcher()
262 OS << "OPC_MoveParent,\n"; in EmitMatcher()
266 OS << "OPC_CheckSame, " in EmitMatcher()
271 OS << "OPC_CheckChild" in EmitMatcher()
278 OS << "OPC_CheckPatternPredicate, " << getPatternPredicate(Pred) << ','; in EmitMatcher()
280 OS.PadToColumn(CommentIndent) << "// " << Pred; in EmitMatcher()
281 OS << '\n'; in EmitMatcher()
286 OS << "OPC_CheckPredicate, " << getNodePredicate(Pred) << ','; in EmitMatcher()
288 OS.PadToColumn(CommentIndent) << "// " << Pred.getFnName(); in EmitMatcher()
289 OS << '\n'; in EmitMatcher()
294 OS << "OPC_CheckOpcode, TARGET_VAL(" in EmitMatcher()
304 OS << "OPC_SwitchOpcode "; in EmitMatcher()
307 OS << "OPC_SwitchType "; in EmitMatcher()
312 OS << "/*" << NumCases << " cases */"; in EmitMatcher()
313 OS << ", "; in EmitMatcher()
340 raw_svector_ostream OS(TmpBuf); in EmitMatcher() local
341 formatted_raw_ostream FOS(OS); in EmitMatcher()
350 OS << "/*" << CurrentIdx << "*/"; in EmitMatcher()
351 OS.PadToColumn(Indent*2); in EmitMatcher()
353 OS << (isa<SwitchOpcodeMatcher>(N) ? in EmitMatcher()
358 CurrentIdx += EmitVBRValue(ChildSize, OS); in EmitMatcher()
361 OS << "TARGET_VAL(" << SOM->getCaseOpcode(i).getEnumName() << "),"; in EmitMatcher()
363 OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i)) << ','; in EmitMatcher()
368 OS << "// ->" << CurrentIdx+ChildSize; in EmitMatcher()
369 OS << '\n'; in EmitMatcher()
370 OS << TmpBuf; in EmitMatcher()
376 OS << "/*" << CurrentIdx << "*/"; in EmitMatcher()
377 OS.PadToColumn(Indent*2) << "0, "; in EmitMatcher()
379 OS << (isa<SwitchOpcodeMatcher>(N) ? in EmitMatcher()
382 OS << '\n'; in EmitMatcher()
390 OS << "OPC_CheckType, " in EmitMatcher()
395 OS << "OPC_CheckChild" in EmitMatcher()
401 OS << "OPC_CheckInteger, "; in EmitMatcher()
402 unsigned Bytes=1+EmitVBRValue(cast<CheckIntegerMatcher>(N)->getValue(), OS); in EmitMatcher()
403 OS << '\n'; in EmitMatcher()
407 OS << "OPC_CheckChild" << cast<CheckChildIntegerMatcher>(N)->getChildNo() in EmitMatcher()
410 OS); in EmitMatcher()
411 OS << '\n'; in EmitMatcher()
415 OS << "OPC_CheckCondCode, ISD::" in EmitMatcher()
420 OS << "OPC_CheckValueType, MVT::" in EmitMatcher()
427 OS << "OPC_CheckComplexPat, /*CP*/" << getComplexPat(Pattern) << ", /*#*/" in EmitMatcher()
431 OS.PadToColumn(CommentIndent) << "// " << Pattern.getSelectFunc(); in EmitMatcher()
432 OS << ":$" << CCPM->getName(); in EmitMatcher()
434 OS << " #" << CCPM->getFirstResult()+i; in EmitMatcher()
437 OS << " + chain result"; in EmitMatcher()
439 OS << '\n'; in EmitMatcher()
444 OS << "OPC_CheckAndImm, "; in EmitMatcher()
445 unsigned Bytes=1+EmitVBRValue(cast<CheckAndImmMatcher>(N)->getValue(), OS); in EmitMatcher()
446 OS << '\n'; in EmitMatcher()
451 OS << "OPC_CheckOrImm, "; in EmitMatcher()
452 unsigned Bytes = 1+EmitVBRValue(cast<CheckOrImmMatcher>(N)->getValue(), OS); in EmitMatcher()
453 OS << '\n'; in EmitMatcher()
458 OS << "OPC_CheckFoldableChainNode,\n"; in EmitMatcher()
463 OS << "OPC_EmitInteger, " in EmitMatcher()
465 unsigned Bytes = 2+EmitVBRValue(Val, OS); in EmitMatcher()
466 OS << '\n'; in EmitMatcher()
472 OS << "OPC_EmitInteger, " in EmitMatcher()
484 OS << "OPC_EmitRegister2, " << getEnumName(Matcher->getVT()) << ", "; in EmitMatcher()
485 OS << "TARGET_VAL(" << getQualifiedName(Reg->TheDef) << "),\n"; in EmitMatcher()
488 OS << "OPC_EmitRegister, " << getEnumName(Matcher->getVT()) << ", "; in EmitMatcher()
490 OS << getQualifiedName(Reg->TheDef) << ",\n"; in EmitMatcher()
492 OS << "0 "; in EmitMatcher()
494 OS << "/*zero_reg*/"; in EmitMatcher()
495 OS << ",\n"; in EmitMatcher()
502 OS << "OPC_EmitConvertToTarget, " in EmitMatcher()
512 OS << "OPC_EmitMergeInputChains1_" << MN->getNode(0) << ",\n"; in EmitMatcher()
516 OS << "OPC_EmitMergeInputChains, " << MN->getNumNodes() << ", "; in EmitMatcher()
518 OS << MN->getNode(i) << ", "; in EmitMatcher()
519 OS << '\n'; in EmitMatcher()
523 OS << "OPC_EmitCopyToReg, " in EmitMatcher()
530 OS << "OPC_EmitNodeXForm, " << getNodeXFormID(XF->getNodeXForm()) << ", " in EmitMatcher()
533 OS.PadToColumn(CommentIndent) << "// "<<XF->getNodeXForm()->getName(); in EmitMatcher()
534 OS <<'\n'; in EmitMatcher()
541 OS << (isa<EmitNodeMatcher>(EN) ? "OPC_EmitNode" : "OPC_MorphNodeTo"); in EmitMatcher()
544 OS << EN->getNumVTs(); in EmitMatcher()
546 OS << ", TARGET_VAL(" << EN->getOpcodeName() << "), 0"; in EmitMatcher()
548 if (EN->hasChain()) OS << "|OPFL_Chain"; in EmitMatcher()
549 if (EN->hasInFlag()) OS << "|OPFL_GlueInput"; in EmitMatcher()
550 if (EN->hasOutFlag()) OS << "|OPFL_GlueOutput"; in EmitMatcher()
551 if (EN->hasMemRefs()) OS << "|OPFL_MemRefs"; in EmitMatcher()
553 OS << "|OPFL_Variadic" << EN->getNumFixedArityOperands(); in EmitMatcher()
554 OS << ",\n"; in EmitMatcher()
556 OS.PadToColumn(Indent*2+4); in EmitMatcher()
558 OS << EN->getNumVTs(); in EmitMatcher()
560 OS << "/*#VTs*/"; in EmitMatcher()
561 OS << ", "; in EmitMatcher()
564 OS << getEnumName(EN->getVT(i)) << ", "; in EmitMatcher()
566 OS << EN->getNumOperands(); in EmitMatcher()
568 OS << "/*#Ops*/"; in EmitMatcher()
569 OS << ", "; in EmitMatcher()
572 NumOperandBytes += EmitVBRValue(EN->getOperand(i), OS); in EmitMatcher()
578 OS.PadToColumn(CommentIndent) << "// Results ="; in EmitMatcher()
581 OS << " #" << First+i; in EmitMatcher()
584 OS << '\n'; in EmitMatcher()
587 OS.PadToColumn(Indent*2) << "// Src: " in EmitMatcher()
590 OS.PadToColumn(Indent*2) << "// Dst: " in EmitMatcher()
594 OS << '\n'; in EmitMatcher()
600 OS << "OPC_CompleteMatch, " << CM->getNumResults() << ", "; in EmitMatcher()
603 NumResultBytes += EmitVBRValue(CM->getResult(i), OS); in EmitMatcher()
604 OS << '\n'; in EmitMatcher()
606 OS.PadToColumn(Indent*2) << "// Src: " in EmitMatcher()
609 OS.PadToColumn(Indent*2) << "// Dst: " in EmitMatcher()
612 OS << '\n'; in EmitMatcher()
622 formatted_raw_ostream &OS) { in EmitMatcherList() argument
626 OS << "/*" << CurrentIdx << "*/"; in EmitMatcherList()
627 unsigned MatcherSize = EmitMatcher(N, Indent, CurrentIdx, OS); in EmitMatcherList()
638 void MatcherTableEmitter::EmitPredicateFunctions(formatted_raw_ostream &OS) { in EmitPredicateFunctions() argument
641 OS << "bool CheckPatternPredicate(unsigned PredNo) const override {\n"; in EmitPredicateFunctions()
642 OS << " switch (PredNo) {\n"; in EmitPredicateFunctions()
643 OS << " default: llvm_unreachable(\"Invalid predicate in table?\");\n"; in EmitPredicateFunctions()
645 OS << " case " << i << ": return " << PatternPredicates[i] << ";\n"; in EmitPredicateFunctions()
646 OS << " }\n"; in EmitPredicateFunctions()
647 OS << "}\n\n"; in EmitPredicateFunctions()
652 OS << "bool CheckNodePredicate(SDNode *Node,\n"; in EmitPredicateFunctions()
653 OS << " unsigned PredNo) const override {\n"; in EmitPredicateFunctions()
654 OS << " switch (PredNo) {\n"; in EmitPredicateFunctions()
655 OS << " default: llvm_unreachable(\"Invalid predicate in table?\");\n"; in EmitPredicateFunctions()
661 OS << " case " << i << ": { \n"; in EmitPredicateFunctions()
664 OS << " // " << TreePredicateFn(SimilarPred).getFnName() <<'\n'; in EmitPredicateFunctions()
666 OS << PredFn.getCodeToRunOnSDNode() << "\n }\n"; in EmitPredicateFunctions()
668 OS << " }\n"; in EmitPredicateFunctions()
669 OS << "}\n\n"; in EmitPredicateFunctions()
675 OS << "bool CheckComplexPattern(SDNode *Root, SDNode *Parent,\n"; in EmitPredicateFunctions()
676 OS << " SDValue N, unsigned PatternNo,\n"; in EmitPredicateFunctions()
677 OS << " SmallVectorImpl<std::pair<SDValue, SDNode*> > &Result) override {\n"; in EmitPredicateFunctions()
678 OS << " unsigned NextRes = Result.size();\n"; in EmitPredicateFunctions()
679 OS << " switch (PatternNo) {\n"; in EmitPredicateFunctions()
680 OS << " default: llvm_unreachable(\"Invalid pattern # in table?\");\n"; in EmitPredicateFunctions()
688 OS << " case " << i << ":\n"; in EmitPredicateFunctions()
689 OS << " Result.resize(NextRes+" << NumOps << ");\n"; in EmitPredicateFunctions()
690 OS << " return " << P.getSelectFunc(); in EmitPredicateFunctions()
692 OS << "("; in EmitPredicateFunctions()
696 OS << "Root, "; in EmitPredicateFunctions()
701 OS << "Parent, "; in EmitPredicateFunctions()
703 OS << "N"; in EmitPredicateFunctions()
705 OS << ", Result[NextRes+" << i << "].first"; in EmitPredicateFunctions()
706 OS << ");\n"; in EmitPredicateFunctions()
708 OS << " }\n"; in EmitPredicateFunctions()
709 OS << "}\n\n"; in EmitPredicateFunctions()
716 OS << "SDValue RunSDNodeXForm(SDValue V, unsigned XFormNo) override {\n"; in EmitPredicateFunctions()
717 OS << " switch (XFormNo) {\n"; in EmitPredicateFunctions()
718 OS << " default: llvm_unreachable(\"Invalid xform # in table?\");\n"; in EmitPredicateFunctions()
728 OS << " case " << i << ": { "; in EmitPredicateFunctions()
730 OS << "// " << NodeXForms[i]->getName(); in EmitPredicateFunctions()
731 OS << '\n'; in EmitPredicateFunctions()
735 OS << " SDNode *N = V.getNode();\n"; in EmitPredicateFunctions()
737 OS << " " << ClassName << " *N = cast<" << ClassName in EmitPredicateFunctions()
739 OS << Code << "\n }\n"; in EmitPredicateFunctions()
741 OS << " }\n"; in EmitPredicateFunctions()
742 OS << "}\n\n"; in EmitPredicateFunctions()
769 formatted_raw_ostream &OS) { in EmitHistogram() argument
776 OS << " // Opcode Histogram:\n"; in EmitHistogram()
778 OS << " // #"; in EmitHistogram()
780 case Matcher::Scope: OS << "OPC_Scope"; break; in EmitHistogram()
781 case Matcher::RecordNode: OS << "OPC_RecordNode"; break; in EmitHistogram()
782 case Matcher::RecordChild: OS << "OPC_RecordChild"; break; in EmitHistogram()
783 case Matcher::RecordMemRef: OS << "OPC_RecordMemRef"; break; in EmitHistogram()
784 case Matcher::CaptureGlueInput: OS << "OPC_CaptureGlueInput"; break; in EmitHistogram()
785 case Matcher::MoveChild: OS << "OPC_MoveChild"; break; in EmitHistogram()
786 case Matcher::MoveParent: OS << "OPC_MoveParent"; break; in EmitHistogram()
787 case Matcher::CheckSame: OS << "OPC_CheckSame"; break; in EmitHistogram()
788 case Matcher::CheckChildSame: OS << "OPC_CheckChildSame"; break; in EmitHistogram()
790 OS << "OPC_CheckPatternPredicate"; break; in EmitHistogram()
791 case Matcher::CheckPredicate: OS << "OPC_CheckPredicate"; break; in EmitHistogram()
792 case Matcher::CheckOpcode: OS << "OPC_CheckOpcode"; break; in EmitHistogram()
793 case Matcher::SwitchOpcode: OS << "OPC_SwitchOpcode"; break; in EmitHistogram()
794 case Matcher::CheckType: OS << "OPC_CheckType"; break; in EmitHistogram()
795 case Matcher::SwitchType: OS << "OPC_SwitchType"; break; in EmitHistogram()
796 case Matcher::CheckChildType: OS << "OPC_CheckChildType"; break; in EmitHistogram()
797 case Matcher::CheckInteger: OS << "OPC_CheckInteger"; break; in EmitHistogram()
798 case Matcher::CheckChildInteger: OS << "OPC_CheckChildInteger"; break; in EmitHistogram()
799 case Matcher::CheckCondCode: OS << "OPC_CheckCondCode"; break; in EmitHistogram()
800 case Matcher::CheckValueType: OS << "OPC_CheckValueType"; break; in EmitHistogram()
801 case Matcher::CheckComplexPat: OS << "OPC_CheckComplexPat"; break; in EmitHistogram()
802 case Matcher::CheckAndImm: OS << "OPC_CheckAndImm"; break; in EmitHistogram()
803 case Matcher::CheckOrImm: OS << "OPC_CheckOrImm"; break; in EmitHistogram()
805 OS << "OPC_CheckFoldableChainNode"; break; in EmitHistogram()
806 case Matcher::EmitInteger: OS << "OPC_EmitInteger"; break; in EmitHistogram()
807 case Matcher::EmitStringInteger: OS << "OPC_EmitStringInteger"; break; in EmitHistogram()
808 case Matcher::EmitRegister: OS << "OPC_EmitRegister"; break; in EmitHistogram()
809 case Matcher::EmitConvertToTarget: OS << "OPC_EmitConvertToTarget"; break; in EmitHistogram()
810 case Matcher::EmitMergeInputChains: OS << "OPC_EmitMergeInputChains"; break; in EmitHistogram()
811 case Matcher::EmitCopyToReg: OS << "OPC_EmitCopyToReg"; break; in EmitHistogram()
812 case Matcher::EmitNode: OS << "OPC_EmitNode"; break; in EmitHistogram()
813 case Matcher::MorphNodeTo: OS << "OPC_MorphNodeTo"; break; in EmitHistogram()
814 case Matcher::EmitNodeXForm: OS << "OPC_EmitNodeXForm"; break; in EmitHistogram()
815 case Matcher::CompleteMatch: OS << "OPC_CompleteMatch"; break; in EmitHistogram()
818 OS.PadToColumn(40) << " = " << OpcodeFreq[i] << '\n'; in EmitHistogram()
820 OS << '\n'; in EmitHistogram()
827 formatted_raw_ostream OS(O); in EmitMatcherTable() local
829 OS << "// The main instruction selector code.\n"; in EmitMatcherTable()
830 OS << "SDNode *SelectCode(SDNode *N) {\n"; in EmitMatcherTable()
834 OS << " // Some target values are emitted as 2 bytes, TARGET_VAL handles\n"; in EmitMatcherTable()
835 OS << " // this.\n"; in EmitMatcherTable()
836 OS << " #define TARGET_VAL(X) X & 255, unsigned(X) >> 8\n"; in EmitMatcherTable()
837 OS << " static const unsigned char MatcherTable[] = {\n"; in EmitMatcherTable()
838 unsigned TotalSize = MatcherEmitter.EmitMatcherList(TheMatcher, 6, 0, OS); in EmitMatcherTable()
839 OS << " 0\n }; // Total Array size is " << (TotalSize+1) << " bytes\n\n"; in EmitMatcherTable()
841 MatcherEmitter.EmitHistogram(TheMatcher, OS); in EmitMatcherTable()
843 OS << " #undef TARGET_VAL\n"; in EmitMatcherTable()
844 OS << " SelectCodeCommon(N, MatcherTable,sizeof(MatcherTable));\n"; in EmitMatcherTable()
845 OS << " return nullptr;\n"; in EmitMatcherTable()
846 OS << "}\n"; in EmitMatcherTable()
849 MatcherEmitter.EmitPredicateFunctions(OS); in EmitMatcherTable()