[PATCH] D17707: AsmParser: Fix nested .irp/.irpc
Nikolay Haustov via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 29 01:46:50 PST 2016
nhaustov created this revision.
nhaustov added a reviewer: rafael.
nhaustov added a subscriber: llvm-commits.
Count .irp/.irpc in parseMacroLikeBody similar to .rept
Update tests.
http://reviews.llvm.org/D17707
Files:
lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/macro-irp.s
test/MC/AsmParser/macro-irpc.s
Index: test/MC/AsmParser/macro-irpc.s
===================================================================
--- test/MC/AsmParser/macro-irpc.s
+++ test/MC/AsmParser/macro-irpc.s
@@ -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
Index: test/MC/AsmParser/macro-irp.s
===================================================================
--- test/MC/AsmParser/macro-irp.s
+++ test/MC/AsmParser/macro-irp.s
@@ -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
Index: lib/MC/MCParser/AsmParser.cpp
===================================================================
--- lib/MC/MCParser/AsmParser.cpp
+++ lib/MC/MCParser/AsmParser.cpp
@@ -4707,7 +4707,9 @@
}
if (Lexer.is(AsmToken::Identifier) &&
- (getTok().getIdentifier() == ".rept")) {
+ (getTok().getIdentifier() == ".rept" ||
+ getTok().getIdentifier() == ".irp" ||
+ getTok().getIdentifier() == ".irpc")) {
++NestLevel;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17707.49346.patch
Type: text/x-patch
Size: 1405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160229/64ac57fc/attachment.bin>
More information about the llvm-commits
mailing list