1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

AsmParser: Fix nested .irp/.irpc

Count .irp/.irpc in parseMacroLikeBody similar to .rept
Update tests.

Review: http://reviews.llvm.org/D17707
llvm-svn: 262313
This commit is contained in:
Nikolay Haustov 2016-03-01 08:18:28 +00:00
parent ec7d7b8389
commit dd568e520a
3 changed files with 29 additions and 1 deletions

View File

@ -4707,7 +4707,9 @@ MCAsmMacro *AsmParser::parseMacroLikeBody(SMLoc DirectiveLoc) {
}
if (Lexer.is(AsmToken::Identifier) &&
(getTok().getIdentifier() == ".rept")) {
(getTok().getIdentifier() == ".rept" ||
getTok().getIdentifier() == ".irp" ||
getTok().getIdentifier() == ".irpc")) {
++NestLevel;
}

View File

@ -6,3 +6,16 @@
// CHECK: pushl %eax
// CHECK: pushl %ebx
.irp reg,%eax,%ebx
.irp imm,4,3,5
addl \reg, \imm
.endr
.endr
// CHECK: addl %eax, 4
// CHECK: addl %eax, 3
// CHECK: addl %eax, 5
// CHECK: addl %ebx, 4
// CHECK: addl %ebx, 3
// CHECK: addl %ebx, 5

View File

@ -7,3 +7,16 @@
// CHECK: long 1
// CHECK: long 2
// CHECK: long 3
.irpc foo,123
.irpc bar,45
addl %eax, \foo\bar
.endr
.endr
// CHECK: addl %eax, 14
// CHECK: addl %eax, 15
// CHECK: addl %eax, 24
// CHECK: addl %eax, 25
// CHECK: addl %eax, 34
// CHECK: addl %eax, 35