[llvm] [llvm][AsmPrinter] Add an option to print instruction latencies (PR #113243)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 19:11:18 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());
----------------
jroelofs wrote:

done

https://github.com/llvm/llvm-project/pull/113243


More information about the llvm-commits mailing list