OSDN Git Service

Changed the X86 assembler for intel syntax to work with directional labels.
authorKevin Enderby <enderby@apple.com>
Thu, 19 Dec 2013 22:02:03 +0000 (22:02 +0000)
committerKevin Enderby <enderby@apple.com>
Thu, 19 Dec 2013 22:02:03 +0000 (22:02 +0000)
commit86f49d5c017e8b7f059271b3acbcceed0ba83f37
tree436eef8a8adf4792e158b156c222a27653b39813
parent1191926a8ae4097be2e3ca37d31b5083c16c6d55
Changed the X86 assembler for intel syntax to work with directional labels.

The X86 assembler has a separate code to parser the intel assembly syntax
in X86AsmParser::ParseIntelOperand().  This did not parse directional labels.
And if something like 1f was used as a branch target it would get an
"Unexpected token" error.

The fix starts in X86AsmParser::ParseIntelExpression() in the case for
AsmToken::Integer, it needs to grab the IntVal from the current token
then look for a 'b' or 'f' following the Integer.  Then it basically needs to
do what is done in AsmParser::parsePrimaryExpr() for directional
labels.  It saves the MCExpr it creates in the IntelExprStateMachine
in the Sym field.

When it returns to X86AsmParser::ParseIntelOperand() it looks
for a non-zero Sym field in the IntelExprStateMachine and if
set it creates a memory operand not an immediate operand
it would normally do for the Integer.

rdar://14961158

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197728 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/X86/intel-syntax-directional-label.s [new file with mode: 0644]