This is an archive of the discontinued LLVM Phabricator instance.

[X86] Parse and ignore .arch directives
ClosedPublic

Authored by MaskRay on Jul 29 2020, 5:34 PM.

Details

Summary

We parse .arch so that some .arch i386; .code32 code can assemble. It seems
that X86AsmParser does not do a good job tracking what features are needed to
assemble instructions. GNU as's x86 port supports a very wide range of .arch
operands. Ignore the operand for now.

So we simply ignore .arch for now

Diff Detail

Event Timeline

MaskRay created this revision.Jul 29 2020, 5:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2020, 5:34 PM
MaskRay requested review of this revision.Jul 29 2020, 5:34 PM
MaskRay updated this revision to Diff 281772.Jul 29 2020, 5:35 PM
MaskRay retitled this revision from [X86] Parse and ignore .arch directives We parse .arch so that some `.arch i386; .code32` code can assemble. It seems that X86AsmParser does not do a good job tracking what features are needed to assemble instructions. So we simply ignore .arch... to [X86] Parse and ignore .arch directives.
MaskRay edited the summary of this revision. (Show Details)
MaskRay added reviewers: craig.topper, echristo, RKSimon.

a

craig.topper added inline comments.Jul 29 2020, 9:22 PM
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
4058

I don't think the assembler's arch list matches the frontend -march list which is what parseArchX86 contains. Here's some docs for .arch https://sourceware.org/binutils/docs-2.31/as/i386_002dArch.html X86::parseArchX86 does not support i8086, i186, i286 and many others. It also looks like .arch can take features like .sse

MaskRay updated this revision to Diff 281792.Jul 29 2020, 9:37 PM
MaskRay edited the summary of this revision. (Show Details)

Ignore the operand

MaskRay marked an inline comment as done.Jul 29 2020, 9:38 PM
MaskRay added inline comments.
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
4058

Thanks. Let's ignore the operand for now.

The newer documentation is at
https://sourceware.org/binutils/docs/as/i386_002dArch.html#i386_002dArch

I find a few allowed values by looking at gas testsuite.

MaskRay updated this revision to Diff 281793.Jul 29 2020, 9:39 PM
MaskRay marked an inline comment as done.

Delete unused include

This revision is now accepted and ready to land.Jul 29 2020, 11:28 PM
This revision was landed with ongoing or failed builds.Jul 30 2020, 8:38 AM
This revision was automatically updated to reflect the committed changes.