Teach the asmprinter to print out operands for OperationInst's. This
is still limited in several ways, which i'll build out in subsequent patches.
Rename the accessor for inst operands/results to make the Operand/Result
versions of these more obscure, allowing getOperand/getResult to traffic
in values (which is what - by far - most clients actually care about).
PiperOrigin-RevId: 205408439
diff --git a/lib/Parser/Parser.cpp b/lib/Parser/Parser.cpp
index 7b7ee89..b8bae40 100644
--- a/lib/Parser/Parser.cpp
+++ b/lib/Parser/Parser.cpp
@@ -1364,8 +1364,7 @@
if (operandTypes.size() != operandInfos.size()) {
auto plural = "s"[operandInfos.size() == 1];
return emitError(typeLoc, "expected " + llvm::utostr(operandInfos.size()) +
- " type" + plural +
- " in operand list but had " +
+ " operand type" + plural + " but had " +
llvm::utostr(operandTypes.size()));
}
@@ -1395,11 +1394,10 @@
// FIXME: Add result infra to handle Stmt results as well to make this
// generic.
if (auto *inst = dyn_cast<OperationInst>(op)) {
- if (inst->getResults().empty())
+ if (inst->getNumResults() == 0)
return emitError(loc, "cannot name an operation with no results");
- // TODO: This should be getResult(0)
- addDefinition({resultID, loc}, &inst->getResults()[0]);
+ addDefinition({resultID, loc}, inst->getResult(0));
}
}