From 99df07c60e73d61bd2baa5ef1bdbf4ae2a0f0cc1 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Thu, 9 Nov 2023 12:02:12 -0500 Subject: [PATCH] Add ARCH_GRP_RET and GRP_JUMP if the CGI has the isReturn flag set. --- 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 3bb7e4cec3f7..06df183f7829 100644 --- a/llvm/utils/TableGen/PrinterCapstone.cpp +++ b/llvm/utils/TableGen/PrinterCapstone.cpp @@ -2469,15 +2469,18 @@ std::string getReqFeatures(StringRef const &TargetName, AsmMatcherInfo &AMI, std::string Flags = "{ "; std::string Mn = getNormalMnemonic(MI); // The debug if - if (CGI->isBranch && !CGI->isCall) { + if ((CGI->isBranch || CGI->isReturn) && !CGI->isCall) { Flags += TargetName.str() + "_GRP_JUMP, "; } + if (CGI->isReturn) { + Flags += TargetName.str() + "_GRP_RET, "; + } if (CGI->isCall) { Flags += TargetName.str() + "_GRP_CALL, "; } for (const auto &OpInfo : CGI->Operands.OperandList) { if (OpInfo.OperandType == "MCOI::OPERAND_PCREL" && - (CGI->isBranch || CGI->isIndirectBranch || CGI->isCall)) { + (CGI->isBranch || CGI->isReturn || CGI->isIndirectBranch || CGI->isCall)) { Flags += TargetName.str() + "_GRP_BRANCH_RELATIVE, "; } } @@ -2747,7 +2750,7 @@ void printInsnMapEntry(StringRef const &TargetName, AsmMatcherInfo &AMI, InsnMap.indent(4) << getImplicitUses(TargetName, CGI) << ", "; InsnMap << getImplicitDefs(TargetName, CGI) << ", "; InsnMap << getReqFeatures(TargetName, AMI, MI, UseMI, CGI) << ", "; - InsnMap << (CGI->isBranch ? "1" : "0") << ", "; + InsnMap << ((CGI->isBranch || CGI->isReturn) ? "1" : "0") << ", "; InsnMap << (CGI->isIndirectBranch ? "1" : "0") << ", "; InsnMap << getArchSupplInfo(TargetName, CGI, PPCFormatEnum) << ",\n"; InsnMap.indent(4) << getCSOpcodeEncoding(CGI);