llvm.org GIT mirror llvm / 2a78a0c
Enable Darwin vararg parameters support in assembler macros. Duplicate the vararg tests for linux and add a tests which mixed vararg arguments with darwin positional parameters. Patch by: Janne Grunau <j@jannau.net> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214799 91177308-0d34-0410-b5e6-96231b3b80d8 Kevin Enderby 6 years ago
2 changed file(s) with 88 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
33013301
33023302 if (Qualifier == "req")
33033303 Parameter.Required = true;
3304 else if (Qualifier == "vararg" && !IsDarwin)
3304 else if (Qualifier == "vararg")
33053305 Parameter.Vararg = true;
33063306 else
33073307 return Error(QualLoc, Qualifier + " is not a valid parameter qualifier "
None // RUN: not llvm-mc -triple i386-apple-darwin10 %s 2>&1 | FileCheck %s
0 // RUN: llvm-mc -triple i386-apple-darwin10 %s 2>&1 | FileCheck %s
11
2 // CHECK: error: vararg is not a valid parameter qualifier for 'arg' in macro 'abc'
3 // CHECK: .macro abc arg:vararg
2 .macro abc a b:vararg
3 .globl "\a, \b"
4 .endm
45
5 .macro abc arg:vararg
6 \arg
6 // CHECK: .globl "zed0, zed1, zed2"
7 abc zed0, zed1, zed2
8
9 .purgem abc
10
11 .macro ifcc arg:vararg
12 .if cc
13 \arg
14 .endif
715 .endm
16
17 .macro ifcc2 arg0 arg1:vararg
18 .if cc
19 movl \arg0, \arg1
20 .endif
21 .endm
22
23 .macro ifcc3 arg0, arg1:vararg
24 .if cc
25 movl \arg0, \arg1
26 .endif
27 .endm
28
29 .macro ifcc4 arg0, arg1:vararg
30 .if cc
31 movl \arg1, \arg0
32 .endif
33 .endm
34
35 .text
36
37 // CHECK: movl %esp, %ebp
38 // CHECK: subl $0, %esp
39 // CHECK: movl %eax, %ebx
40 // CHECK: movl %ecx, %ebx
41 // CHECK: movl %ecx, %eax
42 // CHECK: movl %eax, %ecx
43 // CHECK: movl %ecx, %eax
44 // CHECK: movl %eax, %ecx
45 .set cc,1
46 ifcc movl %esp, %ebp
47 subl $0, %esp
48
49 ifcc2 %eax, %ebx
50 ifcc2 %ecx, %ebx
51 ifcc3 %ecx, %eax
52 ifcc3 %eax, %ecx
53 ifcc4 %eax, %ecx ## test
54 ifcc4 %ecx, %eax ## test
55
56 // CHECK-NOT movl
57 // CHECK: subl $1, %esp
58 .set cc,0
59 ifcc movl, %esp, %ebp
60 subl $1, %esp
61
62 .macro abc arg:vararg=nop
63 \arg
64 .endm
65
66 .macro abcd arg0=%eax, arg1:vararg=%ebx
67 movl \arg0, \arg1
68 .endm
69
70 .text
71
72 // CHECK: nop
73 abc
74 // CHECK: movl %eax, %ebx
75 abcd ,
76
77 .macro .make_macro start, end, name, body:vararg
78 \start \name
79 \body
80 \end
81 .endmacro
82
83 .make_macro .macro,.endmacro,.mybyte,.byte $0, $2, $1
84
85 .data
86 // CHECK: .byte 10
87 // CHECK: .byte 12
88 // CHECK: .byte 11
89 .mybyte 10,11,12