[llvm-branch-commits] [llvm-branch] r205814 - Merging r203146:
Tom Stellard
thomas.stellard at amd.com
Tue Apr 8 16:00:32 PDT 2014
Author: tstellar
Date: Tue Apr 8 18:00:32 2014
New Revision: 205814
URL: http://llvm.org/viewvc/llvm-project?rev=205814&view=rev
Log:
Merging r203146:
------------------------------------------------------------------------
r203146 | reid | 2014-03-06 14:19:12 -0500 (Thu, 06 Mar 2014) | 6 lines
MS asm: The initial dot in struct access is optional
Fixes PR18994.
Tests, once again, in that other repository. =P
------------------------------------------------------------------------
Modified:
llvm/branches/release_34/lib/MC/MCParser/AsmParser.cpp
llvm/branches/release_34/lib/Target/X86/AsmParser/X86AsmParser.cpp
Modified: llvm/branches/release_34/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_34/lib/MC/MCParser/AsmParser.cpp?rev=205814&r1=205813&r2=205814&view=diff
==============================================================================
--- llvm/branches/release_34/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/branches/release_34/lib/MC/MCParser/AsmParser.cpp Tue Apr 8 18:00:32 2014
@@ -4292,6 +4292,10 @@ bool AsmParser::parseMSInlineAsm(
break;
}
case AOK_DotOperator:
+ // Insert the dot if the user omitted it.
+ OS.flush();
+ if (AsmStringIR.at(AsmStringIR.size() - 1) != '.')
+ OS << '.';
OS << (*I).Val;
break;
}
Modified: llvm/branches/release_34/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_34/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=205814&r1=205813&r2=205814&view=diff
==============================================================================
--- llvm/branches/release_34/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/branches/release_34/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Apr 8 18:00:32 2014
@@ -1312,10 +1312,15 @@ bool X86AsmParser::ParseIntelExpression(
if (getParser().parsePrimaryExpr(Val, End))
return Error(Tok.getLoc(), "Unexpected identifier!");
} else {
- InlineAsmIdentifierInfo &Info = SM.getIdentifierInfo();
- if (ParseIntelIdentifier(Val, Identifier, Info,
- /*Unevaluated=*/false, End))
- return true;
+ // This is a dot operator, not an adjacent identifier.
+ if (Identifier.find('.') != StringRef::npos) {
+ return false;
+ } else {
+ InlineAsmIdentifierInfo &Info = SM.getIdentifierInfo();
+ if (ParseIntelIdentifier(Val, Identifier, Info,
+ /*Unevaluated=*/false, End))
+ return true;
+ }
}
SM.onIdentifierExpr(Val, Identifier);
UpdateLocLex = false;
@@ -1379,8 +1384,10 @@ X86Operand *X86AsmParser::ParseIntelBrac
Disp = MCConstantExpr::Create(SM.getImm(), getContext());
}
- // Parse the dot operator (e.g., [ebx].foo.bar).
- if (Tok.getString().startswith(".")) {
+ // Parse struct field access. Intel requires a dot, but MSVC doesn't. MSVC
+ // will in fact do global lookup the field name inside all global typedefs,
+ // but we don't emulate that.
+ if (Tok.getString().find('.') != StringRef::npos) {
const MCExpr *NewDisp;
if (ParseIntelDotOperator(Disp, NewDisp))
return 0;
@@ -1532,8 +1539,10 @@ bool X86AsmParser::ParseIntelDotOperator
else
return Error(Tok.getLoc(), "Non-constant offsets are not supported!");
- // Drop the '.'.
- StringRef DotDispStr = Tok.getString().drop_front(1);
+ // Drop the optional '.'.
+ StringRef DotDispStr = Tok.getString();
+ if (DotDispStr.startswith("."))
+ DotDispStr = DotDispStr.drop_front(1);
// .Imm gets lexed as a real.
if (Tok.is(AsmToken::Real)) {
More information about the llvm-branch-commits
mailing list