From 717740dd491ea33b6daa6ef1f10cb7deb4f5fff0 Mon Sep 17 00:00:00 2001 From: billow Date: Tue, 22 Oct 2024 15:22:37 +0800 Subject: [PATCH] fix: tricore --- llvm/utils/TableGen/PrinterCapstone.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/utils/TableGen/PrinterCapstone.cpp b/llvm/utils/TableGen/PrinterCapstone.cpp index fec11c5f3131..974005c916f3 100644 --- a/llvm/utils/TableGen/PrinterCapstone.cpp +++ b/llvm/utils/TableGen/PrinterCapstone.cpp @@ -2622,9 +2622,11 @@ std::string getImplicitDefs(StringRef const &TargetName, } static inline std::string normalizedMnemonic(StringRef const &Mn, - const bool Upper = true) { + const bool Upper = true, + const bool ReplaceDot = true) { auto Mnemonic = Upper ? Mn.upper() : Mn.str(); - std::replace(Mnemonic.begin(), Mnemonic.end(), '.', '_'); + if (ReplaceDot) + std::replace(Mnemonic.begin(), Mnemonic.end(), '.', '_'); std::replace(Mnemonic.begin(), Mnemonic.end(), '|', '_'); std::replace(Mnemonic.begin(), Mnemonic.end(), '+', 'p'); std::replace(Mnemonic.begin(), Mnemonic.end(), '-', 'm'); @@ -3303,7 +3305,8 @@ void printInsnNameMapEnumEntry(StringRef const &TargetName, static std::set MnemonicsSeen; static std::set EnumsSeen; - std::string Mnemonic = normalizedMnemonic(MI->Mnemonic.str(), false); + const bool replace_dot = !TargetName.equals_insensitive("TriCore"); + std::string Mnemonic = normalizedMnemonic(MI->Mnemonic, false, replace_dot); if (MnemonicsSeen.find(Mnemonic) != MnemonicsSeen.end()) return;