summaryrefslogtreecommitdiff
path: root/lib/MC/MCParser
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2013-12-28 05:54:33 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2013-12-28 05:54:33 +0000
commitb5191e98e883fe804c400cc5187fe54d41a808e0 (patch)
treecc66ec93a9c9ab10707a7afc20b03cc02fcc3170 /lib/MC/MCParser
parentb28743fd1654853004017bc3237fd1ba88d60a2b (diff)
downloadllvm-b5191e98e883fe804c400cc5187fe54d41a808e0.tar.gz
llvm-b5191e98e883fe804c400cc5187fe54d41a808e0.tar.bz2
llvm-b5191e98e883fe804c400cc5187fe54d41a808e0.tar.xz
IAS: support .rep as an alias for .rept
The GNU assembler supports .rep as an alias for .rept. This simply creates the alias for it and introduces a test for both .rept and .rep. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198097 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 5de10a7ba3..b4c5f50a99 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -453,7 +453,7 @@ private:
MCAsmMacro *parseMacroLikeBody(SMLoc DirectiveLoc);
void instantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc,
raw_svector_ostream &OS);
- bool parseDirectiveRept(SMLoc DirectiveLoc); // ".rept"
+ bool parseDirectiveRept(SMLoc DirectiveLoc, StringRef Directive);
bool parseDirectiveIrp(SMLoc DirectiveLoc); // ".irp"
bool parseDirectiveIrpc(SMLoc DirectiveLoc); // ".irpc"
bool parseDirectiveEndr(SMLoc DirectiveLoc); // ".endr"
@@ -1438,7 +1438,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info) {
case DK_CODE16GCC:
return TokError(Twine(IDVal) + " not supported yet");
case DK_REPT:
- return parseDirectiveRept(IDLoc);
+ return parseDirectiveRept(IDLoc, IDVal);
case DK_IRP:
return parseDirectiveIrp(IDLoc);
case DK_IRPC:
@@ -3836,6 +3836,7 @@ void AsmParser::initializeDirectiveKindMap() {
DirectiveKindMap[".code16"] = DK_CODE16;
DirectiveKindMap[".code16gcc"] = DK_CODE16GCC;
DirectiveKindMap[".rept"] = DK_REPT;
+ DirectiveKindMap[".rep"] = DK_REPT;
DirectiveKindMap[".irp"] = DK_IRP;
DirectiveKindMap[".irpc"] = DK_IRPC;
DirectiveKindMap[".endr"] = DK_ENDR;
@@ -3954,16 +3955,18 @@ void AsmParser::instantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc,
Lex();
}
-bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc) {
+/// parseDirectiveRept
+/// ::= .rep | .rept count
+bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc, StringRef Dir) {
int64_t Count;
if (parseAbsoluteExpression(Count))
- return TokError("unexpected token in '.rept' directive");
+ return TokError("unexpected token in '" + Dir + "' directive");
if (Count < 0)
return TokError("Count is negative");
if (Lexer.isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in '.rept' directive");
+ return TokError("unexpected token in '" + Dir + "' directive");
// Eat the end of statement.
Lex();