mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-04 08:37:45 +00:00
[tablegen] Use hasPredCode()/hasImmCode() instead of getPredCode().empty()/getImmCode().empty(). NFC
These are cheaper ways of testing for the presence of code than generating the C++ code and testing it's empty. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315872 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a5204d0487
commit
b10e0a29ca
@ -807,8 +807,14 @@ TypeSetByHwMode TypeInfer::getLegalTypes() {
|
||||
|
||||
/// TreePredicateFn constructor. Here 'N' is a subclass of PatFrag.
|
||||
TreePredicateFn::TreePredicateFn(TreePattern *N) : PatFragRec(N) {
|
||||
assert((getPredCode().empty() || getImmCode().empty()) &&
|
||||
".td file corrupt: can't have a node predicate *and* an imm predicate");
|
||||
assert(
|
||||
(!hasPredCode() || !hasImmCode()) &&
|
||||
".td file corrupt: can't have a node predicate *and* an imm predicate");
|
||||
}
|
||||
|
||||
bool TreePredicateFn::hasPredCode() const {
|
||||
return isLoad() || isStore() ||
|
||||
!PatFragRec->getRecord()->getValueAsString("PredicateCode").empty();
|
||||
}
|
||||
|
||||
std::string TreePredicateFn::getPredCode() const {
|
||||
@ -933,6 +939,10 @@ std::string TreePredicateFn::getPredCode() const {
|
||||
return Code;
|
||||
}
|
||||
|
||||
bool TreePredicateFn::hasImmCode() const {
|
||||
return !PatFragRec->getRecord()->getValueAsString("ImmediateCode").empty();
|
||||
}
|
||||
|
||||
std::string TreePredicateFn::getImmCode() const {
|
||||
return PatFragRec->getRecord()->getValueAsString("ImmediateCode");
|
||||
}
|
||||
@ -1015,7 +1025,7 @@ StringRef TreePredicateFn::getImmTypeIdentifier() const {
|
||||
|
||||
/// isAlwaysTrue - Return true if this is a noop predicate.
|
||||
bool TreePredicateFn::isAlwaysTrue() const {
|
||||
return getPredCode().empty() && getImmCode().empty();
|
||||
return !hasPredCode() && !hasImmCode();
|
||||
}
|
||||
|
||||
/// Return the name to use in the generated code to reference this, this is
|
||||
@ -1085,7 +1095,7 @@ std::string TreePredicateFn::getCodeToRunOnSDNode() const {
|
||||
}
|
||||
|
||||
// Handle arbitrary node predicates.
|
||||
assert(!getPredCode().empty() && "Don't have any predicate code!");
|
||||
assert(hasPredCode() && "Don't have any predicate code!");
|
||||
StringRef ClassName;
|
||||
if (PatFragRec->getOnlyTree()->isLeaf())
|
||||
ClassName = "SDNode";
|
||||
|
@ -447,7 +447,7 @@ public:
|
||||
/// isAlwaysTrue - Return true if this is a noop predicate.
|
||||
bool isAlwaysTrue() const;
|
||||
|
||||
bool isImmediatePattern() const { return !getImmCode().empty(); }
|
||||
bool isImmediatePattern() const { return hasImmCode(); }
|
||||
|
||||
/// getImmediatePredicateCode - Return the code that evaluates this pattern if
|
||||
/// this is an immediate predicate. It is an error to call this on a
|
||||
@ -511,6 +511,8 @@ public:
|
||||
Record *getScalarMemoryVT() const;
|
||||
|
||||
private:
|
||||
bool hasPredCode() const;
|
||||
bool hasImmCode() const;
|
||||
std::string getPredCode() const;
|
||||
std::string getImmCode() const;
|
||||
bool immCodeUsesAPInt() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user