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()
247 OS << "OPC_CheckPatternPredicate, " << getPatternPredicate(Pred) << ','; in EmitMatcher()
249 OS.PadToColumn(CommentIndent) << "// " << Pred; in EmitMatcher()
250 OS << '\n'; in EmitMatcher()
255 OS << "OPC_CheckPredicate, " << getNodePredicate(Pred) << ','; in EmitMatcher()
257 OS.PadToColumn(CommentIndent) << "// " << Pred.getFnName(); in EmitMatcher()
258 OS << '\n'; in EmitMatcher()
263 OS << "OPC_CheckOpcode, TARGET_VAL(" in EmitMatcher()
273 OS << "OPC_SwitchOpcode "; in EmitMatcher()
276 OS << "OPC_SwitchType "; in EmitMatcher()
281 OS << "/*" << NumCases << " cases */"; in EmitMatcher()
282 OS << ", "; in EmitMatcher()
309 raw_svector_ostream OS(TmpBuf); in EmitMatcher() local
310 formatted_raw_ostream FOS(OS); in EmitMatcher()
318 OS.PadToColumn(Indent*2); in EmitMatcher()
320 OS << (isa<SwitchOpcodeMatcher>(N) ? in EmitMatcher()
325 CurrentIdx += EmitVBRValue(ChildSize, OS); in EmitMatcher()
327 OS << ' '; in EmitMatcher()
329 OS << "TARGET_VAL(" << SOM->getCaseOpcode(i).getEnumName() << "),"; in EmitMatcher()
331 OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i)) << ','; in EmitMatcher()
336 OS << "// ->" << CurrentIdx+ChildSize; in EmitMatcher()
337 OS << '\n'; in EmitMatcher()
338 OS << TmpBuf.str(); in EmitMatcher()
343 OS.PadToColumn(Indent*2) << "0, "; in EmitMatcher()
345 OS << (isa<SwitchOpcodeMatcher>(N) ? in EmitMatcher()
348 OS << '\n'; in EmitMatcher()
356 OS << "OPC_CheckType, " in EmitMatcher()
361 OS << "OPC_CheckChild" in EmitMatcher()
367 OS << "OPC_CheckInteger, "; in EmitMatcher()
368 unsigned Bytes=1+EmitVBRValue(cast<CheckIntegerMatcher>(N)->getValue(), OS); in EmitMatcher()
369 OS << '\n'; in EmitMatcher()
373 OS << "OPC_CheckCondCode, ISD::" in EmitMatcher()
378 OS << "OPC_CheckValueType, MVT::" in EmitMatcher()
385 OS << "OPC_CheckComplexPat, /*CP*/" << getComplexPat(Pattern) << ", /*#*/" in EmitMatcher()
389 OS.PadToColumn(CommentIndent) << "// " << Pattern.getSelectFunc(); in EmitMatcher()
390 OS << ":$" << CCPM->getName(); in EmitMatcher()
392 OS << " #" << CCPM->getFirstResult()+i; in EmitMatcher()
395 OS << " + chain result"; in EmitMatcher()
397 OS << '\n'; in EmitMatcher()
402 OS << "OPC_CheckAndImm, "; in EmitMatcher()
403 unsigned Bytes=1+EmitVBRValue(cast<CheckAndImmMatcher>(N)->getValue(), OS); in EmitMatcher()
404 OS << '\n'; in EmitMatcher()
409 OS << "OPC_CheckOrImm, "; in EmitMatcher()
410 unsigned Bytes = 1+EmitVBRValue(cast<CheckOrImmMatcher>(N)->getValue(), OS); in EmitMatcher()
411 OS << '\n'; in EmitMatcher()
416 OS << "OPC_CheckFoldableChainNode,\n"; in EmitMatcher()
421 OS << "OPC_EmitInteger, " in EmitMatcher()
423 unsigned Bytes = 2+EmitVBRValue(Val, OS); in EmitMatcher()
424 OS << '\n'; in EmitMatcher()
430 OS << "OPC_EmitInteger, " in EmitMatcher()
442 OS << "OPC_EmitRegister2, " << getEnumName(Matcher->getVT()) << ", "; in EmitMatcher()
443 OS << "TARGET_VAL(" << getQualifiedName(Reg->TheDef) << "),\n"; in EmitMatcher()
446 OS << "OPC_EmitRegister, " << getEnumName(Matcher->getVT()) << ", "; in EmitMatcher()
448 OS << getQualifiedName(Reg->TheDef) << ",\n"; in EmitMatcher()
450 OS << "0 "; in EmitMatcher()
452 OS << "/*zero_reg*/"; in EmitMatcher()
453 OS << ",\n"; in EmitMatcher()
460 OS << "OPC_EmitConvertToTarget, " in EmitMatcher()
470 OS << "OPC_EmitMergeInputChains1_" << MN->getNode(0) << ",\n"; in EmitMatcher()
474 OS << "OPC_EmitMergeInputChains, " << MN->getNumNodes() << ", "; in EmitMatcher()
476 OS << MN->getNode(i) << ", "; in EmitMatcher()
477 OS << '\n'; in EmitMatcher()
481 OS << "OPC_EmitCopyToReg, " in EmitMatcher()
488 OS << "OPC_EmitNodeXForm, " << getNodeXFormID(XF->getNodeXForm()) << ", " in EmitMatcher()
491 OS.PadToColumn(CommentIndent) << "// "<<XF->getNodeXForm()->getName(); in EmitMatcher()
492 OS <<'\n'; in EmitMatcher()
499 OS << (isa<EmitNodeMatcher>(EN) ? "OPC_EmitNode" : "OPC_MorphNodeTo"); in EmitMatcher()
500 OS << ", TARGET_VAL(" << EN->getOpcodeName() << "), 0"; in EmitMatcher()
502 if (EN->hasChain()) OS << "|OPFL_Chain"; in EmitMatcher()
503 if (EN->hasInFlag()) OS << "|OPFL_GlueInput"; in EmitMatcher()
504 if (EN->hasOutFlag()) OS << "|OPFL_GlueOutput"; in EmitMatcher()
505 if (EN->hasMemRefs()) OS << "|OPFL_MemRefs"; in EmitMatcher()
507 OS << "|OPFL_Variadic" << EN->getNumFixedArityOperands(); in EmitMatcher()
508 OS << ",\n"; in EmitMatcher()
510 OS.PadToColumn(Indent*2+4) << EN->getNumVTs(); in EmitMatcher()
512 OS << "/*#VTs*/"; in EmitMatcher()
513 OS << ", "; in EmitMatcher()
515 OS << getEnumName(EN->getVT(i)) << ", "; in EmitMatcher()
517 OS << EN->getNumOperands(); in EmitMatcher()
519 OS << "/*#Ops*/"; in EmitMatcher()
520 OS << ", "; in EmitMatcher()
523 NumOperandBytes += EmitVBRValue(EN->getOperand(i), OS); in EmitMatcher()
529 OS.PadToColumn(CommentIndent) << "// Results = "; in EmitMatcher()
532 OS << "#" << First+i << " "; in EmitMatcher()
535 OS << '\n'; in EmitMatcher()
538 OS.PadToColumn(Indent*2) << "// Src: " in EmitMatcher()
541 OS.PadToColumn(Indent*2) << "// Dst: " in EmitMatcher()
545 OS << '\n'; in EmitMatcher()
551 OS << "OPC_MarkGlueResults, " << CFR->getNumNodes() << ", "; in EmitMatcher()
554 NumOperandBytes += EmitVBRValue(CFR->getNode(i), OS); in EmitMatcher()
555 OS << '\n'; in EmitMatcher()
560 OS << "OPC_CompleteMatch, " << CM->getNumResults() << ", "; in EmitMatcher()
563 NumResultBytes += EmitVBRValue(CM->getResult(i), OS); in EmitMatcher()
564 OS << '\n'; in EmitMatcher()
566 OS.PadToColumn(Indent*2) << "// Src: " in EmitMatcher()
569 OS.PadToColumn(Indent*2) << "// Dst: " in EmitMatcher()
572 OS << '\n'; in EmitMatcher()
583 formatted_raw_ostream &OS) { in EmitMatcherList() argument
587 OS << "/*" << CurrentIdx << "*/"; in EmitMatcherList()
588 unsigned MatcherSize = EmitMatcher(N, Indent, CurrentIdx, OS); in EmitMatcherList()
599 void MatcherTableEmitter::EmitPredicateFunctions(formatted_raw_ostream &OS) { in EmitPredicateFunctions() argument
602 OS << "bool CheckPatternPredicate(unsigned PredNo) const {\n"; in EmitPredicateFunctions()
603 OS << " switch (PredNo) {\n"; in EmitPredicateFunctions()
604 OS << " default: assert(0 && \"Invalid predicate in table?\");\n"; in EmitPredicateFunctions()
606 OS << " case " << i << ": return " << PatternPredicates[i] << ";\n"; in EmitPredicateFunctions()
607 OS << " }\n"; in EmitPredicateFunctions()
608 OS << "}\n\n"; in EmitPredicateFunctions()
620 OS << "bool CheckNodePredicate(SDNode *Node, unsigned PredNo) const {\n"; in EmitPredicateFunctions()
621 OS << " switch (PredNo) {\n"; in EmitPredicateFunctions()
622 OS << " default: assert(0 && \"Invalid predicate in table?\");\n"; in EmitPredicateFunctions()
628 OS << " case " << i << ": { // " << NodePredicates[i].getFnName() <<'\n'; in EmitPredicateFunctions()
630 OS << PredFn.getCodeToRunOnSDNode() << "\n }\n"; in EmitPredicateFunctions()
632 OS << " }\n"; in EmitPredicateFunctions()
633 OS << "}\n\n"; in EmitPredicateFunctions()
639 OS << "bool CheckComplexPattern(SDNode *Root, SDNode *Parent, SDValue N,\n"; in EmitPredicateFunctions()
640 OS << " unsigned PatternNo,\n"; in EmitPredicateFunctions()
641 OS << " SmallVectorImpl<std::pair<SDValue, SDNode*> > &Result) {\n"; in EmitPredicateFunctions()
642 OS << " unsigned NextRes = Result.size();\n"; in EmitPredicateFunctions()
643 OS << " switch (PatternNo) {\n"; in EmitPredicateFunctions()
644 OS << " default: assert(0 && \"Invalid pattern # in table?\");\n"; in EmitPredicateFunctions()
652 OS << " case " << i << ":\n"; in EmitPredicateFunctions()
653 OS << " Result.resize(NextRes+" << NumOps << ");\n"; in EmitPredicateFunctions()
654 OS << " return " << P.getSelectFunc(); in EmitPredicateFunctions()
656 OS << "("; in EmitPredicateFunctions()
660 OS << "Root, "; in EmitPredicateFunctions()
665 OS << "Parent, "; in EmitPredicateFunctions()
667 OS << "N"; in EmitPredicateFunctions()
669 OS << ", Result[NextRes+" << i << "].first"; in EmitPredicateFunctions()
670 OS << ");\n"; in EmitPredicateFunctions()
672 OS << " }\n"; in EmitPredicateFunctions()
673 OS << "}\n\n"; in EmitPredicateFunctions()
680 OS << "SDValue RunSDNodeXForm(SDValue V, unsigned XFormNo) {\n"; in EmitPredicateFunctions()
681 OS << " switch (XFormNo) {\n"; in EmitPredicateFunctions()
682 OS << " default: assert(0 && \"Invalid xform # in table?\");\n"; in EmitPredicateFunctions()
692 OS << " case " << i << ": { "; in EmitPredicateFunctions()
694 OS << "// " << NodeXForms[i]->getName(); in EmitPredicateFunctions()
695 OS << '\n'; in EmitPredicateFunctions()
699 OS << " SDNode *N = V.getNode();\n"; in EmitPredicateFunctions()
701 OS << " " << ClassName << " *N = cast<" << ClassName in EmitPredicateFunctions()
703 OS << Code << "\n }\n"; in EmitPredicateFunctions()
705 OS << " }\n"; in EmitPredicateFunctions()
706 OS << "}\n\n"; in EmitPredicateFunctions()
733 formatted_raw_ostream &OS) { in EmitHistogram() argument
740 OS << " // Opcode Histogram:\n"; in EmitHistogram()
742 OS << " // #"; in EmitHistogram()
744 case Matcher::Scope: OS << "OPC_Scope"; break; in EmitHistogram()
745 case Matcher::RecordNode: OS << "OPC_RecordNode"; break; in EmitHistogram()
746 case Matcher::RecordChild: OS << "OPC_RecordChild"; break; in EmitHistogram()
747 case Matcher::RecordMemRef: OS << "OPC_RecordMemRef"; break; in EmitHistogram()
748 case Matcher::CaptureGlueInput: OS << "OPC_CaptureGlueInput"; break; in EmitHistogram()
749 case Matcher::MoveChild: OS << "OPC_MoveChild"; break; in EmitHistogram()
750 case Matcher::MoveParent: OS << "OPC_MoveParent"; break; in EmitHistogram()
751 case Matcher::CheckSame: OS << "OPC_CheckSame"; break; in EmitHistogram()
753 OS << "OPC_CheckPatternPredicate"; break; in EmitHistogram()
754 case Matcher::CheckPredicate: OS << "OPC_CheckPredicate"; break; in EmitHistogram()
755 case Matcher::CheckOpcode: OS << "OPC_CheckOpcode"; break; in EmitHistogram()
756 case Matcher::SwitchOpcode: OS << "OPC_SwitchOpcode"; break; in EmitHistogram()
757 case Matcher::CheckType: OS << "OPC_CheckType"; break; in EmitHistogram()
758 case Matcher::SwitchType: OS << "OPC_SwitchType"; break; in EmitHistogram()
759 case Matcher::CheckChildType: OS << "OPC_CheckChildType"; break; in EmitHistogram()
760 case Matcher::CheckInteger: OS << "OPC_CheckInteger"; break; in EmitHistogram()
761 case Matcher::CheckCondCode: OS << "OPC_CheckCondCode"; break; in EmitHistogram()
762 case Matcher::CheckValueType: OS << "OPC_CheckValueType"; break; in EmitHistogram()
763 case Matcher::CheckComplexPat: OS << "OPC_CheckComplexPat"; break; in EmitHistogram()
764 case Matcher::CheckAndImm: OS << "OPC_CheckAndImm"; break; in EmitHistogram()
765 case Matcher::CheckOrImm: OS << "OPC_CheckOrImm"; break; in EmitHistogram()
767 OS << "OPC_CheckFoldableChainNode"; break; in EmitHistogram()
768 case Matcher::EmitInteger: OS << "OPC_EmitInteger"; break; in EmitHistogram()
769 case Matcher::EmitStringInteger: OS << "OPC_EmitStringInteger"; break; in EmitHistogram()
770 case Matcher::EmitRegister: OS << "OPC_EmitRegister"; break; in EmitHistogram()
771 case Matcher::EmitConvertToTarget: OS << "OPC_EmitConvertToTarget"; break; in EmitHistogram()
772 case Matcher::EmitMergeInputChains: OS << "OPC_EmitMergeInputChains"; break; in EmitHistogram()
773 case Matcher::EmitCopyToReg: OS << "OPC_EmitCopyToReg"; break; in EmitHistogram()
774 case Matcher::EmitNode: OS << "OPC_EmitNode"; break; in EmitHistogram()
775 case Matcher::MorphNodeTo: OS << "OPC_MorphNodeTo"; break; in EmitHistogram()
776 case Matcher::EmitNodeXForm: OS << "OPC_EmitNodeXForm"; break; in EmitHistogram()
777 case Matcher::MarkGlueResults: OS << "OPC_MarkGlueResults"; break; in EmitHistogram()
778 case Matcher::CompleteMatch: OS << "OPC_CompleteMatch"; break; in EmitHistogram()
781 OS.PadToColumn(40) << " = " << OpcodeFreq[i] << '\n'; in EmitHistogram()
783 OS << '\n'; in EmitHistogram()
790 formatted_raw_ostream OS(O); in EmitMatcherTable() local
792 OS << "// The main instruction selector code.\n"; in EmitMatcherTable()
793 OS << "SDNode *SelectCode(SDNode *N) {\n"; in EmitMatcherTable()
797 OS << " // Some target values are emitted as 2 bytes, TARGET_VAL handles\n"; in EmitMatcherTable()
798 OS << " // this.\n"; in EmitMatcherTable()
799 OS << " #define TARGET_VAL(X) X & 255, unsigned(X) >> 8\n"; in EmitMatcherTable()
800 OS << " static const unsigned char MatcherTable[] = {\n"; in EmitMatcherTable()
801 unsigned TotalSize = MatcherEmitter.EmitMatcherList(TheMatcher, 5, 0, OS); in EmitMatcherTable()
802 OS << " 0\n }; // Total Array size is " << (TotalSize+1) << " bytes\n\n"; in EmitMatcherTable()
804 MatcherEmitter.EmitHistogram(TheMatcher, OS); in EmitMatcherTable()
806 OS << " #undef TARGET_VAL\n"; in EmitMatcherTable()
807 OS << " return SelectCodeCommon(N, MatcherTable,sizeof(MatcherTable));\n}\n"; in EmitMatcherTable()
808 OS << '\n'; in EmitMatcherTable()
811 MatcherEmitter.EmitPredicateFunctions(OS); in EmitMatcherTable()