]>
git.proxmox.com Git - rustc.git/blob - src/test/codegen/naked-functions.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-tidy-linelength
13 // compile-flags: -C no-prepopulate-passes
15 #![crate_type = "lib"]
16 #![feature(naked_functions)]
18 // CHECK: Function Attrs: naked uwtable
19 // CHECK-NEXT: define internal void @naked_empty()
26 // CHECK: Function Attrs: naked uwtable
29 // CHECK-NEXT: define internal void @naked_with_args(i{{[0-9]+}})
30 fn naked_with_args(a
: isize) {
31 // CHECK: %a = alloca i{{[0-9]+}}
35 // CHECK: Function Attrs: naked uwtable
36 // CHECK-NEXT: define internal i{{[0-9]+}} @naked_with_return()
39 fn naked_with_return() -> isize {
40 // CHECK: ret i{{[0-9]+}} 0
44 // CHECK: Function Attrs: naked uwtable
45 // CHECK-NEXT: define internal i{{[0-9]+}} @naked_with_args_and_return(i{{[0-9]+}})
48 fn naked_with_args_and_return(a
: isize) -> isize {
49 // CHECK: %a = alloca i{{[0-9]+}}
50 // CHECK: ret i{{[0-9]+}} %{{[0-9]+}}
54 // CHECK: Function Attrs: naked uwtable
55 // CHECK-NEXT: define internal void @naked_recursive()
58 fn naked_recursive() {
59 // CHECK: call void @naked_empty()
61 // CHECK: %{{[0-9]+}} = call i{{[0-9]+}} @naked_with_return()
63 // CHECK: %{{[0-9]+}} = call i{{[0-9]+}} @naked_with_args_and_return(i{{[0-9]+}} %{{[0-9]+}})
64 naked_with_args_and_return(
65 // CHECK: call void @naked_with_args(i{{[0-9]+}} %{{[0-9]+}})