".td file corrupt: can't have a node predicate *and* an imm predicate");
}
-StringRef TreePredicateFn::getPredCode() const {
+std::string TreePredicateFn::getPredCode() const {
return PatFragRec->getRecord()->getValueAsString("PredicateCode");
}
-StringRef TreePredicateFn::getImmCode() const {
+std::string TreePredicateFn::getImmCode() const {
return PatFragRec->getRecord()->getValueAsString("ImmediateCode");
}
/// appropriate.
std::string TreePredicateFn::getCodeToRunOnSDNode() const {
// Handle immediate predicates first.
- StringRef ImmCode = getImmCode();
+ std::string ImmCode = getImmCode();
if (!ImmCode.empty()) {
std::string Result =
" int64_t Imm = cast<ConstantSDNode>(Node)->getSExtValue();\n";
- return Result + ImmCode.str();
+ return Result + ImmCode;
}
// Handle arbitrary node predicates.
assert(!getPredCode().empty() && "Don't have any predicate code!");
- StringRef ClassName;
+ std::string ClassName;
if (PatFragRec->getOnlyTree()->isLeaf())
ClassName = "SDNode";
else {
if (ClassName == "SDNode")
Result = " SDNode *N = Node;\n";
else
- Result = " auto *N = cast<" + ClassName.str() + ">(Node);\n";
+ Result = " auto *N = cast<" + ClassName + ">(Node);\n";
- return Result + getPredCode().str();
+ return Result + getPredCode();
}
//===----------------------------------------------------------------------===//
VerifyInstructionFlags();
}
-Record *CodeGenDAGPatterns::getSDNodeNamed(StringRef Name) const {
+Record *CodeGenDAGPatterns::getSDNodeNamed(const std::string &Name) const {
Record *N = Records.getDef(Name);
if (!N || !N->isSubClassOf("SDNode"))
PrintFatalError("Error getting SDNode '" + Name + "'!");
/// getImmediatePredicateCode - Return the code that evaluates this pattern if
/// this is an immediate predicate. It is an error to call this on a
/// non-immediate pattern.
- StringRef getImmediatePredicateCode() const {
- StringRef Result = getImmCode();
+ std::string getImmediatePredicateCode() const {
+ std::string Result = getImmCode();
assert(!Result.empty() && "Isn't an immediate pattern!");
return Result;
}
std::string getCodeToRunOnSDNode() const;
private:
- StringRef getPredCode() const;
- StringRef getImmCode() const;
+ std::string getPredCode() const;
+ std::string getImmCode() const;
};
const CodeGenTarget &getTargetInfo() const { return Target; }
const TypeSetByHwMode &getLegalTypes() const { return LegalVTS; }
- Record *getSDNodeNamed(StringRef Name) const;
+ Record *getSDNodeNamed(const std::string &Name) const;
const SDNodeInfo &getSDNodeInfo(Record *R) const {
auto F = SDNodes.find(R);