Skip to content

Commit

Permalink
Merge pull request #38 from Rot127/return-group
Browse files Browse the repository at this point in the history
Add `ARCH_GRP_RET` and `GRP_JUMP` if the CGI has the `isReturn` flag set.
  • Loading branch information
Rot127 authored Nov 10, 2023
2 parents 3305b09 + 99df07c commit a63397d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions llvm/utils/TableGen/PrinterCapstone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2490,15 +2490,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, ";
}
}
Expand Down Expand Up @@ -2945,7 +2948,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);
Expand Down

0 comments on commit a63397d

Please sign in to comment.