Lines Matching refs:OS
67 void Enumeration(raw_ostream &OS, const char *ClassName);
68 unsigned FeatureKeyValues(raw_ostream &OS);
69 unsigned CPUKeyValues(raw_ostream &OS);
78 void EmitStageAndOperandCycleData(raw_ostream &OS,
81 void EmitItineraries(raw_ostream &OS,
84 void EmitProcessorProp(raw_ostream &OS, const Record *R, const char *Name,
87 raw_ostream &OS);
96 void EmitSchedClassTables(SchedClassTables &SchedTables, raw_ostream &OS);
97 void EmitProcessorModels(raw_ostream &OS);
98 void EmitProcessorLookup(raw_ostream &OS);
99 void EmitSchedModelHelpers(std::string ClassName, raw_ostream &OS);
100 void EmitSchedModel(raw_ostream &OS);
101 void ParseFeaturesFunction(raw_ostream &OS, unsigned NumFeatures,
115 void SubtargetEmitter::Enumeration(raw_ostream &OS, in Enumeration() argument
127 OS << "namespace " << Target << " {\n"; in Enumeration()
130 OS << "enum : uint64_t {\n"; in Enumeration()
138 OS << " " << Def->getName() << " = " << i; in Enumeration()
139 if (++i < N) OS << ","; in Enumeration()
141 OS << "\n"; in Enumeration()
145 OS << "};\n}\n"; in Enumeration()
152 unsigned SubtargetEmitter::FeatureKeyValues(raw_ostream &OS) { in FeatureKeyValues() argument
163 OS << "// Sorted (by key) array of values for CPU features.\n" in FeatureKeyValues()
180 OS << " { " in FeatureKeyValues()
189 OS << "{ }"; in FeatureKeyValues()
191 OS << "{ "; in FeatureKeyValues()
193 OS << Target << "::" << ImpliesList[j]->getName(); in FeatureKeyValues()
194 if (++j < M) OS << ", "; in FeatureKeyValues()
196 OS << " }"; in FeatureKeyValues()
199 OS << " }"; in FeatureKeyValues()
203 if ((i + 1) < N) OS << ","; in FeatureKeyValues()
205 OS << "\n"; in FeatureKeyValues()
209 OS << "};\n"; in FeatureKeyValues()
218 unsigned SubtargetEmitter::CPUKeyValues(raw_ostream &OS) { in CPUKeyValues() argument
225 OS << "// Sorted (by key) array of values for CPU subtype.\n" in CPUKeyValues()
239 OS << " { " in CPUKeyValues()
244 OS << "{ }"; in CPUKeyValues()
246 OS << "{ "; in CPUKeyValues()
248 OS << Target << "::" << FeatureList[j]->getName(); in CPUKeyValues()
249 if (++j < M) OS << ", "; in CPUKeyValues()
251 OS << " }"; in CPUKeyValues()
255 OS << ", { } }"; in CPUKeyValues()
258 if (++i < N) OS << ","; in CPUKeyValues()
260 OS << "\n"; in CPUKeyValues()
264 OS << "};\n"; in CPUKeyValues()
360 EmitStageAndOperandCycleData(raw_ostream &OS, in EmitStageAndOperandCycleData() argument
379 OS << "\n// Functional units for \"" << Name << "\"\n" in EmitStageAndOperandCycleData()
383 OS << " const unsigned " << FUs[j]->getName() in EmitStageAndOperandCycleData()
386 OS << "}\n"; in EmitStageAndOperandCycleData()
390 OS << "\n// Pipeline forwarding pathes for itineraries \"" << Name in EmitStageAndOperandCycleData()
393 OS << " const unsigned NoBypass = 0;\n"; in EmitStageAndOperandCycleData()
395 OS << " const unsigned " << BPs[j]->getName() in EmitStageAndOperandCycleData()
398 OS << "}\n"; in EmitStageAndOperandCycleData()
525 OS << StageTable; in EmitStageAndOperandCycleData()
526 OS << OperandCycleTable; in EmitStageAndOperandCycleData()
527 OS << BypassTable; in EmitStageAndOperandCycleData()
537 EmitItineraries(raw_ostream &OS, in EmitItineraries() argument
565 OS << "\n"; in EmitItineraries()
566 OS << "static const llvm::InstrItinerary "; in EmitItineraries()
569 OS << Name << "[] = {\n"; in EmitItineraries()
577 OS << " { " << in EmitItineraries()
586 OS << " { 0, ~0U, ~0U, ~0U, ~0U } // end marker\n"; in EmitItineraries()
587 OS << "};\n"; in EmitItineraries()
594 void SubtargetEmitter::EmitProcessorProp(raw_ostream &OS, const Record *R, in EmitProcessorProp() argument
596 OS << " "; in EmitProcessorProp()
599 OS << V << Separator << " // " << Name; in EmitProcessorProp()
601 OS << "MCSchedModel::Default" << Name << Separator; in EmitProcessorProp()
602 OS << '\n'; in EmitProcessorProp()
606 raw_ostream &OS) { in EmitProcessorResources() argument
609 OS << "\n// {Name, NumUnits, SuperIdx, IsBuffered}\n"; in EmitProcessorResources()
610 OS << "static const llvm::MCProcResourceDesc " in EmitProcessorResources()
640 OS << " {DBGFIELD(\"" << PRDef->getName() << "\") "; in EmitProcessorResources()
642 OS.indent(15 - PRDef->getName().size()); in EmitProcessorResources()
643 OS << NumUnits << ", " << SuperIdx << ", " in EmitProcessorResources()
646 OS << ", Super=" << SuperDef->getName(); in EmitProcessorResources()
647 OS << "\n"; in EmitProcessorResources()
649 OS << "};\n"; in EmitProcessorResources()
1071 raw_ostream &OS) { in EmitSchedClassTables() argument
1073 OS << "\n// {ProcResourceIdx, Cycles}\n" in EmitSchedClassTables()
1080 OS << " {" << format("%2d", WPREntry.ProcResourceIdx) << ", " in EmitSchedClassTables()
1083 OS << ','; in EmitSchedClassTables()
1084 OS << " // #" << WPRIdx << '\n'; in EmitSchedClassTables()
1086 OS << "}; // " << Target << "WriteProcResTable\n"; in EmitSchedClassTables()
1089 OS << "\n// {Cycles, WriteResourceID}\n" in EmitSchedClassTables()
1096 OS << " {" << format("%2d", WLEntry.Cycles) << ", " in EmitSchedClassTables()
1099 OS << ','; in EmitSchedClassTables()
1100 OS << " // #" << WLIdx << " " << SchedTables.WriterNames[WLIdx] << '\n'; in EmitSchedClassTables()
1102 OS << "}; // " << Target << "WriteLatencyTable\n"; in EmitSchedClassTables()
1105 OS << "\n// {UseIdx, WriteResourceID, Cycles}\n" in EmitSchedClassTables()
1112 OS << " {" << RAEntry.UseIdx << ", " in EmitSchedClassTables()
1116 OS << ','; in EmitSchedClassTables()
1117 OS << " // #" << RAIdx << '\n'; in EmitSchedClassTables()
1119 OS << "}; // " << Target << "ReadAdvanceTable\n"; in EmitSchedClassTables()
1130 OS << "\n// {Name, NumMicroOps, BeginGroup, EndGroup," in EmitSchedClassTables()
1132 OS << "static const llvm::MCSchedClassDesc " in EmitSchedClassTables()
1139 OS << " {DBGFIELD(\"InvalidSchedClass\") " in EmitSchedClassTables()
1146 OS << " {DBGFIELD(\"" << SchedClass.Name << "\") "; in EmitSchedClassTables()
1148 OS.indent(18 - SchedClass.Name.size()); in EmitSchedClassTables()
1149 OS << MCDesc.NumMicroOps in EmitSchedClassTables()
1158 OS << ','; in EmitSchedClassTables()
1159 OS << " // #" << SCIdx << '\n'; in EmitSchedClassTables()
1161 OS << "}; // " << PI->ModelName << "SchedClasses\n"; in EmitSchedClassTables()
1165 void SubtargetEmitter::EmitProcessorModels(raw_ostream &OS) { in EmitProcessorModels() argument
1171 EmitProcessorResources(*PI, OS); in EmitProcessorModels()
1177 OS << "\n"; in EmitProcessorModels()
1178 OS << "static const llvm::MCSchedModel " << PI->ModelName << " = {\n"; in EmitProcessorModels()
1179 EmitProcessorProp(OS, PI->ModelDef, "IssueWidth", ','); in EmitProcessorModels()
1180 EmitProcessorProp(OS, PI->ModelDef, "MicroOpBufferSize", ','); in EmitProcessorModels()
1181 EmitProcessorProp(OS, PI->ModelDef, "LoopMicroOpBufferSize", ','); in EmitProcessorModels()
1182 EmitProcessorProp(OS, PI->ModelDef, "LoadLatency", ','); in EmitProcessorModels()
1183 EmitProcessorProp(OS, PI->ModelDef, "HighLatency", ','); in EmitProcessorModels()
1184 EmitProcessorProp(OS, PI->ModelDef, "MispredictPenalty", ','); in EmitProcessorModels()
1186 OS << " " << (bool)(PI->ModelDef ? in EmitProcessorModels()
1190 OS << " " << (bool)(PI->ModelDef ? in EmitProcessorModels()
1194 OS << " " << PI->Index << ", // Processor ID\n"; in EmitProcessorModels()
1196 OS << " " << PI->ModelName << "ProcResources" << ",\n" in EmitProcessorModels()
1202 OS << " nullptr, nullptr, 0, 0," in EmitProcessorModels()
1205 OS << " " << PI->ItinsDef->getName() << "};\n"; in EmitProcessorModels()
1207 OS << " nullptr}; // No Itinerary\n"; in EmitProcessorModels()
1214 void SubtargetEmitter::EmitProcessorLookup(raw_ostream &OS) { in EmitProcessorLookup() argument
1221 OS << "\n"; in EmitProcessorLookup()
1222 OS << "// Sorted (by key) array of itineraries for CPU subtype.\n" in EmitProcessorLookup()
1236 OS << " { \"" << Name << "\", (const void *)&" << ProcModelName << " }"; in EmitProcessorLookup()
1239 if (++i < N) OS << ","; in EmitProcessorLookup()
1241 OS << "\n"; in EmitProcessorLookup()
1245 OS << "};\n"; in EmitProcessorLookup()
1251 void SubtargetEmitter::EmitSchedModel(raw_ostream &OS) { in EmitSchedModel() argument
1252 OS << "#ifdef DBGFIELD\n" in EmitSchedModel()
1264 EmitStageAndOperandCycleData(OS, ProcItinLists); in EmitSchedModel()
1265 EmitItineraries(OS, ProcItinLists); in EmitSchedModel()
1267 OS << "\n// ===============================================================\n" in EmitSchedModel()
1275 EmitSchedClassTables(SchedTables, OS); in EmitSchedModel()
1278 EmitProcessorModels(OS); in EmitSchedModel()
1280 EmitProcessorLookup(OS); in EmitSchedModel()
1282 OS << "#undef DBGFIELD"; in EmitSchedModel()
1286 raw_ostream &OS) { in EmitSchedModelHelpers() argument
1287 OS << "unsigned " << ClassName in EmitSchedModelHelpers()
1295 OS << (*PI)->getValueAsString("Code") << '\n'; in EmitSchedModelHelpers()
1305 OS << " switch (SchedClass) {\n"; in EmitSchedModelHelpers()
1309 OS << " case " << *VCI << ": // " << SC.Name << '\n'; in EmitSchedModelHelpers()
1322 OS << " "; in EmitSchedModelHelpers()
1324 OS << "if (SchedModel->getProcessorID() == " << *PI << ") "; in EmitSchedModelHelpers()
1325 OS << "{ // " << (SchedModels.procModelBegin() + *PI)->ModelName in EmitSchedModelHelpers()
1334 OS << " if ("; in EmitSchedModelHelpers()
1338 OS << "\n && "; in EmitSchedModelHelpers()
1339 OS << "(" << (*RI)->getValueAsString("Predicate") << ")"; in EmitSchedModelHelpers()
1341 OS << ")\n" in EmitSchedModelHelpers()
1345 OS << " }\n"; in EmitSchedModelHelpers()
1350 OS << " return " << SC.Index << ";\n"; in EmitSchedModelHelpers()
1351 OS << " break;\n"; in EmitSchedModelHelpers()
1353 OS << " };\n"; in EmitSchedModelHelpers()
1355 OS << " report_fatal_error(\"Expected a variant SchedClass\");\n" in EmitSchedModelHelpers()
1363 void SubtargetEmitter::ParseFeaturesFunction(raw_ostream &OS, in ParseFeaturesFunction() argument
1370 OS << "// ParseSubtargetFeatures - Parses features string setting specified\n" in ParseFeaturesFunction()
1373 OS << Target; in ParseFeaturesFunction()
1374 OS << "Subtarget::ParseSubtargetFeatures(StringRef CPU, StringRef FS) {\n" in ParseFeaturesFunction()
1379 OS << "}\n"; in ParseFeaturesFunction()
1383 OS << " InitMCProcessorInfo(CPU, FS);\n" in ParseFeaturesFunction()
1394 OS << " if (Bits[" << Target << "::" in ParseFeaturesFunction()
1398 OS << " if (Bits[" << Target << "::" in ParseFeaturesFunction()
1404 OS << "}\n"; in ParseFeaturesFunction()
1410 void SubtargetEmitter::run(raw_ostream &OS) { in run() argument
1411 emitSourceFileHeader("Subtarget Enumeration Source Fragment", OS); in run()
1413 OS << "\n#ifdef GET_SUBTARGETINFO_ENUM\n"; in run()
1414 OS << "#undef GET_SUBTARGETINFO_ENUM\n"; in run()
1416 OS << "namespace llvm {\n"; in run()
1417 Enumeration(OS, "SubtargetFeature"); in run()
1418 OS << "} // end llvm namespace\n"; in run()
1419 OS << "#endif // GET_SUBTARGETINFO_ENUM\n\n"; in run()
1421 OS << "\n#ifdef GET_SUBTARGETINFO_MC_DESC\n"; in run()
1422 OS << "#undef GET_SUBTARGETINFO_MC_DESC\n"; in run()
1424 OS << "namespace llvm {\n"; in run()
1426 OS << "namespace {\n"; in run()
1428 unsigned NumFeatures = FeatureKeyValues(OS); in run()
1429 OS << "\n"; in run()
1430 unsigned NumProcs = CPUKeyValues(OS); in run()
1431 OS << "\n"; in run()
1432 EmitSchedModel(OS); in run()
1433 OS << "\n"; in run()
1435 OS << "}\n"; in run()
1439 OS << "static inline MCSubtargetInfo *create" << Target in run()
1442 OS << " return new MCSubtargetInfo(TT, CPU, FS, "; in run()
1444 OS << Target << "FeatureKV, "; in run()
1446 OS << "None, "; in run()
1448 OS << Target << "SubTypeKV, "; in run()
1450 OS << "None, "; in run()
1451 OS << '\n'; OS.indent(22); in run()
1452 OS << Target << "ProcSchedKV, " in run()
1457 OS << '\n'; OS.indent(22); in run()
1458 OS << Target << "Stages, " in run()
1462 OS << "0, 0, 0"; in run()
1463 OS << ");\n}\n\n"; in run()
1465 OS << "} // end llvm namespace\n"; in run()
1467 OS << "#endif // GET_SUBTARGETINFO_MC_DESC\n\n"; in run()
1469 OS << "\n#ifdef GET_SUBTARGETINFO_TARGET_DESC\n"; in run()
1470 OS << "#undef GET_SUBTARGETINFO_TARGET_DESC\n"; in run()
1472 OS << "#include \"llvm/Support/Debug.h\"\n"; in run()
1473 OS << "#include \"llvm/Support/raw_ostream.h\"\n"; in run()
1474 ParseFeaturesFunction(OS, NumFeatures, NumProcs); in run()
1476 OS << "#endif // GET_SUBTARGETINFO_TARGET_DESC\n\n"; in run()
1479 OS << "\n#ifdef GET_SUBTARGETINFO_HEADER\n"; in run()
1480 OS << "#undef GET_SUBTARGETINFO_HEADER\n"; in run()
1483 OS << "namespace llvm {\n"; in run()
1484 OS << "class DFAPacketizer;\n"; in run()
1485 OS << "struct " << ClassName << " : public TargetSubtargetInfo {\n" in run()
1495 OS << "} // end llvm namespace\n"; in run()
1497 OS << "#endif // GET_SUBTARGETINFO_HEADER\n\n"; in run()
1499 OS << "\n#ifdef GET_SUBTARGETINFO_CTOR\n"; in run()
1500 OS << "#undef GET_SUBTARGETINFO_CTOR\n"; in run()
1502 OS << "#include \"llvm/CodeGen/TargetSchedule.h\"\n"; in run()
1503 OS << "namespace llvm {\n"; in run()
1504 OS << "extern const llvm::SubtargetFeatureKV " << Target << "FeatureKV[];\n"; in run()
1505 OS << "extern const llvm::SubtargetFeatureKV " << Target << "SubTypeKV[];\n"; in run()
1506 OS << "extern const llvm::SubtargetInfoKV " << Target << "ProcSchedKV[];\n"; in run()
1507 OS << "extern const llvm::MCWriteProcResEntry " in run()
1509 OS << "extern const llvm::MCWriteLatencyEntry " in run()
1511 OS << "extern const llvm::MCReadAdvanceEntry " in run()
1515 OS << "extern const llvm::InstrStage " << Target << "Stages[];\n"; in run()
1516 OS << "extern const unsigned " << Target << "OperandCycles[];\n"; in run()
1517 OS << "extern const unsigned " << Target << "ForwardingPaths[];\n"; in run()
1520 OS << ClassName << "::" << ClassName << "(const Triple &TT, StringRef CPU, " in run()
1524 OS << "makeArrayRef(" << Target << "FeatureKV, " << NumFeatures << "), "; in run()
1526 OS << "None, "; in run()
1528 OS << "makeArrayRef(" << Target << "SubTypeKV, " << NumProcs << "), "; in run()
1530 OS << "None, "; in run()
1531 OS << '\n'; OS.indent(24); in run()
1532 OS << Target << "ProcSchedKV, " in run()
1536 OS << '\n'; OS.indent(24); in run()
1538 OS << Target << "Stages, " in run()
1542 OS << "0, 0, 0"; in run()
1543 OS << ") {}\n\n"; in run()
1545 EmitSchedModelHelpers(ClassName, OS); in run()
1547 OS << "} // end llvm namespace\n"; in run()
1549 OS << "#endif // GET_SUBTARGETINFO_CTOR\n\n"; in run()
1554 void EmitSubtarget(RecordKeeper &RK, raw_ostream &OS) { in EmitSubtarget() argument
1556 SubtargetEmitter(RK, CGTarget).run(OS); in EmitSubtarget()