Deleted Added
full compact
1184,1193c1184,1200
< if (isa<MCSymbolRefExpr>(Disp)) {
< // If this is not a VarDecl then assume it is a FuncDecl or some other label
< // reference. We need an 'r' constraint here, so we need to create register
< // operand to ensure proper matching. Just pick a GPR based on the size of
< // a pointer.
< if (!Info.IsVarDecl) {
< unsigned RegNo = is64BitMode() ? X86::RBX : X86::EBX;
< return X86Operand::CreateReg(RegNo, Start, End, /*AddressOf=*/true,
< SMLoc(), Identifier, Info.OpDecl);
< }
---
> // If this is not a VarDecl then assume it is a FuncDecl or some other label
> // reference. We need an 'r' constraint here, so we need to create register
> // operand to ensure proper matching. Just pick a GPR based on the size of
> // a pointer.
> if (isa<MCSymbolRefExpr>(Disp) && !Info.IsVarDecl) {
> unsigned RegNo = is64BitMode() ? X86::RBX : X86::EBX;
> return X86Operand::CreateReg(RegNo, Start, End, /*AddressOf=*/true,
> SMLoc(), Identifier, Info.OpDecl);
> }
>
> // We either have a direct symbol reference, or an offset from a symbol. The
> // parser always puts the symbol on the LHS, so look there for size
> // calculation purposes.
> const MCBinaryExpr *BinOp = dyn_cast<MCBinaryExpr>(Disp);
> bool IsSymRef =
> isa<MCSymbolRefExpr>(BinOp ? BinOp->getLHS() : Disp);
> if (IsSymRef) {
1315,1318c1322,1330
< 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;
> }
1369c1381
< const MCExpr *Disp;
---
> const MCExpr *Disp = 0;
1377,1379d1388
< } else {
< // An immediate displacement only.
< Disp = MCConstantExpr::Create(SM.getImm(), getContext());
1382,1383c1391,1402
< // Parse the dot operator (e.g., [ebx].foo.bar).
< if (Tok.getString().startswith(".")) {
---
> if (SM.getImm() || !Disp) {
> const MCExpr *Imm = MCConstantExpr::Create(SM.getImm(), getContext());
> if (Disp)
> Disp = MCBinaryExpr::CreateAdd(Disp, Imm, getContext());
> else
> Disp = Imm; // An immediate displacement only.
> }
>
> // 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) {
1535,1536c1554,1557
< // Drop the '.'.
< StringRef DotDispStr = Tok.getString().drop_front(1);
---
> // Drop the optional '.'.
> StringRef DotDispStr = Tok.getString();
> if (DotDispStr.startswith("."))
> DotDispStr = DotDispStr.drop_front(1);