Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions llvm/utils/TableGen/PrinterCapstone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3029,16 +3029,13 @@ bool compareTypeSuperClasses(ArrayRef<std::pair<Record *, SMRange>> OpTypeSC,
/// @param PatternDag The pattern DAG to search in.
/// @param PartOfPTRPattern True, if the given pattern is of type iPTR. False
/// otherwise.
/// @param MatchByTypeName If true, the same type names are treated as a valid
/// match.
/// @param MatchByTypeSuperClasses If true, a valid match is also if any type
/// super classes are the same.
/// @return True, if the pattern contains a node with the same name (and
/// optionally the same type name or same super class type) as the given
/// operand. False otherwise.
bool opIsPartOfiPTRPattern(Record const *OpRec, StringRef const &OpName,
DagInit *PatternDag, bool PartOfPTRPattern,
bool MatchByTypeName = false,
bool MatchByTypeSuperClasses = false) {
for (unsigned I = 0; I < PatternDag->getNumArgs(); ++I) {
DagInit *DagArg = dyn_cast<DagInit>(PatternDag->getArg(I));
Expand All @@ -3054,7 +3051,7 @@ bool opIsPartOfiPTRPattern(Record const *OpRec, StringRef const &OpName,
MVT::SimpleValueType::iPTR)
PartOfPTRPattern = true;
if (opIsPartOfiPTRPattern(OpRec, OpName, DagArg, PartOfPTRPattern,
MatchByTypeName, MatchByTypeSuperClasses))
MatchByTypeSuperClasses))
return true;
continue;
}
Expand All @@ -3065,11 +3062,6 @@ bool opIsPartOfiPTRPattern(Record const *OpRec, StringRef const &OpName,
bool Matches;
StringRef const &PatOpName = PatternDag->getArgNameStr(I);
Matches = OpName.equals(PatOpName);
if (MatchByTypeName) {
std::string OpInitType = OpRec->getNameInitAsString();
std::string PatOpType = PatternDag->getArg(I)->getAsString();
Matches |= OpInitType == PatOpType;
}
if (MatchByTypeSuperClasses) {
std::string OpInitType = OpRec->getNameInitAsString();
std::string PatOpType = PatternDag->getArg(I)->getAsString();
Expand Down Expand Up @@ -3137,8 +3129,7 @@ std::string getCSOperandType(
bool OpTypeIsPartOfAnyPattern =
any_of(InsnPatternMap.at(CGIName), [&](Record *PatternDag) {
return opIsPartOfiPTRPattern(
OpRec, OpName, PatternDag->getValueAsDag("PatternToMatch"), false,
true);
OpRec, OpName, PatternDag->getValueAsDag("PatternToMatch"), false);
});
if (OpTypeIsPartOfAnyPattern)
OperandType += " | CS_OP_MEM";
Expand Down
Loading