diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp --- a/clang/lib/Parse/ParseStmtAsm.cpp +++ b/clang/lib/Parse/ParseStmtAsm.cpp @@ -631,8 +631,8 @@ // Change to the Intel dialect. Parser->setAssemblerDialect(1); Parser->setTargetParser(*TargetParser.get()); - Parser->setParsingInlineAsm(true); - TargetParser->setParsingInlineAsm(true); + Parser->setParsingMSInlineAsm(true); + TargetParser->setParsingMSInlineAsm(true); ClangAsmParserCallback Callback(*this, AsmLoc, AsmString, AsmToks, TokOffsets); diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParser.h b/llvm/include/llvm/MC/MCParser/MCAsmParser.h --- a/llvm/include/llvm/MC/MCParser/MCAsmParser.h +++ b/llvm/include/llvm/MC/MCParser/MCAsmParser.h @@ -165,8 +165,8 @@ /// Run the parser on the input source buffer. virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0; - virtual void setParsingInlineAsm(bool V) = 0; - virtual bool isParsingInlineAsm() = 0; + virtual void setParsingMSInlineAsm(bool V) = 0; + virtual bool isParsingMSInlineAsm() = 0; /// Parse MS-style inline assembly. virtual bool parseMSInlineAsm( diff --git a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h --- a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h +++ b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h @@ -329,8 +329,8 @@ /// AvailableFeatures - The current set of available features. FeatureBitset AvailableFeatures; - /// ParsingInlineAsm - Are we parsing ms-style inline assembly? - bool ParsingInlineAsm = false; + /// ParsingMSInlineAsm - Are we parsing ms-style inline assembly? + bool ParsingMSInlineAsm = false; /// SemaCallback - The Sema callback implementation. Must be set when parsing /// ms-style inline assembly. @@ -359,8 +359,8 @@ AvailableFeatures = Value; } - bool isParsingInlineAsm () { return ParsingInlineAsm; } - void setParsingInlineAsm (bool Value) { ParsingInlineAsm = Value; } + bool isParsingMSInlineAsm () { return ParsingMSInlineAsm; } + void setParsingMSInlineAsm (bool Value) { ParsingMSInlineAsm = Value; } MCTargetOptions getTargetOptions() const { return MCOptions; } diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -174,7 +174,7 @@ bool IsDarwin = false; /// Are we parsing ms-style inline assembly? - bool ParsingInlineAsm = false; + bool ParsingMSInlineAsm = false; /// Did we already inform the user about inconsistent MD5 usage? bool ReportedInconsistentMD5 = false; @@ -226,13 +226,13 @@ const AsmToken &Lex() override; - void setParsingInlineAsm(bool V) override { - ParsingInlineAsm = V; + void setParsingMSInlineAsm(bool V) override { + ParsingMSInlineAsm = V; // When parsing MS inline asm, we must lex 0b1101 and 0ABCH as binary and // hex integer literals. Lexer.setLexMasmIntegers(V); } - bool isParsingInlineAsm() override { return ParsingInlineAsm; } + bool isParsingMSInlineAsm() override { return ParsingMSInlineAsm; } bool parseMSInlineAsm(void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, @@ -994,7 +994,7 @@ } bool AsmParser::checkForValidSection() { - if (!ParsingInlineAsm && !getStreamer().getCurrentSectionOnly()) { + if (!ParsingMSInlineAsm && !getStreamer().getCurrentSectionOnly()) { Out.InitSections(false); return Error(getTok().getLoc(), "expected section directive before assembly directive"); @@ -1821,7 +1821,7 @@ // implicitly marked as external. MCSymbol *Sym; if (LocalLabelVal == -1) { - if (ParsingInlineAsm && SI) { + if (ParsingMSInlineAsm && SI) { StringRef RewrittenLabel = SI->LookupInlineAsmLabel(IDVal, getSourceManager(), IDLoc, true); assert(!RewrittenLabel.empty() && @@ -1852,7 +1852,7 @@ getTargetParser().doBeforeLabelEmit(Sym); // Emit the label. - if (!getTargetParser().isParsingInlineAsm()) + if (!getTargetParser().isParsingMSInlineAsm()) Out.emitLabel(Sym, IDLoc); // If we are generating dwarf for assembly source files then gather the @@ -2193,15 +2193,15 @@ } // __asm _emit or __asm __emit - if (ParsingInlineAsm && (IDVal == "_emit" || IDVal == "__emit" || - IDVal == "_EMIT" || IDVal == "__EMIT")) + if (ParsingMSInlineAsm && (IDVal == "_emit" || IDVal == "__emit" || + IDVal == "_EMIT" || IDVal == "__EMIT")) return parseDirectiveMSEmit(IDLoc, Info, IDVal.size()); // __asm align - if (ParsingInlineAsm && (IDVal == "align" || IDVal == "ALIGN")) + if (ParsingMSInlineAsm && (IDVal == "align" || IDVal == "ALIGN")) return parseDirectiveMSAlign(IDLoc, Info); - if (ParsingInlineAsm && (IDVal == "even" || IDVal == "EVEN")) + if (ParsingMSInlineAsm && (IDVal == "even" || IDVal == "EVEN")) Info.AsmRewrites->emplace_back(AOK_EVEN, IDLoc, 4); if (checkForValidSection()) return true; @@ -2268,7 +2268,7 @@ uint64_t ErrorInfo; if (getTargetParser().MatchAndEmitInstruction( IDLoc, Info.Opcode, Info.ParsedOperands, Out, ErrorInfo, - getTargetParser().isParsingInlineAsm())) + getTargetParser().isParsingMSInlineAsm())) return true; } return false; diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp --- a/llvm/lib/MC/MCParser/MasmParser.cpp +++ b/llvm/lib/MC/MCParser/MasmParser.cpp @@ -182,7 +182,7 @@ bool IsDarwin = false; /// Are we parsing ms-style inline assembly? - bool ParsingInlineAsm = false; + bool ParsingMSInlineAsm = false; /// Did we already inform the user about inconsistent MD5 usage? bool ReportedInconsistentMD5 = false; @@ -237,13 +237,13 @@ const AsmToken &Lex() override; - void setParsingInlineAsm(bool V) override { - ParsingInlineAsm = V; + void setParsingMSInlineAsm(bool V) override { + ParsingMSInlineAsm = V; // When parsing MS inline asm, we must lex 0b1101 and 0ABCH as binary and // hex integer literals. Lexer.setLexMasmIntegers(V); } - bool isParsingInlineAsm() override { return ParsingInlineAsm; } + bool isParsingMSInlineAsm() override { return ParsingMSInlineAsm; } bool parseMSInlineAsm(void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, @@ -922,7 +922,7 @@ } bool MasmParser::checkForValidSection() { - if (!ParsingInlineAsm && !getStreamer().getCurrentSectionOnly()) { + if (!ParsingMSInlineAsm && !getStreamer().getCurrentSectionOnly()) { Out.InitSections(false); return Error(getTok().getLoc(), "expected section directive before assembly directive"); @@ -1606,7 +1606,7 @@ // implicitly marked as external. MCSymbol *Sym; if (LocalLabelVal == -1) { - if (ParsingInlineAsm && SI) { + if (ParsingMSInlineAsm && SI) { StringRef RewrittenLabel = SI->LookupInlineAsmLabel(IDVal, getSourceManager(), IDLoc, true); assert(!RewrittenLabel.empty() && @@ -1637,7 +1637,7 @@ getTargetParser().doBeforeLabelEmit(Sym); // Emit the label. - if (!getTargetParser().isParsingInlineAsm()) + if (!getTargetParser().isParsingMSInlineAsm()) Out.emitLabel(Sym, IDLoc); // If we are generating dwarf for assembly source files then gather the @@ -1946,15 +1946,15 @@ } // __asm _emit or __asm __emit - if (ParsingInlineAsm && (IDVal == "_emit" || IDVal == "__emit" || - IDVal == "_EMIT" || IDVal == "__EMIT")) + if (ParsingMSInlineAsm && (IDVal == "_emit" || IDVal == "__emit" || + IDVal == "_EMIT" || IDVal == "__EMIT")) return parseDirectiveMSEmit(IDLoc, Info, IDVal.size()); // __asm align - if (ParsingInlineAsm && (IDVal == "align" || IDVal == "ALIGN")) + if (ParsingMSInlineAsm && (IDVal == "align" || IDVal == "ALIGN")) return parseDirectiveMSAlign(IDLoc, Info); - if (ParsingInlineAsm && (IDVal == "even" || IDVal == "EVEN")) + if (ParsingMSInlineAsm && (IDVal == "even" || IDVal == "EVEN")) Info.AsmRewrites->emplace_back(AOK_EVEN, IDLoc, 4); if (checkForValidSection()) return true; @@ -2021,7 +2021,7 @@ uint64_t ErrorInfo; if (getTargetParser().MatchAndEmitInstruction( IDLoc, Info.Opcode, Info.ParsedOperands, Out, ErrorInfo, - getTargetParser().isParsingInlineAsm())) + getTargetParser().isParsingMSInlineAsm())) return true; } return false; diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -611,9 +611,9 @@ } bool onIdentifierExpr(const MCExpr *SymRef, StringRef SymRefName, const InlineAsmIdentifierInfo &IDInfo, - bool ParsingInlineAsm, StringRef &ErrMsg) { + bool ParsingMSInlineAsm, StringRef &ErrMsg) { // InlineAsm: Treat an enum value as an integer - if (ParsingInlineAsm) + if (ParsingMSInlineAsm) if (IDInfo.isKind(InlineAsmIdentifierInfo::IK_EnumVal)) return onInteger(IDInfo.Enum.EnumVal, ErrMsg); // Treat a symbolic constant like an integer @@ -634,7 +634,7 @@ MemExpr = true; State = IES_INTEGER; IC.pushOperand(IC_IMM); - if (ParsingInlineAsm) + if (ParsingMSInlineAsm) Info = IDInfo; break; } @@ -815,7 +815,7 @@ } } bool onOffset(const MCExpr *Val, SMLoc OffsetLoc, StringRef ID, - const InlineAsmIdentifierInfo &IDInfo, bool ParsingInlineAsm, + const InlineAsmIdentifierInfo &IDInfo, bool ParsingMSInlineAsm, StringRef &ErrMsg) { PrevState = State; switch (State) { @@ -833,7 +833,7 @@ // As we cannot yet resolve the actual value (offset), we retain // the requested semantics by pushing a '0' to the operands stack IC.pushOperand(IC_IMM); - if (ParsingInlineAsm) { + if (ParsingMSInlineAsm) { Info = IDInfo; } break; @@ -899,10 +899,10 @@ bool ParseIntelMemoryOperandSize(unsigned &Size); std::unique_ptr - CreateMemForInlineAsm(unsigned SegReg, const MCExpr *Disp, unsigned BaseReg, - unsigned IndexReg, unsigned Scale, SMLoc Start, - SMLoc End, unsigned Size, StringRef Identifier, - const InlineAsmIdentifierInfo &Info); + CreateMemForMSInlineAsm(unsigned SegReg, const MCExpr *Disp, unsigned BaseReg, + unsigned IndexReg, unsigned Scale, SMLoc Start, + SMLoc End, unsigned Size, StringRef Identifier, + const InlineAsmIdentifierInfo &Info); bool parseDirectiveEven(SMLoc L); bool ParseDirectiveCode(StringRef IDVal, SMLoc L); @@ -1177,7 +1177,7 @@ // The "flags" and "mxcsr" registers cannot be referenced directly. // Treat it as an identifier instead. - if (isParsingInlineAsm() && isParsingIntelSyntax() && + if (isParsingMSInlineAsm() && isParsingIntelSyntax() && (RegNo == X86::EFLAGS || RegNo == X86::MXCSR)) RegNo = 0; @@ -1458,7 +1458,7 @@ return ParseATTOperand(); } -std::unique_ptr X86AsmParser::CreateMemForInlineAsm( +std::unique_ptr X86AsmParser::CreateMemForMSInlineAsm( unsigned SegReg, const MCExpr *Disp, unsigned BaseReg, unsigned IndexReg, unsigned Scale, SMLoc Start, SMLoc End, unsigned Size, StringRef Identifier, const InlineAsmIdentifierInfo &Info) { @@ -1536,7 +1536,7 @@ return true; StringRef ErrMsg; ParseError = - SM.onOffset(Val, OffsetLoc, ID, Info, isParsingInlineAsm(), ErrMsg); + SM.onOffset(Val, OffsetLoc, ID, Info, isParsingMSInlineAsm(), ErrMsg); if (ParseError) return Error(SMLoc::getFromPointer(Name.data()), ErrMsg); } else { @@ -1595,7 +1595,7 @@ // Symbol reference, when parsing assembly content InlineAsmIdentifierInfo Info; const MCExpr *Val; - if (!isParsingInlineAsm()) { + if (!isParsingMSInlineAsm()) { if (getParser().parsePrimaryExpr(Val, End)) { return Error(Tok.getLoc(), "Unexpected identifier!"); } else if (SM.onIdentifierExpr(Val, Identifier, Info, false, ErrMsg)) { @@ -1646,8 +1646,8 @@ return Error(Loc, "invalid reference to undefined symbol"); StringRef Identifier = Sym->getName(); InlineAsmIdentifierInfo Info; - if (SM.onIdentifierExpr(Val, Identifier, Info, - isParsingInlineAsm(), ErrMsg)) + if (SM.onIdentifierExpr(Val, Identifier, Info, isParsingMSInlineAsm(), + ErrMsg)) return Error(Loc, ErrMsg); End = consumeToken(); } else { @@ -1741,7 +1741,7 @@ const MCExpr *&Val, StringRef &Identifier, InlineAsmIdentifierInfo &Info, bool IsUnevaluatedOperand, SMLoc &End, bool IsParsingOffsetOperator) { MCAsmParser &Parser = getParser(); - assert(isParsingInlineAsm() && "Expected to be parsing inline assembly."); + assert(isParsingMSInlineAsm() && "Expected to be parsing inline assembly."); Val = nullptr; StringRef LineBuf(Identifier.data()); @@ -1844,7 +1844,7 @@ APInt DotDisp; DotDispStr.getAsInteger(10, DotDisp); Offset = DotDisp.getZExtValue(); - } else if (isParsingInlineAsm() && Tok.is(AsmToken::Identifier)) { + } else if (isParsingMSInlineAsm() && Tok.is(AsmToken::Identifier)) { std::pair BaseMember = DotDispStr.split('.'); if (SemaCallback->LookupInlineAsmField(BaseMember.first, BaseMember.second, Offset)) @@ -1869,7 +1869,7 @@ // Eat offset, mark start of identifier. SMLoc Start = Lex().getLoc(); ID = getTok().getString(); - if (!isParsingInlineAsm()) { + if (!isParsingMSInlineAsm()) { if ((getTok().isNot(AsmToken::Identifier) && getTok().isNot(AsmToken::String)) || getParser().parsePrimaryExpr(Val, End)) @@ -1992,7 +1992,7 @@ if (ParseIntelExpression(SM, End)) return nullptr; - if (isParsingInlineAsm()) + if (isParsingMSInlineAsm()) RewriteIntelExpression(SM, Start, Tok.getLoc()); int64_t Imm = SM.getImm(); @@ -2006,7 +2006,7 @@ // RegNo != 0 specifies a valid segment register, // and we are parsing a segment override if (!SM.isMemExpr() && !RegNo) { - if (isParsingInlineAsm() && SM.isOffsetOperator()) { + if (isParsingMSInlineAsm() && SM.isOffsetOperator()) { const InlineAsmIdentifierInfo Info = SM.getIdentifierInfo(); if (Info.isKind(InlineAsmIdentifierInfo::IK_Var)) { // Disp includes the address of a variable; make sure this is recorded @@ -2058,10 +2058,10 @@ CheckBaseRegAndIndexRegAndScale(BaseReg, IndexReg, Scale, is64BitMode(), ErrMsg)) return ErrorOperand(Start, ErrMsg); - if (isParsingInlineAsm()) - return CreateMemForInlineAsm(RegNo, Disp, BaseReg, IndexReg, - Scale, Start, End, Size, SM.getSymName(), - SM.getIdentifierInfo()); + if (isParsingMSInlineAsm()) + return CreateMemForMSInlineAsm(RegNo, Disp, BaseReg, IndexReg, Scale, Start, + End, Size, SM.getSymName(), + SM.getIdentifierInfo()); if (!(BaseReg || IndexReg || RegNo)) return X86Operand::CreateMem(getPointerWidth(), Disp, Start, End, Size); return X86Operand::CreateMem(getPointerWidth(), RegNo, Disp, @@ -2764,7 +2764,7 @@ // In MS inline asm curly braces mark the beginning/end of a block, // therefore they should be interepreted as end of statement CurlyAsEndOfStatement = - isParsingIntelSyntax() && isParsingInlineAsm() && + isParsingIntelSyntax() && isParsingMSInlineAsm() && (getLexer().is(AsmToken::LCurly) || getLexer().is(AsmToken::RCurly)); if (getLexer().isNot(AsmToken::EndOfStatement) && !CurlyAsEndOfStatement) return TokError("unexpected token in argument list");