forked from OSchip/llvm-project
PR31007 and PR27884 will be closed: a possibility to compile constants like 0bH is now supported in MS asm.
llvm-svn: 301390
This commit is contained in:
parent
d5d8d91c1d
commit
c3c6723ab5
|
@ -144,6 +144,9 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
|
|||
" we don't have an asm parser for this target\n");
|
||||
Parser->setAssemblerDialect(Dialect);
|
||||
Parser->setTargetParser(*TAP.get());
|
||||
if (Dialect == InlineAsm::AD_Intel)
|
||||
// We need this flag to be able to parse numbers like "0bH"
|
||||
Parser->setParsingInlineAsm(true);
|
||||
if (MF) {
|
||||
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
|
||||
TAP->SetFrameRegister(TRI->getFrameRegister(*MF));
|
||||
|
|
|
@ -134,7 +134,7 @@ struct ParseStatementInfo {
|
|||
|
||||
SmallVectorImpl<AsmRewrite> *AsmRewrites = nullptr;
|
||||
|
||||
ParseStatementInfo() = default;
|
||||
ParseStatementInfo() = delete;
|
||||
ParseStatementInfo(SmallVectorImpl<AsmRewrite> *rewrites)
|
||||
: AsmRewrites(rewrites) {}
|
||||
};
|
||||
|
@ -737,6 +737,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
|||
|
||||
HadError = false;
|
||||
AsmCond StartingCondState = TheCondState;
|
||||
SmallVector<AsmRewrite, 4> AsmStrRewrites;
|
||||
|
||||
// If we are generating dwarf for assembly source files save the initial text
|
||||
// section and generate a .file directive.
|
||||
|
@ -756,7 +757,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
|||
|
||||
// While we have input, parse each statement.
|
||||
while (Lexer.isNot(AsmToken::Eof)) {
|
||||
ParseStatementInfo Info;
|
||||
ParseStatementInfo Info(&AsmStrRewrites);
|
||||
if (!parseStatement(Info, nullptr))
|
||||
continue;
|
||||
|
||||
|
@ -1650,7 +1651,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
|
|||
}
|
||||
|
||||
// Emit the label.
|
||||
if (!ParsingInlineAsm)
|
||||
if (!getTargetParser().isParsingInlineAsm())
|
||||
Out.EmitLabel(Sym, IDLoc);
|
||||
|
||||
// If we are generating dwarf for assembly source files then gather the
|
||||
|
@ -2057,9 +2058,9 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
|
|||
// If parsing succeeded, match the instruction.
|
||||
if (!ParseHadError) {
|
||||
uint64_t ErrorInfo;
|
||||
if (getTargetParser().MatchAndEmitInstruction(IDLoc, Info.Opcode,
|
||||
Info.ParsedOperands, Out,
|
||||
ErrorInfo, ParsingInlineAsm))
|
||||
if (getTargetParser().MatchAndEmitInstruction(
|
||||
IDLoc, Info.Opcode, Info.ParsedOperands, Out, ErrorInfo,
|
||||
getTargetParser().isParsingInlineAsm()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -3094,6 +3094,7 @@ bool X86AsmParser::ParseDirective(AsmToken DirectiveID) {
|
|||
else if (IDVal.startswith(".code"))
|
||||
return ParseDirectiveCode(IDVal, DirectiveID.getLoc());
|
||||
else if (IDVal.startswith(".att_syntax")) {
|
||||
getParser().setParsingInlineAsm(false);
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||
if (Parser.getTok().getString() == "prefix")
|
||||
Parser.Lex();
|
||||
|
@ -3106,6 +3107,7 @@ bool X86AsmParser::ParseDirective(AsmToken DirectiveID) {
|
|||
return false;
|
||||
} else if (IDVal.startswith(".intel_syntax")) {
|
||||
getParser().setAssemblerDialect(1);
|
||||
getParser().setParsingInlineAsm(true);
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||
if (Parser.getTok().getString() == "noprefix")
|
||||
Parser.Lex();
|
||||
|
|
Loading…
Reference in New Issue