[llvm] [MCA] Extend -instruction-tables option with verbosity levels (PR #130574)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 19 12:56:22 PDT 2025
================
@@ -29,82 +61,139 @@ void InstructionInfoView::printView(raw_ostream &OS) const {
IIVDVec IIVD(Source.size());
collectData(IIVD);
- TempStream << "\n\nInstruction Info:\n";
- TempStream << "[1]: #uOps\n[2]: Latency\n[3]: RThroughput\n"
- << "[4]: MayLoad\n[5]: MayStore\n[6]: HasSideEffects (U)\n";
+ if (PrintFullInfo) {
+ FOS << "\n\nResources:\n";
+ const MCSchedModel &SM = getSubTargetInfo().getSchedModel();
+ for (unsigned I = 1, ResourceIndex = 0, E = SM.getNumProcResourceKinds();
+ I < E; ++I) {
+ const MCProcResourceDesc &ProcResource = *SM.getProcResource(I);
+ unsigned NumUnits = ProcResource.NumUnits;
+ // Skip invalid resources with zero units.
+ if (!NumUnits)
+ continue;
+
+ FOS << '[' << ResourceIndex << ']';
+ FOS.PadToColumn(6);
+ FOS << "- " << ProcResource.Name << ':' << NumUnits;
+ if (ProcResource.SubUnitsIdxBegin) {
+ FOS.PadToColumn(20);
+ for (unsigned U = 0; U < NumUnits; ++U) {
+ FOS << SM.getProcResource(ProcResource.SubUnitsIdxBegin[U])->Name;
+ if ((U + 1) < NumUnits)
+ FOS << ", ";
+ }
+ }
+ FOS << '\n';
+ ResourceIndex++;
+ }
+ }
+
+ SmallVector<unsigned, 16> Paddings = {0, 7, 14, 21, 28, 35};
+ SmallVector<StringRef, 16> Fields = {"#uOps", "Latency",
+ "RThroughput", "MayLoad",
+ "MayStore", "HasSideEffects (U)"};
+ SmallVector<StringRef, 8> EndFields;
+ unsigned LastPadding = 35;
----------------
topperc wrote:
LastPadding = Paddings.back()
https://github.com/llvm/llvm-project/pull/130574
More information about the llvm-commits
mailing list