OS << "enum {\n";
// For each record
- for (unsigned i = 0; i < N;) {
+ for (unsigned i = 0; i < N; ++i) {
// Next record
Record *Def = DefList[i];
// Get and emit name
- OS << " " << Def->getName() << " = " << i;
- if (++i < N) OS << ",";
-
- OS << "\n";
+ OS << " " << Def->getName() << " = " << i << ",\n";
}
// Close enumeration and namespace
OS << " " << Target << "::" << ImpliesList[j]->getName();
if (++j < M) OS << ",";
}
- OS << " }";
-
- OS << " }";
+ OS << " } },\n";
++NumFeatures;
-
- // Depending on 'if more in the list' emit comma
- if ((i + 1) < N) OS << ",";
-
- OS << "\n";
}
// End feature table
<< "SubTypeKV[] = {\n";
// For each processor
- for (unsigned i = 0, N = ProcessorList.size(); i < N;) {
- // Next processor
- Record *Processor = ProcessorList[i];
-
+ for (Record *Processor : ProcessorList) {
StringRef Name = Processor->getValueAsString("Name");
const std::vector<Record*> &FeatureList =
Processor->getValueAsListOfDefs("Features");
OS << " " << Target << "::" << FeatureList[j]->getName();
if (++j < M) OS << ",";
}
- OS << " }";
-
// The { } is for the "implies" section of this data structure.
- OS << ", { } }";
-
- // Depending on 'if more in the list' emit comma
- if (++i < N) OS << ",";
-
- OS << "\n";
+ OS << " }, { } },\n";
}
// End processor table
void SubtargetEmitter::EmitProcessorResources(const CodeGenProcModel &ProcModel,
raw_ostream &OS) {
- char Sep = ProcModel.ProcResourceDefs.empty() ? ' ' : ',';
-
OS << "\n// {Name, NumUnits, SuperIdx, IsBuffered}\n";
OS << "static const llvm::MCProcResourceDesc "
<< ProcModel.ModelName << "ProcResources" << "[] = {\n"
- << " {DBGFIELD(\"InvalidUnit\") 0, 0, 0}" << Sep << "\n";
+ << " {DBGFIELD(\"InvalidUnit\") 0, 0, 0},\n";
for (unsigned i = 0, e = ProcModel.ProcResourceDefs.size(); i < e; ++i) {
Record *PRDef = ProcModel.ProcResourceDefs[i];
NumUnits = PRDef->getValueAsInt("NumUnits");
}
// Emit the ProcResourceDesc
- if (i+1 == e)
- Sep = ' ';
OS << " {DBGFIELD(\"" << PRDef->getName() << "\") ";
if (PRDef->getName().size() < 15)
OS.indent(15 - PRDef->getName().size());
OS << NumUnits << ", " << SuperIdx << ", "
- << BufferSize << "}" << Sep << " // #" << i+1;
+ << BufferSize << "}, // #" << i+1;
if (SuperDef)
OS << ", Super=" << SuperDef->getName();
OS << "\n";
<< ", " << format("%2d", MCDesc.WriteLatencyIdx)
<< ", " << MCDesc.NumWriteLatencyEntries
<< ", " << format("%2d", MCDesc.ReadAdvanceIdx)
- << ", " << MCDesc.NumReadAdvanceEntries << "}";
- if (SCIdx + 1 < SCEnd)
- OS << ',';
- OS << " // #" << SCIdx << '\n';
+ << ", " << MCDesc.NumReadAdvanceEntries
+ << "}, // #" << SCIdx << '\n';
}
OS << "}; // " << PI->ModelName << "SchedClasses\n";
}
<< Target << "ProcSchedKV[] = {\n";
// For each processor
- for (unsigned i = 0, N = ProcessorList.size(); i < N;) {
- // Next processor
- Record *Processor = ProcessorList[i];
-
+ for (Record *Processor : ProcessorList) {
StringRef Name = Processor->getValueAsString("Name");
const std::string &ProcModelName =
SchedModels.getModelForProc(Processor).ModelName;
// Emit as { "cpu", procinit },
- OS << " { \"" << Name << "\", (const void *)&" << ProcModelName << " }";
-
- // Depending on ''if more in the list'' emit comma
- if (++i < N) OS << ",";
-
- OS << "\n";
+ OS << " { \"" << Name << "\", (const void *)&" << ProcModelName << " },\n";
}
// End processor table