[llvm] [llvm][AsmPrinter] Add an option to print instruction latencies (PR #113243)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 23:26:22 PDT 2024
================
@@ -1080,8 +1087,78 @@ void AsmPrinter::emitFunctionEntryLabel() {
}
}
+/// Gets latency information for \p Inst from the itinerary
+/// scheduling model.
+/// \return The maximum expected latency over all the operands or -1
+/// if no information is available.
+static int getItineraryLatency(const MachineInstr &MI,
+ const MachineFunction *MF,
+ const MCSubtargetInfo *STI) {
+ const int NoInformationAvailable = -1;
+ const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
+
+ // Check if we have a CPU to get the itinerary information.
+ if (STI->getCPU().empty())
+ return NoInformationAvailable;
+
+ // Get itinerary information.
+ InstrItineraryData IID = STI->getInstrItineraryForCPU(STI->getCPU());
----------------
davemgreen wrote:
Is it worth adding a test for a CPU that has an Itinerary model, but no InstrSchedModel?
https://github.com/llvm/llvm-project/pull/113243
More information about the llvm-commits
mailing list