[llvm-dev] [AMDGPU] AMDGPUAsmParser fails to parse several instructions

Matt Arsenault via llvm-dev
Sat, 24 Oct 2015 15:44:13 -0000

> On Oct 24, 2015, at 11:17 AM, Matt Arsenault <arsenm2 at gmail.com>
wrote:
>
> The crash is easy enough to fix by checking isReg() before the
setModifiers, but then the instruction is incorrectly rejected. I’m not really
sure what’s going on with that right now, but I’m guessing it has to do with the
way the modifiers are part of the same parsed operand, but separate in the
MCInst’s operands and the missing modifier operand isn’t being added for
immediates. I’m not really sure the right way to fix this.

It seems it’s being rejected here in AMDGPUGenAsmMatcher.inc

  // 'RegWithInputMods' class
  if (Kind == MCK_RegWithInputMods) {
    if (Operand.isRegWithInputMods())
      return MCTargetAsmParser::Match_Success;
  }

Operand is actually an immediate. I would expect this to be reaching

  // 'VCSrc32' class
  if (Kind == MCK_VCSrc32) {
    if (Operand.isVCSrc32())
      return MCTargetAsmParser::Match_Success;
  }

and passing here, but for some reason it isn’t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20151024/d1b6c859/attachment.html>