Eli Friedman | 2873aee | 2011-08-22 23:55:33 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s |
Daniel Dunbar | dd0cb22 | 2010-09-29 18:20:25 +0000 | [diff] [blame] | 2 | |
| 3 | void t1() __attribute__((naked)); |
| 4 | |
Eli Friedman | 2873aee | 2011-08-22 23:55:33 +0000 | [diff] [blame] | 5 | // Basic functionality check |
| 6 | // (Note that naked needs to imply noinline to work properly.) |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame] | 7 | // CHECK: define void @t1() [[NAKED:#[0-9]+]] { |
Daniel Dunbar | dd0cb22 | 2010-09-29 18:20:25 +0000 | [diff] [blame] | 8 | void t1() |
| 9 | { |
| 10 | } |
| 11 | |
Eli Friedman | 2873aee | 2011-08-22 23:55:33 +0000 | [diff] [blame] | 12 | // Make sure this doesn't explode in the verifier. |
| 13 | // (It doesn't really make sense, but it isn't invalid.) |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame] | 14 | // CHECK: define void @t2() [[NAKED]] { |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 15 | __attribute((naked, always_inline)) void t2() { |
| 16 | } |
| 17 | |
| 18 | // Make sure not to generate prolog or epilog for naked functions. |
| 19 | __attribute((naked)) void t3(int x) { |
| 20 | // CHECK: define void @t3(i32) |
| 21 | // CHECK-NOT: alloca |
| 22 | // CHECK-NOT: store |
| 23 | // CHECK: unreachable |
Eli Friedman | 2873aee | 2011-08-22 23:55:33 +0000 | [diff] [blame] | 24 | } |
Bill Wendling | f7a9da0 | 2013-02-20 07:22:19 +0000 | [diff] [blame] | 25 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame] | 26 | // CHECK: attributes [[NAKED]] = { naked noinline nounwind{{.*}} } |