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

Matt Arsenault via llvm-dev llvm-dev at lists.llvm.org
Sat Oct 24 09:30:32 PDT 2015


> On Oct 24, 2015, at 11:44 AM, Matt Arsenault <arsenm2 at gmail.com> wrote:
> 
> 
>> On Oct 24, 2015, at 11:17 AM, Matt Arsenault <arsenm2 at gmail.com <mailto: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.



Here’s a hacky patch which fixes it

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151024/5ea21f0e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-XXX-AMDGPU-Hack-to-fix-source-modifiers-with-immedia.patch
Type: application/octet-stream
Size: 3168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151024/5ea21f0e/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151024/5ea21f0e/attachment-0001.html>


More information about the llvm-dev mailing list