This is an archive of the discontinued LLVM Phabricator instance.

[X86] Teach the assembler parser to handle a '*' between segment register and base/index/displacement part of an address
ClosedPublic

Authored by craig.topper on Jul 29 2020, 3:40 PM.

Details

Summary

A '*' after the segment is equivalent to a '*' before the segment register. To make the AsmMatcher table work we need to place the '*' token into the operand vector before the full memory operand. To accomplish this I've modified some portions of operand parsing to expose the operand vector to ParseATTOperand so that the token can be pushed to the vector after parsing the segment register and before creating the memory operand using that segment register.

Fixes PR46879

Diff Detail

Event Timeline

craig.topper created this revision.Jul 29 2020, 3:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2020, 3:40 PM
craig.topper requested review of this revision.Jul 29 2020, 3:40 PM
MaskRay accepted this revision.Jul 29 2020, 4:15 PM

Thanks! I followed the control flow in the debugger. It looks good.
Do you have idea what we need to do with .arch? For the use of purgatory/arch/i386/entry32-16.S, maybe we can just ignore the directive for now?

llvm/test/MC/X86/x86-64.s
1904

This can be placed near line 400 where other ljmpl tests reside.

This revision is now accepted and ready to land.Jul 29 2020, 4:15 PM

Ah, we have lib/Support/X86TargetParser.cpp, llvm::X86::parseArchX86. We can use it. I can put up a patch (at least for the easy part..)