/// Emit a C++ expression that checks the predicate for the OpIdx operand of
/// the instruction given in InsnVarName.
- virtual void emitCxxPredicateExpr(raw_ostream &OS,
- const StringRef InsnVarName,
+ virtual void emitCxxPredicateExpr(raw_ostream &OS, StringRef InsnVarName,
unsigned OpIdx) const = 0;
};
public:
LLTOperandMatcher(std::string Ty) : Ty(Ty) {}
- void emitCxxPredicateExpr(raw_ostream &OS, const StringRef InsnVarName,
+ void emitCxxPredicateExpr(raw_ostream &OS, StringRef InsnVarName,
unsigned OpIdx) const override {
OS << "MRI.getType(" << InsnVarName << ".getOperand(" << OpIdx
<< ").getReg()) == (" << Ty << ")";
public:
RegisterBankOperandMatcher(const CodeGenRegisterClass &RC) : RC(RC) {}
- void emitCxxPredicateExpr(raw_ostream &OS, const StringRef InsnVarName,
+ void emitCxxPredicateExpr(raw_ostream &OS, StringRef InsnVarName,
unsigned OpIdx) const override {
OS << "(&RBI.getRegBankFromRegClass(" << RC.getQualifiedName()
<< "RegClass) == RBI.getRegBank(" << InsnVarName << ".getOperand("
/// Generates code to check that an operand is a basic block.
class MBBOperandMatcher : public OperandPredicateMatcher {
public:
- void emitCxxPredicateExpr(raw_ostream &OS, const StringRef InsnVarName,
+ void emitCxxPredicateExpr(raw_ostream &OS, StringRef InsnVarName,
unsigned OpIdx) const override {
OS << InsnVarName << ".getOperand(" << OpIdx << ").isMBB()";
}
/// Emit a C++ expression that tests whether the instruction named in
/// InsnVarName matches all the predicate and all the operands.
- void emitCxxPredicateExpr(raw_ostream &OS, const StringRef InsnVarName) const {
+ void emitCxxPredicateExpr(raw_ostream &OS, StringRef InsnVarName) const {
OS << "(";
emitCxxPredicateListExpr(OS, InsnVarName, OpIdx);
OS << ")";
/// Emit a C++ expression that tests whether the instruction named in
/// InsnVarName matches the predicate.
virtual void emitCxxPredicateExpr(raw_ostream &OS,
- const StringRef InsnVarName) const = 0;
+ StringRef InsnVarName) const = 0;
};
/// Generates code to check the opcode of an instruction.
InstructionOpcodeMatcher(const CodeGenInstruction *I) : I(I) {}
void emitCxxPredicateExpr(raw_ostream &OS,
- const StringRef InsnVarName) const override {
+ StringRef InsnVarName) const override {
OS << InsnVarName << ".getOpcode() == " << I->Namespace
<< "::" << I->TheDef->getName();
}
/// Emit a C++ expression that tests whether the instruction named in
/// InsnVarName matches all the predicates and all the operands.
- void emitCxxPredicateExpr(raw_ostream &OS, const StringRef InsnVarName) const {
+ void emitCxxPredicateExpr(raw_ostream &OS, StringRef InsnVarName) const {
emitCxxPredicateListExpr(OS, InsnVarName);
for (const auto &Operand : Operands) {
OS << " &&\n(";