diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-10-13 00:26:04 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-10-13 00:26:04 +0000 |
commit | 4996355592ddbb7c1dd513c68d09f40418667684 (patch) | |
tree | a1f26f55e22ae62d7ceeaf8a827a2798444da0df /llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | eaafa732dfb80ea4153e7539481a92bf2be697a8 (diff) | |
download | bcm5719-llvm-4996355592ddbb7c1dd513c68d09f40418667684.tar.gz bcm5719-llvm-4996355592ddbb7c1dd513c68d09f40418667684.zip |
[ms-inline asm] Remove the MatchInstruction() function. Previously, this was
the interface between the front-end and the MC layer when parsing inline
assembly. Unfortunately, this is too deep into the parsing stack. Specifically,
we're unable to handle target-independent assembly (i.e., assembly directives,
labels, etc.). Note the MatchAndEmitInstruction() isn't the correct
abstraction either. I'll be exposing target-independent hooks shortly, so this
is really just a cleanup.
llvm-svn: 165858
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index c2fff3c5207..8bf017a1a0a 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -133,6 +133,9 @@ private: /// IsDarwin - is Darwin compatibility enabled? bool IsDarwin; + /// ParsingInlineAsm - are we parsing ms-style inline assembly? + bool ParsingInlineAsm; + public: AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out, const MCAsmInfo &MAI); @@ -171,6 +174,8 @@ public: virtual const AsmToken &Lex(); + void setParsingInlineAsm(bool V) { ParsingInlineAsm = V; } + bool ParseExpression(const MCExpr *&Res); virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc); virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc); @@ -412,7 +417,7 @@ AsmParser::AsmParser(SourceMgr &_SM, MCContext &_Ctx, : Lexer(_MAI), Ctx(_Ctx), Out(_Out), MAI(_MAI), SrcMgr(_SM), GenericParser(new GenericAsmParser), PlatformParser(0), CurBuffer(0), MacrosEnabled(true), CppHashLineNumber(0), - AssemblerDialect(~0U), IsDarwin(false) { + AssemblerDialect(~0U), IsDarwin(false), ParsingInlineAsm(false) { // Save the old handler. SavedDiagHandler = SrcMgr.getDiagHandler(); SavedDiagContext = SrcMgr.getDiagContext(); @@ -604,7 +609,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { } void AsmParser::CheckForValidSection() { - if (!getStreamer().getCurrentSection()) { + if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.SwitchSection(Ctx.getMachOSection( "__TEXT", "__text", @@ -1346,9 +1351,14 @@ bool AsmParser::ParseStatement() { } // If parsing succeeded, match the instruction. - if (!HadError) - HadError = getTargetParser().MatchAndEmitInstruction(IDLoc, ParsedOperands, - Out); + if (!HadError) { + unsigned Opcode; + unsigned ErrorInfo; + HadError = getTargetParser().MatchAndEmitInstruction(IDLoc, Opcode, + ParsedOperands, + Out, ErrorInfo, + ParsingInlineAsm); + } // Free any parsed operands. for (unsigned i = 0, e = ParsedOperands.size(); i != e; ++i) |