diff options
| author | Anton Korobeynikov <anton@korobeynikov.info> | 2019-01-16 13:44:01 +0000 |
|---|---|---|
| committer | Anton Korobeynikov <anton@korobeynikov.info> | 2019-01-16 13:44:01 +0000 |
| commit | 383e8271212bfabb824161c9c30e22afa07d44e2 (patch) | |
| tree | 90d10cefb46f4c1bd5312529cfc2af526ffd2275 /clang/test | |
| parent | b6cee6ceb61056bc26e9e96f6e9001c41aa644ea (diff) | |
| download | bcm5719-llvm-383e8271212bfabb824161c9c30e22afa07d44e2.tar.gz bcm5719-llvm-383e8271212bfabb824161c9c30e22afa07d44e2.zip | |
[MSP430] Improve support of 'interrupt' attribute
* Accept as an argument constants in range 0..63 (aligned with TI headers and linker scripts provided with TI GCC toolchain).
* Emit function attribute 'interrupt'='xx' instead of aliases (used in the backend to create a section for particular interrupt vector).
* Add more diagnostics.
Patch by Kristina Bessonova!
Differential Revision: https://reviews.llvm.org/D56663
llvm-svn: 351344
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGen/attr-msp430.c | 10 | ||||
| -rw-r--r-- | clang/test/Sema/attr-msp430.c | 11 |
2 files changed, 19 insertions, 2 deletions
diff --git a/clang/test/CodeGen/attr-msp430.c b/clang/test/CodeGen/attr-msp430.c new file mode 100644 index 00000000000..e8b6d0d0fa3 --- /dev/null +++ b/clang/test/CodeGen/attr-msp430.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple msp430-unknown-unknown -emit-llvm < %s| FileCheck %s + +__attribute__((interrupt(1))) void foo(void) {} +// CHECK: @llvm.used +// CHECK-SAME: @foo + +// CHECK: define msp430_intrcc void @foo() #0 +// CHECK: attributes #0 +// CHECK-SAME: noinline +// CHECK-SAME: "interrupt"="1" diff --git a/clang/test/Sema/attr-msp430.c b/clang/test/Sema/attr-msp430.c index 26b2d8fcfd6..4b38d09b867 100644 --- a/clang/test/Sema/attr-msp430.c +++ b/clang/test/Sema/attr-msp430.c @@ -1,6 +1,13 @@ // RUN: %clang_cc1 -triple msp430-unknown-unknown -fsyntax-only -verify %s +__attribute__((interrupt(1))) int t; // expected-warning {{'interrupt' attribute only applies to functions}} + int i; -void f(void) __attribute__((interrupt(i))); /* expected-error {{'interrupt' attribute requires an integer constant}} */ +__attribute__((interrupt(i))) void f(void); // expected-error {{'interrupt' attribute requires an integer constant}} +__attribute__((interrupt(1, 2))) void f2(void); // expected-error {{'interrupt' attribute takes one argument}} +__attribute__((interrupt(1))) int f3(void); // expected-warning {{MSP430 'interrupt' attribute only applies to functions that have a 'void' return type}} +__attribute__((interrupt(1))) void f4(int a); // expected-warning {{MSP430 'interrupt' attribute only applies to functions that have no parameters}} +__attribute__((interrupt(64))) void f5(void); // expected-error {{'interrupt' attribute parameter 64 is out of bounds}} -void f2(void) __attribute__((interrupt(12))); +__attribute__((interrupt(0))) void f6(void); +__attribute__((interrupt(63))) void f7(void); |

