diff options
author | Coby Tayree <coby.tayree@intel.com> | 2017-10-02 14:36:31 +0000 |
---|---|---|
committer | Coby Tayree <coby.tayree@intel.com> | 2017-10-02 14:36:31 +0000 |
commit | 01e5320c484ae87b524e1942c0f668397a4ef606 (patch) | |
tree | d7339e6e2f06d0f7c52abbabcffcf4c703f5f09c /llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | 5dadb79fcda0b98aeff0411ed0e51a2957056f96 (diff) | |
download | bcm5719-llvm-01e5320c484ae87b524e1942c0f668397a4ef606.tar.gz bcm5719-llvm-01e5320c484ae87b524e1942c0f668397a4ef606.zip |
[AsmParser] Support GAS's .print directive
Differential Revision: https://reviews.llvm.org/D38448
llvm-svn: 314674
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 16c6d562a2b..9568394a364 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -538,6 +538,7 @@ private: DK_ERR, DK_ERROR, DK_WARNING, + DK_PRINT, DK_END }; @@ -682,6 +683,9 @@ private: // ".warning" bool parseDirectiveWarning(SMLoc DirectiveLoc); + // .print <double-quotes-string> + bool parseDirectivePrint(SMLoc DirectiveLoc); + void initializeDirectiveKindMap(); }; @@ -2130,6 +2134,8 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info, case DK_DS_P: case DK_DS_X: return parseDirectiveDS(IDVal, 12); + case DK_PRINT: + return parseDirectivePrint(IDLoc); } return Error(IDLoc, "unknown directive"); @@ -5228,6 +5234,7 @@ void AsmParser::initializeDirectiveKindMap() { DirectiveKindMap[".ds.s"] = DK_DS_S; DirectiveKindMap[".ds.w"] = DK_DS_W; DirectiveKindMap[".ds.x"] = DK_DS_X; + DirectiveKindMap[".print"] = DK_PRINT; } MCAsmMacro *AsmParser::parseMacroLikeBody(SMLoc DirectiveLoc) { @@ -5456,6 +5463,17 @@ bool AsmParser::parseDirectiveMSAlign(SMLoc IDLoc, ParseStatementInfo &Info) { return false; } +bool AsmParser::parseDirectivePrint(SMLoc DirectiveLoc) { + const AsmToken StrTok = getTok(); + Lex(); + if (StrTok.isNot(AsmToken::String) || StrTok.getString().front() != '"') + return Error(DirectiveLoc, "expected double quoted string after .print"); + if (parseToken(AsmToken::EndOfStatement, "expected end of statement")) + return true; + llvm::outs() << StrTok.getStringContents() << '\n'; + return false; +} + // We are comparing pointers, but the pointers are relative to a single string. // Thus, this should always be deterministic. static int rewritesSort(const AsmRewrite *AsmRewriteA, |