diff options
author | Roman Divacky <rdivacky@freebsd.org> | 2013-09-24 17:44:41 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@freebsd.org> | 2013-09-24 17:44:41 +0000 |
commit | e33098f5cbd580a4f93bb02e516eacf8dfb14c3e (patch) | |
tree | 08cba13aae60603d7b30af960f1e959d6b8198d1 /llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | a32150c3c777a356ef5545fd3ce27ba525ff2ff1 (diff) | |
download | bcm5719-llvm-e33098f5cbd580a4f93bb02e516eacf8dfb14c3e.tar.gz bcm5719-llvm-e33098f5cbd580a4f93bb02e516eacf8dfb14c3e.zip |
Make the size and expr arguments of .fill directive optional.
llvm-svn: 191318
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index c1f825ae785..1267dc814cd 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -2353,7 +2353,7 @@ bool AsmParser::parseDirectiveZero() { } /// parseDirectiveFill -/// ::= .fill expression , expression , expression +/// ::= .fill expression [ , expression [ , expression ] ] bool AsmParser::parseDirectiveFill() { checkForValidSection(); @@ -2361,26 +2361,31 @@ bool AsmParser::parseDirectiveFill() { if (parseAbsoluteExpression(NumValues)) return true; - if (getLexer().isNot(AsmToken::Comma)) - return TokError("unexpected token in '.fill' directive"); - Lex(); + int64_t FillSize = 1; + int64_t FillExpr = 0; - int64_t FillSize; - if (parseAbsoluteExpression(FillSize)) - return true; + if (getLexer().isNot(AsmToken::EndOfStatement)) { + if (getLexer().isNot(AsmToken::Comma)) + return TokError("unexpected token in '.fill' directive"); + Lex(); - if (getLexer().isNot(AsmToken::Comma)) - return TokError("unexpected token in '.fill' directive"); - Lex(); + if (parseAbsoluteExpression(FillSize)) + return true; - int64_t FillExpr; - if (parseAbsoluteExpression(FillExpr)) - return true; + if (getLexer().isNot(AsmToken::EndOfStatement)) { + if (getLexer().isNot(AsmToken::Comma)) + return TokError("unexpected token in '.fill' directive"); + Lex(); - if (getLexer().isNot(AsmToken::EndOfStatement)) - return TokError("unexpected token in '.fill' directive"); + if (parseAbsoluteExpression(FillExpr)) + return true; - Lex(); + if (getLexer().isNot(AsmToken::EndOfStatement)) + return TokError("unexpected token in '.fill' directive"); + + Lex(); + } + } if (FillSize != 1 && FillSize != 2 && FillSize != 4 && FillSize != 8) return TokError("invalid '.fill' size, expected 1, 2, 4, or 8"); |