1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[TableGen] Make all the fields in PatternToMatch private. NFCI

Add the few missing accessor methods. Use accessor methdods
everywhere.
This commit is contained in:
Craig Topper 2021-02-06 22:31:38 -08:00
parent d0175fe81c
commit 0d9ccf3b16
4 changed files with 21 additions and 19 deletions

View File

@ -4287,13 +4287,13 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() {
PatternsToMatch.swap(Copy);
auto AppendPattern = [this, &ModeChecks](PatternToMatch &P, unsigned Mode) {
TreePatternNodePtr NewSrc = P.SrcPattern->clone();
TreePatternNodePtr NewDst = P.DstPattern->clone();
TreePatternNodePtr NewSrc = P.getSrcPattern()->clone();
TreePatternNodePtr NewDst = P.getDstPattern()->clone();
if (!NewSrc->setDefaultMode(Mode) || !NewDst->setDefaultMode(Mode)) {
return;
}
std::vector<Predicate> Preds = P.Predicates;
std::vector<Predicate> Preds = P.getPredicates();
const std::vector<Predicate> &MC = ModeChecks[Mode];
llvm::append_range(Preds, MC);
PatternsToMatch.emplace_back(P.getSrcRecord(), std::move(Preds),
@ -4305,10 +4305,10 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() {
for (PatternToMatch &P : Copy) {
TreePatternNodePtr SrcP = nullptr, DstP = nullptr;
if (P.SrcPattern->hasProperTypeByHwMode())
SrcP = P.SrcPattern;
if (P.DstPattern->hasProperTypeByHwMode())
DstP = P.DstPattern;
if (P.getSrcPattern()->hasProperTypeByHwMode())
SrcP = P.getSrcPatternShared();
if (P.getDstPattern()->hasProperTypeByHwMode())
DstP = P.getDstPatternShared();
if (!SrcP && !DstP) {
PatternsToMatch.push_back(P);
continue;

View File

@ -1103,15 +1103,6 @@ public:
/// PatternToMatch - Used by CodeGenDAGPatterns to keep tab of patterns
/// processed to produce isel.
class PatternToMatch {
public:
PatternToMatch(Record *srcrecord, std::vector<Predicate> preds,
TreePatternNodePtr src, TreePatternNodePtr dst,
std::vector<Record *> dstregs, int complexity,
unsigned uid, unsigned setmode = 0)
: SrcRecord(srcrecord), SrcPattern(src), DstPattern(dst),
Predicates(std::move(preds)), Dstregs(std::move(dstregs)),
AddedComplexity(complexity), ID(uid), ForceMode(setmode) {}
Record *SrcRecord; // Originating Record for the pattern.
TreePatternNodePtr SrcPattern; // Source pattern to match.
TreePatternNodePtr DstPattern; // Resulting pattern.
@ -1122,6 +1113,15 @@ public:
unsigned ID; // Unique ID for the record.
unsigned ForceMode; // Force this mode in type inference when set.
public:
PatternToMatch(Record *srcrecord, std::vector<Predicate> preds,
TreePatternNodePtr src, TreePatternNodePtr dst,
std::vector<Record *> dstregs, int complexity,
unsigned uid, unsigned setmode = 0)
: SrcRecord(srcrecord), SrcPattern(src), DstPattern(dst),
Predicates(std::move(preds)), Dstregs(std::move(dstregs)),
AddedComplexity(complexity), ID(uid), ForceMode(setmode) {}
Record *getSrcRecord() const { return SrcRecord; }
TreePatternNode *getSrcPattern() const { return SrcPattern.get(); }
TreePatternNodePtr getSrcPatternShared() const { return SrcPattern; }
@ -1130,6 +1130,8 @@ public:
const std::vector<Record*> &getDstRegs() const { return Dstregs; }
int getAddedComplexity() const { return AddedComplexity; }
const std::vector<Predicate> &getPredicates() const { return Predicates; }
unsigned getID() const { return ID; }
unsigned getForceMode() const { return ForceMode; }
std::string getPredicateCheck() const;

View File

@ -115,7 +115,7 @@ struct PatternSortingPredicate {
// pattern may have been resolved into multiple match patterns due to
// alternative fragments. To ensure deterministic output, always use
// std::stable_sort with this predicate.
return LHS->ID < RHS->ID;
return LHS->getID() < RHS->getID();
}
};
} // End anonymous namespace

View File

@ -163,7 +163,7 @@ MatcherGen::MatcherGen(const PatternToMatch &pattern,
PatWithNoTypes->RemoveAllTypes();
// If there are types that are manifestly known, infer them.
InferPossibleTypes(Pattern.ForceMode);
InferPossibleTypes(Pattern.getForceMode());
}
/// InferPossibleTypes - As we emit the pattern, we end up generating type
@ -576,7 +576,7 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) {
// Emit the matcher for the pattern structure and types.
EmitMatchCode(Pattern.getSrcPattern(), PatWithNoTypes.get(),
Pattern.ForceMode);
Pattern.getForceMode());
// If the pattern has a predicate on it (e.g. only enabled when a subtarget
// feature is around, do the check).