[llvm] [TableGen] Add mapping from processor ID to resource index for packetizer (PR #158182)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 14 18:23:04 PDT 2025


================
@@ -0,0 +1,31 @@
+// RUN: llvm-tblgen -gen-dfa-packetizer -I %p/../../include %s | FileCheck %s
+
+include "llvm/Target/Target.td"
+
+def TestTarget : Target;
+
+def TestSchedModel : SchedMachineModel {
+  let CompleteModel = 0;
+}
+
+def TestProcessor1 : ProcessorModel<"testprocessor1", TestSchedModel, []>;
+
+def FU0 : FuncUnit;
+def FU1 : FuncUnit;
+
+def OP0 : InstrItinClass;
+def OP1 : InstrItinClass;
+
+def Itin {
+  list<InstrItinData> ItinList = [
+    InstrItinData<OP0, [InstrStage<1, [FU0]>]>,
+    InstrItinData<OP1, [InstrStage<1, [FU1]>]>,
+  ];
+}
+
+// CHECK: std::map<unsigned, unsigned> TestTargetProcIdToResourceIndexStartMapping = {
----------------
arsenm wrote:

This is emitting a static constructor for a std::map. Can you emit this as a sorted static table instead which doesn't need construction 

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


More information about the llvm-commits mailing list