This is an archive of the discontinued LLVM Phabricator instance.

Fix bug in ins and outs operand order
ClosedPublic

Authored by myatsina on Jul 19 2015, 1:51 AM.

Details

Summary

The order of the operands for intel syntax is reverse to the order of the operands for AT&T syntax:
ins mem8/16/32, DX
outs DX, mem8/12/32
Current implementation causes "invalid operand for instruction" error for MS inline assembly.

Diff Detail

Repository
rL LLVM

Event Timeline

myatsina updated this revision to Diff 30110.Jul 19 2015, 1:51 AM
myatsina retitled this revision from to Fix bug in ins and outs operand order.
myatsina updated this object.
myatsina added reviewers: rnk, dwmw2.
myatsina set the repository for this revision to rL LLVM.
myatsina added a subscriber: llvm-commits.
rnk added inline comments.Jul 20 2015, 12:53 PM
lib/Target/X86/AsmParser/X86AsmParser.cpp
2231–2236 ↗(On Diff #30110)

We should fix this by writing a helper method with a signature like the following:

addDefaultSrcDestOperands(Operands, Src, Dst);

It eliminates an error-prone construct and reduces duplication.

myatsina updated this revision to Diff 30380.Jul 22 2015, 11:51 AM

Created AddDefaultSrcDestOperands() method, as suggested.

rnk accepted this revision.Jul 22 2015, 1:31 PM
rnk edited edge metadata.

lgtm

Thanks!

This revision is now accepted and ready to land.Jul 22 2015, 1:31 PM
This revision was automatically updated to reflect the committed changes.