The asm parser had a notional distinction between parsing an
operand (like "%foo" or "%4#3") and parsing a region argument
(which isn't supposed to allow a result number like #3).
Unfortunately the implementation has two problems:
- It didn't actually check for the result number and reject it. parseRegionArgument and parseOperand were identical.
- It had a lot of machinery built up around it that paralleled operand parsing. This also was functionally identical, but also had some subtle differences (e.g. the parseOptional stuff had a different result type).
I thought about just removing all of this, but decided that the
missing error checking was important, so I reimplemented it with
a allowResultNumber flag on parseOperand. This keeps the
codepaths unified and adds the missing error checks.
incidentally, I think it makes sense to remove requiredOperandCount at this point. The original usecase was for things like binary operators that had two operands, but these get broken out into explicit parseOperand calls these days. This isn't related to this patch though.