[PATCH] D39909: [ARM] Issue an eror when non-general-purpose registers used in address operands

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 07:22:43 PST 2017


chill added a comment.

Correct me if I'm wrong ...

For me it seems that the approach of returning just true/false from the asm operand class predicates, while
good for weeding out invalid instructions, isn't that great for diagnostics. The operand may be invalid for
a variety of reasons, but we have only one diagnostics string, which can at best list all the possible constraints
and let the user figure out by themselves what's wrong.

For example, assembling:

  vld1.16 {d0}, [s0:64]

with `llvm-mc -triple=armv7a-eabi` gives `error: alignment must be 64 or omitted`, and if we need to improve
this message, we'd have to list the constrain that the register must be GPR. And do that for all/lot-of the other
`AsmOperandClasss`es, which would create a huge number of repetetetetitions of the constraint "X must be a GPR".
If we instead diagnose usage of non-GPR registers in the parser, and leave checking more specific constraints
(like "X must not be PC" or "X must be SP") to asm operand class predicates, some diagnostics will be more
precise and the rest will require less effort by the user, because that'd list a comparatively small number of
constraints to manually check.


https://reviews.llvm.org/D39909





More information about the llvm-commits mailing list