mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +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:
parent
d0175fe81c
commit
0d9ccf3b16
@ -4287,13 +4287,13 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() {
|
|||||||
PatternsToMatch.swap(Copy);
|
PatternsToMatch.swap(Copy);
|
||||||
|
|
||||||
auto AppendPattern = [this, &ModeChecks](PatternToMatch &P, unsigned Mode) {
|
auto AppendPattern = [this, &ModeChecks](PatternToMatch &P, unsigned Mode) {
|
||||||
TreePatternNodePtr NewSrc = P.SrcPattern->clone();
|
TreePatternNodePtr NewSrc = P.getSrcPattern()->clone();
|
||||||
TreePatternNodePtr NewDst = P.DstPattern->clone();
|
TreePatternNodePtr NewDst = P.getDstPattern()->clone();
|
||||||
if (!NewSrc->setDefaultMode(Mode) || !NewDst->setDefaultMode(Mode)) {
|
if (!NewSrc->setDefaultMode(Mode) || !NewDst->setDefaultMode(Mode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Predicate> Preds = P.Predicates;
|
std::vector<Predicate> Preds = P.getPredicates();
|
||||||
const std::vector<Predicate> &MC = ModeChecks[Mode];
|
const std::vector<Predicate> &MC = ModeChecks[Mode];
|
||||||
llvm::append_range(Preds, MC);
|
llvm::append_range(Preds, MC);
|
||||||
PatternsToMatch.emplace_back(P.getSrcRecord(), std::move(Preds),
|
PatternsToMatch.emplace_back(P.getSrcRecord(), std::move(Preds),
|
||||||
@ -4305,10 +4305,10 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() {
|
|||||||
|
|
||||||
for (PatternToMatch &P : Copy) {
|
for (PatternToMatch &P : Copy) {
|
||||||
TreePatternNodePtr SrcP = nullptr, DstP = nullptr;
|
TreePatternNodePtr SrcP = nullptr, DstP = nullptr;
|
||||||
if (P.SrcPattern->hasProperTypeByHwMode())
|
if (P.getSrcPattern()->hasProperTypeByHwMode())
|
||||||
SrcP = P.SrcPattern;
|
SrcP = P.getSrcPatternShared();
|
||||||
if (P.DstPattern->hasProperTypeByHwMode())
|
if (P.getDstPattern()->hasProperTypeByHwMode())
|
||||||
DstP = P.DstPattern;
|
DstP = P.getDstPatternShared();
|
||||||
if (!SrcP && !DstP) {
|
if (!SrcP && !DstP) {
|
||||||
PatternsToMatch.push_back(P);
|
PatternsToMatch.push_back(P);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1103,15 +1103,6 @@ public:
|
|||||||
/// PatternToMatch - Used by CodeGenDAGPatterns to keep tab of patterns
|
/// PatternToMatch - Used by CodeGenDAGPatterns to keep tab of patterns
|
||||||
/// processed to produce isel.
|
/// processed to produce isel.
|
||||||
class PatternToMatch {
|
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.
|
Record *SrcRecord; // Originating Record for the pattern.
|
||||||
TreePatternNodePtr SrcPattern; // Source pattern to match.
|
TreePatternNodePtr SrcPattern; // Source pattern to match.
|
||||||
TreePatternNodePtr DstPattern; // Resulting pattern.
|
TreePatternNodePtr DstPattern; // Resulting pattern.
|
||||||
@ -1122,6 +1113,15 @@ public:
|
|||||||
unsigned ID; // Unique ID for the record.
|
unsigned ID; // Unique ID for the record.
|
||||||
unsigned ForceMode; // Force this mode in type inference when set.
|
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; }
|
Record *getSrcRecord() const { return SrcRecord; }
|
||||||
TreePatternNode *getSrcPattern() const { return SrcPattern.get(); }
|
TreePatternNode *getSrcPattern() const { return SrcPattern.get(); }
|
||||||
TreePatternNodePtr getSrcPatternShared() const { return SrcPattern; }
|
TreePatternNodePtr getSrcPatternShared() const { return SrcPattern; }
|
||||||
@ -1130,6 +1130,8 @@ public:
|
|||||||
const std::vector<Record*> &getDstRegs() const { return Dstregs; }
|
const std::vector<Record*> &getDstRegs() const { return Dstregs; }
|
||||||
int getAddedComplexity() const { return AddedComplexity; }
|
int getAddedComplexity() const { return AddedComplexity; }
|
||||||
const std::vector<Predicate> &getPredicates() const { return Predicates; }
|
const std::vector<Predicate> &getPredicates() const { return Predicates; }
|
||||||
|
unsigned getID() const { return ID; }
|
||||||
|
unsigned getForceMode() const { return ForceMode; }
|
||||||
|
|
||||||
std::string getPredicateCheck() const;
|
std::string getPredicateCheck() const;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ struct PatternSortingPredicate {
|
|||||||
// pattern may have been resolved into multiple match patterns due to
|
// pattern may have been resolved into multiple match patterns due to
|
||||||
// alternative fragments. To ensure deterministic output, always use
|
// alternative fragments. To ensure deterministic output, always use
|
||||||
// std::stable_sort with this predicate.
|
// std::stable_sort with this predicate.
|
||||||
return LHS->ID < RHS->ID;
|
return LHS->getID() < RHS->getID();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // End anonymous namespace
|
} // End anonymous namespace
|
||||||
|
@ -163,7 +163,7 @@ MatcherGen::MatcherGen(const PatternToMatch &pattern,
|
|||||||
PatWithNoTypes->RemoveAllTypes();
|
PatWithNoTypes->RemoveAllTypes();
|
||||||
|
|
||||||
// If there are types that are manifestly known, infer them.
|
// 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
|
/// 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.
|
// Emit the matcher for the pattern structure and types.
|
||||||
EmitMatchCode(Pattern.getSrcPattern(), PatWithNoTypes.get(),
|
EmitMatchCode(Pattern.getSrcPattern(), PatWithNoTypes.get(),
|
||||||
Pattern.ForceMode);
|
Pattern.getForceMode());
|
||||||
|
|
||||||
// If the pattern has a predicate on it (e.g. only enabled when a subtarget
|
// If the pattern has a predicate on it (e.g. only enabled when a subtarget
|
||||||
// feature is around, do the check).
|
// feature is around, do the check).
|
||||||
|
Loading…
Reference in New Issue
Block a user