[all-commits] [llvm/llvm-project] 2cc47d: [MC] Preserve target MCSubtargetInfo subclass in M...
Alexander Richardson via All-commits
all-commits at lists.llvm.org
Tue Sep 29 22:39:32 PDT 2026
Branch: refs/heads/users/arichardson/mc-preserve-target-mcsubtargetinfo-subclass-in-mccontext
Home: https://github.com/llvm/llvm-project
Commit: 2cc47d99a1e5c8151dbb88f832fef99c6efa7afe
https://github.com/llvm/llvm-project/commit/2cc47d99a1e5c8151dbb88f832fef99c6efa7afe
Author: Alex Richardson <alexrichardson at google.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M llvm/include/llvm/MC/MCSubtargetInfo.h
M llvm/lib/MC/MCContext.cpp
M llvm/test/TableGen/HwModeBitSet.td
M llvm/unittests/MC/TargetRegistry.cpp
M llvm/utils/TableGen/SubtargetEmitter.cpp
Log Message:
-----------
[MC] Preserve target MCSubtargetInfo subclass in MCContext::getSubtargetCopy
Previously, MCContext::getSubtargetCopy placement-constructed a base
MCSubtargetInfo instance instead of the TableGen-generated
<Target>GenMCSubtargetInfo subclass, resetting the vtable to
MCSubtargetInfo and losing target overrides such as getHwMode,
getHwModeSet, and resolveVariantSchedClass. As a result, any
MCTargetAsmParser::copySTI() call (for example when handling .option
arch on RISC-V) caused STI.getHwMode() to return 0 (DefaultMode).
Add a virtual MCSubtargetInfo::copyTo helper overridden by
<Target>GenMCSubtargetInfo so MCContext::getSubtargetCopy preserves the
target's MCSubtargetInfo vtable.
This commit was created with the help of AI tools
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list