-
Notifications
You must be signed in to change notification settings - Fork 32
/
liveness-asm.rs
72 lines (60 loc) · 1.53 KB
/
liveness-asm.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Ensure inout asm! operands are marked as used by the liveness pass
//@ only-x86_64
//@ check-pass
#![allow(dead_code)]
#![warn(unused_assignments)]
#![warn(unused_variables)]
use std::arch::asm;
// Test the single inout case
unsafe fn f1(mut src: *const u8) {
asm!("/*{0}*/", inout(reg) src); //~ WARN value assigned to `src` is never read
}
unsafe fn f2(mut src: *const u8) -> *const u8 {
asm!("/*{0}*/", inout(reg) src);
src
}
// Test the split inout case
unsafe fn f3(mut src: *const u8) {
asm!("/*{0}*/", inout(reg) src => src); //~ WARN value assigned to `src` is never read
}
unsafe fn f4(mut src: *const u8) -> *const u8 {
asm!("/*{0}*/", inout(reg) src => src);
src
}
// Tests the use of field projections
struct S {
field: *mut u8,
}
unsafe fn f5(src: &mut S) {
asm!("/*{0}*/", inout(reg) src.field);
}
unsafe fn f6(src: &mut S) {
asm!("/*{0}*/", inout(reg) src.field => src.field);
}
fn main() {}
// ferrocene-annotations: fls_j9l8wn6wgm06
// Registers
//
// ferrocene-annotations: fls_pz2ioqchjtym
// Register Classes
//
// ferrocene-annotations: fls_hejgghwzblf
// Register Arguments
//
// ferrocene-annotations: fls_e0896uk0mdyl
// Assembly Instructions
//
// ferrocene-annotations: fls_lv19xysy1f7e
// Register Parameter Modifiers
//
// ferrocene-annotations: fls_6momhvgx4w21
// Directive Support
//
// ferrocene-annotations: fls_a3joqzqp1v9d
// ABI Clobbers
//
// ferrocene-annotations: fls_ylli0ortyegk
// Assembly Options
//
// ferrocene-annotations: fls_qezwyridmjob
// Macros asm and global_asm