[llvm] a675e11 - [MCA] Explicitly instantiate and export template for unittest (#227893)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 20:53:49 PDT 2026


Author: Tom Stellard
Date: 2026-10-01T20:53:42-07:00
New Revision: a675e11f60838997749fe246646fc17aa44221de

URL: https://github.com/llvm/llvm-project/commit/a675e11f60838997749fe246646fc17aa44221de
DIFF: https://github.com/llvm/llvm-project/commit/a675e11f60838997749fe246646fc17aa44221de.diff

LOG: [MCA] Explicitly instantiate and export template for unittest (#227893)

Added: 
    

Modified: 
    llvm/include/llvm/MCA/Support.h
    llvm/lib/MCA/InstrBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MCA/Support.h b/llvm/include/llvm/MCA/Support.h
index 6875787833d93..eedad4d329350 100644
--- a/llvm/include/llvm/MCA/Support.h
+++ b/llvm/include/llvm/MCA/Support.h
@@ -42,6 +42,7 @@ class InstructionError : public ErrorInfo<InstructionError<T>> {
 };
 
 template <typename T> char InstructionError<T>::ID;
+extern template class LLVM_TEMPLATE_ABI InstructionError<MCInst>;
 
 /// This class represents the number of cycles per resource (fractions of
 /// cycles).  That quantity is managed here as a ratio, and accessed via the

diff  --git a/llvm/lib/MCA/InstrBuilder.cpp b/llvm/lib/MCA/InstrBuilder.cpp
index c5169b908b7e8..395c512bc57cf 100644
--- a/llvm/lib/MCA/InstrBuilder.cpp
+++ b/llvm/lib/MCA/InstrBuilder.cpp
@@ -17,6 +17,7 @@
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/MC/MCInst.h"
+#include "llvm/MCA/Support.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
@@ -28,6 +29,8 @@ namespace mca {
 
 char RecycledInstErr::ID = 0;
 
+template class LLVM_EXPORT_TEMPLATE InstructionError<MCInst>;
+
 InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti,
                            const llvm::MCInstrInfo &mcii,
                            const llvm::MCRegisterInfo &mri,


        


More information about the llvm-commits mailing list