aboutsummaryrefslogtreecommitdiff
path: root/test/MC
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-10-10 01:26:25 +0000
committerReid Kleckner <rnk@google.com>2017-10-10 01:26:25 +0000
commitbe1ef6a68c7295e1443899e29a24ed0ce2995470 (patch)
tree63424abd7f3a7d396f5cd4812070e88a40b0d958 /test/MC
parent4010882fb4546354a7000ee778d3a5eec2f42ff5 (diff)
downloadllvm-be1ef6a68c7295e1443899e29a24ed0ce2995470.tar.gz
[SEH] Use reportError instead of report_fatal_error for bad directives
This makes the .seh_ directives slightly more usable from standalone assembly files. This removes a large number of report_fatal_errors and recovers from the error by ignoring the directive. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC')
-rw-r--r--test/MC/AsmParser/seh-directive-errors.s96
-rw-r--r--test/MC/COFF/seh-stackalloc-zero.s3
2 files changed, 97 insertions, 2 deletions
diff --git a/test/MC/AsmParser/seh-directive-errors.s b/test/MC/AsmParser/seh-directive-errors.s
new file mode 100644
index 00000000000..5fa6c7846e7
--- /dev/null
+++ b/test/MC/AsmParser/seh-directive-errors.s
@@ -0,0 +1,96 @@
+# RUN: not llvm-mc %s -filetype=obj -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
+ .text
+
+ .seh_pushreg 6
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame
+
+ .seh_stackalloc 32
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame
+
+ .def f;
+ .scl 2;
+ .type 32;
+ .endef
+ .globl f # -- Begin function f
+ .p2align 4, 0x90
+f: # @f
+.seh_proc f
+ pushq %rsi
+ .seh_pushreg 6
+ pushq %rdi
+ .seh_pushreg 7
+ pushq %rbx
+ .seh_pushreg 3
+ subq $32, %rsp
+ .seh_stackalloc 0
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: stack allocation size must be non-zero
+ .seh_stackalloc 7
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: stack allocation size is not a multiple of 8
+ .seh_stackalloc 32
+ .seh_endprologue
+ nop
+ addq $32, %rsp
+ popq %rbx
+ popq %rdi
+ popq %rsi
+ retq
+ .seh_handlerdata
+ .text
+ .seh_endproc
+
+
+ .seh_pushreg 6
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame
+
+g:
+ .seh_proc g
+ pushq %rbp
+ .seh_pushreg 3
+ pushq %rsi
+ .seh_pushreg 6
+ .seh_endprologue
+ .seh_setframe 3 255
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: you must specify a stack pointer offset
+ .seh_setframe 3, 255
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: offset is not a multiple of 16
+ .seh_setframe 3, 256
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: frame offset must be less than or equal to 240
+ .seh_setframe 3, 128
+ .seh_setframe 3, 128
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: frame register and offset can be set at most once
+ nop
+ popq %rsi
+ popq %rbp
+ retq
+ .seh_endproc
+
+ .globl h # -- Begin function h
+ .p2align 4, 0x90
+h: # @h
+.seh_proc h
+# BB#0: # %entry
+ subq $72, %rsp
+ .seh_stackalloc 72
+ movaps %xmm7, 48(%rsp) # 16-byte Spill
+ .seh_savexmm 7 44
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: you must specify an offset on the stack
+ .seh_savexmm 7, 44
+ # CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: offset is not a multiple of 16
+ .seh_savexmm 7, 48
+ movaps %xmm6, 32(%rsp) # 16-byte Spill
+ .seh_savexmm 6, 32
+ .seh_endprologue
+ movapd %xmm0, %xmm6
+ callq getdbl
+ movapd %xmm0, %xmm7
+ addsd %xmm6, %xmm7
+ callq getdbl
+ addsd %xmm7, %xmm0
+ movaps 32(%rsp), %xmm6 # 16-byte Reload
+ movaps 48(%rsp), %xmm7 # 16-byte Reload
+ addq $72, %rsp
+ retq
+ .seh_handlerdata
+ .text
+ .seh_endproc
+ # -- End function
diff --git a/test/MC/COFF/seh-stackalloc-zero.s b/test/MC/COFF/seh-stackalloc-zero.s
index 898ac844417..c03af42131b 100644
--- a/test/MC/COFF/seh-stackalloc-zero.s
+++ b/test/MC/COFF/seh-stackalloc-zero.s
@@ -1,11 +1,10 @@
// RUN: not llvm-mc -triple x86_64-pc-win32 -filetype=obj %s -o %t.o 2>&1 | FileCheck %s
-// CHECK: Allocation size must be non-zero!
-
.globl smallFunc
.def smallFunc; .scl 2; .type 32; .endef
.seh_proc smallFunc
.seh_stackalloc 0
+// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: stack allocation size must be non-zero
smallFunc:
ret
.seh_endproc