This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix intel syntax push parsing bug
ClosedPublic

Authored by niravd on Oct 5 2016, 11:24 AM.

Details

Summary

Change erroneous parsing of push immediate instructions in intel syntax
to default to pointer size by rewriting into the ATT style for matching.

This fixes PR22028.

Event Timeline

niravd updated this revision to Diff 73676.Oct 5 2016, 11:24 AM
niravd retitled this revision from to [X86] Fix intel syntax push parsing bug.
niravd added reviewers: majnemer, rnk.
niravd updated this object.
niravd added a subscriber: llvm-commits.
majnemer added inline comments.Oct 5 2016, 12:01 PM
lib/Target/X86/AsmParser/X86AsmParser.cpp
2799

auto *

2802

const auto *

niravd updated this revision to Diff 73691.Oct 5 2016, 1:41 PM

use auto types

niravd marked 2 inline comments as done.Oct 5 2016, 1:41 PM
rnk accepted this revision.Oct 5 2016, 2:08 PM
rnk edited edge metadata.

Looks terrible, please commit =(

Every time someone touches the X86 assembler I swear that this is the last straw, after this one fix we have to rewrite it from the ground up, but we just keep deferring it.

lib/Target/X86/AsmParser/X86AsmParser.cpp
2805–2808

IMO this is simpler:

char Tmp[] = "push ";
switch (getPointerWidth()) {
case 16: Tmp[4] = 'w'; break;
case 32: Tmp[4] = 'l'; break;
case 64: Tmp[4] = 'q'; break;
}
This revision is now accepted and ready to land.Oct 5 2016, 2:08 PM
This revision was automatically updated to reflect the committed changes.