[llvm] [llvm-mca] Add optional identifier field to mca::Instruction (PR #97867)

Chinmay Deshpande via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 21:56:20 PDT 2024


https://github.com/chinmaydd updated https://github.com/llvm/llvm-project/pull/97867

>From e23140fa561f29798dce12d9ef93d34dff8b092c Mon Sep 17 00:00:00 2001
From: Chinmay Deshpande <cddeshpa at uci.edu>
Date: Fri, 5 Jul 2024 16:05:25 -0700
Subject: [PATCH] [MCA] Add identifier field to mca::Instruction

---
 llvm/include/llvm/MCA/Instruction.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/llvm/include/llvm/MCA/Instruction.h b/llvm/include/llvm/MCA/Instruction.h
index e48a70164bec6c..4fb0a62ac7f8c4 100644
--- a/llvm/include/llvm/MCA/Instruction.h
+++ b/llvm/include/llvm/MCA/Instruction.h
@@ -643,6 +643,9 @@ class Instruction : public InstructionBase {
   // True if this instruction has been optimized at register renaming stage.
   bool IsEliminated;
 
+  // Client-dependent identifier for this instruction.
+  std::optional<uint64_t> Identifier;
+
 public:
   Instruction(const InstrDesc &D, const unsigned Opcode)
       : InstructionBase(D, Opcode), Stage(IS_INVALID),
@@ -690,6 +693,9 @@ class Instruction : public InstructionBase {
   bool isRetired() const { return Stage == IS_RETIRED; }
   bool isEliminated() const { return IsEliminated; }
 
+  std::optional<uint64_t> getIdentifier() const { return Identifier; }
+  void setIdentifier(uint64_t Id) { Identifier = Id; }
+
   // Forces a transition from state IS_DISPATCHED to state IS_EXECUTED.
   void forceExecuted();
   void setEliminated() { IsEliminated = true; }



More information about the llvm-commits mailing list