mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
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
This commit is contained in:
@@ -453,7 +453,7 @@ private:
|
|||||||
MCAsmMacro *parseMacroLikeBody(SMLoc DirectiveLoc);
|
MCAsmMacro *parseMacroLikeBody(SMLoc DirectiveLoc);
|
||||||
void instantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc,
|
void instantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc,
|
||||||
raw_svector_ostream &OS);
|
raw_svector_ostream &OS);
|
||||||
bool parseDirectiveRept(SMLoc DirectiveLoc); // ".rept"
|
bool parseDirectiveRept(SMLoc DirectiveLoc, StringRef Directive);
|
||||||
bool parseDirectiveIrp(SMLoc DirectiveLoc); // ".irp"
|
bool parseDirectiveIrp(SMLoc DirectiveLoc); // ".irp"
|
||||||
bool parseDirectiveIrpc(SMLoc DirectiveLoc); // ".irpc"
|
bool parseDirectiveIrpc(SMLoc DirectiveLoc); // ".irpc"
|
||||||
bool parseDirectiveEndr(SMLoc DirectiveLoc); // ".endr"
|
bool parseDirectiveEndr(SMLoc DirectiveLoc); // ".endr"
|
||||||
@@ -1438,7 +1438,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info) {
|
|||||||
case DK_CODE16GCC:
|
case DK_CODE16GCC:
|
||||||
return TokError(Twine(IDVal) + " not supported yet");
|
return TokError(Twine(IDVal) + " not supported yet");
|
||||||
case DK_REPT:
|
case DK_REPT:
|
||||||
return parseDirectiveRept(IDLoc);
|
return parseDirectiveRept(IDLoc, IDVal);
|
||||||
case DK_IRP:
|
case DK_IRP:
|
||||||
return parseDirectiveIrp(IDLoc);
|
return parseDirectiveIrp(IDLoc);
|
||||||
case DK_IRPC:
|
case DK_IRPC:
|
||||||
@@ -3836,6 +3836,7 @@ void AsmParser::initializeDirectiveKindMap() {
|
|||||||
DirectiveKindMap[".code16"] = DK_CODE16;
|
DirectiveKindMap[".code16"] = DK_CODE16;
|
||||||
DirectiveKindMap[".code16gcc"] = DK_CODE16GCC;
|
DirectiveKindMap[".code16gcc"] = DK_CODE16GCC;
|
||||||
DirectiveKindMap[".rept"] = DK_REPT;
|
DirectiveKindMap[".rept"] = DK_REPT;
|
||||||
|
DirectiveKindMap[".rep"] = DK_REPT;
|
||||||
DirectiveKindMap[".irp"] = DK_IRP;
|
DirectiveKindMap[".irp"] = DK_IRP;
|
||||||
DirectiveKindMap[".irpc"] = DK_IRPC;
|
DirectiveKindMap[".irpc"] = DK_IRPC;
|
||||||
DirectiveKindMap[".endr"] = DK_ENDR;
|
DirectiveKindMap[".endr"] = DK_ENDR;
|
||||||
@@ -3954,16 +3955,18 @@ void AsmParser::instantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc,
|
|||||||
Lex();
|
Lex();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc) {
|
/// parseDirectiveRept
|
||||||
|
/// ::= .rep | .rept count
|
||||||
|
bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc, StringRef Dir) {
|
||||||
int64_t Count;
|
int64_t Count;
|
||||||
if (parseAbsoluteExpression(Count))
|
if (parseAbsoluteExpression(Count))
|
||||||
return TokError("unexpected token in '.rept' directive");
|
return TokError("unexpected token in '" + Dir + "' directive");
|
||||||
|
|
||||||
if (Count < 0)
|
if (Count < 0)
|
||||||
return TokError("Count is negative");
|
return TokError("Count is negative");
|
||||||
|
|
||||||
if (Lexer.isNot(AsmToken::EndOfStatement))
|
if (Lexer.isNot(AsmToken::EndOfStatement))
|
||||||
return TokError("unexpected token in '.rept' directive");
|
return TokError("unexpected token in '" + Dir + "' directive");
|
||||||
|
|
||||||
// Eat the end of statement.
|
// Eat the end of statement.
|
||||||
Lex();
|
Lex();
|
||||||
|
30
test/MC/AsmParser/directive_rept.s
Normal file
30
test/MC/AsmParser/directive_rept.s
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# RUN: llvm-mc -triple i686-elf -filetype asm -o - %s | FileCheck %s
|
||||||
|
|
||||||
|
.data
|
||||||
|
|
||||||
|
.global two_bad_calls
|
||||||
|
.type two_bad_calls,@function
|
||||||
|
two_bad_calls:
|
||||||
|
.rept 2
|
||||||
|
.long 0xbadca11
|
||||||
|
.endr
|
||||||
|
|
||||||
|
# CHECK-LABEL: two_bad_calls
|
||||||
|
# CHECK: .long 195938833
|
||||||
|
# CHECK: .long 195938833
|
||||||
|
|
||||||
|
.global half_a_dozen_daffodils
|
||||||
|
.type half_a_dozen_daffodils,@function
|
||||||
|
half_a_dozen_daffodils:
|
||||||
|
.rep 6
|
||||||
|
.long 0xdaff0d11
|
||||||
|
.endr
|
||||||
|
|
||||||
|
# CHECK-LABEL: half_a_dozen_daffodils
|
||||||
|
# CHECK: .long 3674148113
|
||||||
|
# CHECK: .long 3674148113
|
||||||
|
# CHECK: .long 3674148113
|
||||||
|
# CHECK: .long 3674148113
|
||||||
|
# CHECK: .long 3674148113
|
||||||
|
# CHECK: .long 3674148113
|
||||||
|
|
Reference in New Issue
Block a user