// Emit everything up to the immediate/expression.
unsigned Len = Loc - AsmStart;
- if (Len) {
- // For Input/Output operands we need to remove the brackets, if present.
- if ((Kind == AOK_Input || Kind == AOK_Output) && Loc[-1] == '[')
- --Len;
+ if (Len)
OS << StringRef(AsmStart, Len);
- }
// Skip the original expression.
if (Kind == AOK_Skip) {
// Skip the original expression.
AsmStart = Loc + (*I).Len + AdditionalSkip;
-
- // For Input/Output operands we need to remove the brackets, if present.
- if ((Kind == AOK_Input || Kind == AOK_Output) && AsmStart != AsmEnd &&
- *AsmStart == ']')
- ++AsmStart;
}
// Emit the remainder of the asm string.
if (getLexer().isNot(AsmToken::RBrac))
return ErrorOperand(Tok.getLoc(), "Expected ']' token!");
+ if (isParsingInlineAsm()) {
+ // Remove the '[' and ']' from the IR string.
+ InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, Start, 1));
+ InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, Tok.getLoc(), 1));
+ }
unsigned Len = Tok.getLoc().getPointer() - IdentStart.getPointer();
StringRef SymName(IdentStart.getPointer(), Len);
Parser.Lex(); // Eat ']'
Parser.Lex(); // Consume the token.
}
}
+ if (isParsingInlineAsm() && Disp && isa<MCSymbolRefExpr>(Disp)) {
+ // Remove the '[' and ']' from the IR string.
+ InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, Start, 1));
+ InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, End, 1));
+ }
if (!Disp)
Disp = MCConstantExpr::Create(SM.getDisp(), getContext());