[PATCH] D42293: [TableGen][AsmMatcherEmitter] Fix tied-constraint checking for InstAliases
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 22 01:46:22 PST 2018
sdesmalen added a comment.
In https://reviews.llvm.org/D42293#982062, @dsanders wrote:
> The approach you're describing sounds good to me. I've got one question about the example from the other review:
>
> def : InstAlias<"mov $dst, $src, $src, $src", (ORRWrs GPR32:$dst, WZR, GPR32:$src, 0), 2>;
>
> It looks like this patch will handle the tie between the first two $src's but ignore the third. If that's a limitation of the implementation then I think that buildAliasResultOperands() should call findAsmOperandNamed() once more and report an error if another instance of $src is found.
Only multiple `$src` operands that correspond to a tied operand in the MCInst will be handled, subsequent mentions of `$src` in the asm-string are error'd by TableGen. This is done in `AsmMatcherEmitter.cpp line 1891` where it goes through the map of all named operands and their 'last' mention in the asm string. If it is mentioned more than once without corresponding to a variable in the MCInst (at line 1891, all result operands are handled so any further mention of a variable in the asm string cannot correspond to a result operand) , an error is given that the operand can never be matched.
https://reviews.llvm.org/D42293
More information about the llvm-commits
mailing list