18 SS <<
"invalid node: " << Msg <<
'\n';
19 N->printrWithDepth(SS, &DAG, 2);
24 unsigned ResIdx,
EVT ExpectedVT) {
25 EVT ActualVT =
N->getValueType(ResIdx);
26 if (ActualVT != ExpectedVT)
29 "result #" +
Twine(ResIdx) +
" has invalid type; expected " +
35 EVT ActualVT =
N->getOperand(
OpIdx).getValueType();
36 if (ActualVT != ExpectedVT)
39 "operand #" +
Twine(
OpIdx) +
" has invalid type; expected " +
51 unsigned ActualNumResults =
N->getNumValues();
52 unsigned ExpectedNumResults =
Desc.NumResults + HasChain + HasOutGlue;
54 if (ActualNumResults != ExpectedNumResults)
56 "invalid number of results; expected " +
57 Twine(ExpectedNumResults) +
", got " +
58 Twine(ActualNumResults));
62 unsigned ChainResIdx =
Desc.NumResults;
68 unsigned GlueResIdx =
Desc.NumResults + HasChain;
76 bool HasOptionalOperands =
Desc.NumOperands < 0 || IsVariadic;
78 unsigned ActualNumOperands =
N->getNumOperands();
79 unsigned ExpectedMinNumOperands =
80 (
Desc.NumOperands >= 0 ?
Desc.NumOperands : 0) + HasChain + HasInGlue;
83 if (ActualNumOperands < ExpectedMinNumOperands) {
84 StringRef How = HasOptionalOperands ?
"at least " :
"";
86 "invalid number of operands; expected " + How +
87 Twine(ExpectedMinNumOperands) +
", got " +
88 Twine(ActualNumOperands));
93 if (
Desc.NumOperands >= 0 && !IsVariadic) {
95 unsigned ExpectedMaxNumOperands = ExpectedMinNumOperands + HasOptInGlue;
96 if (ActualNumOperands > ExpectedMaxNumOperands) {
97 StringRef How = HasOptInGlue ?
"at most " :
"";
99 "invalid number of operands; expected " + How +
100 Twine(ExpectedMaxNumOperands) +
", got " +
101 Twine(ActualNumOperands));
112 if (HasOptInGlue && ActualNumOperands >= 1 &&
113 N->getOperand(ActualNumOperands - 1).getValueType() == MVT::Glue)
117 if (IsVariadic &&
Desc.NumOperands >= 0) {
118 unsigned VarOpStart = HasChain +
Desc.NumOperands;
119 unsigned VarOpEnd = ActualNumOperands - HasInGlue;
121 unsigned OpOpcode =
N->getOperand(
OpIdx).getOpcode();
125 " must be Register or RegisterMask");
MachineInstr unsigned OpIdx
static void checkOperandType(const SelectionDAG &DAG, const SDNode *N, unsigned OpIdx, EVT ExpectedVT)
static void reportNodeError(const SelectionDAG &DAG, const SDNode *N, const Twine &Msg)
static void checkResultType(const SelectionDAG &DAG, const SDNode *N, unsigned ResIdx, EVT ExpectedVT)
const SDNodeDesc & getDesc(unsigned Opcode) const
Returns the description of a node with the given opcode.
void verifyNode(const SelectionDAG &DAG, const SDNode *N) const
Represents one node in the SelectionDAG.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
A raw_ostream that writes to an std::string.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Description of the encoding of one expression Op.
LLVM_ABI std::string getEVTString() const
This function returns value type as a string, e.g. "i32".