Skip to content

Commit a63397d

Browse files
authored
Merge pull request #38 from Rot127/return-group
Add `ARCH_GRP_RET` and `GRP_JUMP` if the CGI has the `isReturn` flag set.
2 parents 3305b09 + 99df07c commit a63397d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

llvm/utils/TableGen/PrinterCapstone.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,15 +2490,18 @@ std::string getReqFeatures(StringRef const &TargetName, AsmMatcherInfo &AMI,
24902490
std::string Flags = "{ ";
24912491
std::string Mn = getNormalMnemonic(MI);
24922492
// The debug if
2493-
if (CGI->isBranch && !CGI->isCall) {
2493+
if ((CGI->isBranch || CGI->isReturn) && !CGI->isCall) {
24942494
Flags += TargetName.str() + "_GRP_JUMP, ";
24952495
}
2496+
if (CGI->isReturn) {
2497+
Flags += TargetName.str() + "_GRP_RET, ";
2498+
}
24962499
if (CGI->isCall) {
24972500
Flags += TargetName.str() + "_GRP_CALL, ";
24982501
}
24992502
for (const auto &OpInfo : CGI->Operands.OperandList) {
25002503
if (OpInfo.OperandType == "MCOI::OPERAND_PCREL" &&
2501-
(CGI->isBranch || CGI->isIndirectBranch || CGI->isCall)) {
2504+
(CGI->isBranch || CGI->isReturn || CGI->isIndirectBranch || CGI->isCall)) {
25022505
Flags += TargetName.str() + "_GRP_BRANCH_RELATIVE, ";
25032506
}
25042507
}
@@ -2945,7 +2948,7 @@ void printInsnMapEntry(StringRef const &TargetName, AsmMatcherInfo &AMI,
29452948
InsnMap.indent(4) << getImplicitUses(TargetName, CGI) << ", ";
29462949
InsnMap << getImplicitDefs(TargetName, CGI) << ", ";
29472950
InsnMap << getReqFeatures(TargetName, AMI, MI, UseMI, CGI) << ", ";
2948-
InsnMap << (CGI->isBranch ? "1" : "0") << ", ";
2951+
InsnMap << ((CGI->isBranch || CGI->isReturn) ? "1" : "0") << ", ";
29492952
InsnMap << (CGI->isIndirectBranch ? "1" : "0") << ", ";
29502953
InsnMap << getArchSupplInfo(TargetName, CGI, PPCFormatEnum) << ",\n";
29512954
InsnMap.indent(4) << getCSOpcodeEncoding(CGI);

0 commit comments

Comments
 (0)