@@ -25,7 +25,7 @@ use crate::value::Value;
25
25
26
26
/// Mark LLVM function to use provided inline heuristic.
27
27
#[ inline]
28
- fn inline ( cx : & CodegenCx < ' ll , ' _ > , val : & ' ll Value , inline : InlineAttr ) {
28
+ fn inline < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , val : & ' ll Value , inline : InlineAttr ) {
29
29
use self :: InlineAttr :: * ;
30
30
match inline {
31
31
Hint => Attribute :: InlineHint . apply_llfn ( Function , val) ,
@@ -41,7 +41,7 @@ fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) {
41
41
42
42
/// Apply LLVM sanitize attributes.
43
43
#[ inline]
44
- pub fn sanitize ( cx : & CodegenCx < ' ll , ' _ > , no_sanitize : SanitizerSet , llfn : & ' ll Value ) {
44
+ pub fn sanitize < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , no_sanitize : SanitizerSet , llfn : & ' ll Value ) {
45
45
let enabled = cx. tcx . sess . opts . debugging_opts . sanitizer - no_sanitize;
46
46
if enabled. contains ( SanitizerSet :: ADDRESS ) {
47
47
llvm:: Attribute :: SanitizeAddress . apply_llfn ( Function , llfn) ;
@@ -59,17 +59,17 @@ pub fn sanitize(cx: &CodegenCx<'ll, '_>, no_sanitize: SanitizerSet, llfn: &'ll V
59
59
60
60
/// Tell LLVM to emit or not emit the information necessary to unwind the stack for the function.
61
61
#[ inline]
62
- pub fn emit_uwtable ( val : & ' ll Value , emit : bool ) {
62
+ pub fn emit_uwtable ( val : & Value , emit : bool ) {
63
63
Attribute :: UWTable . toggle_llfn ( Function , val, emit) ;
64
64
}
65
65
66
66
/// Tell LLVM if this function should be 'naked', i.e., skip the epilogue and prologue.
67
67
#[ inline]
68
- fn naked ( val : & ' ll Value , is_naked : bool ) {
68
+ fn naked ( val : & Value , is_naked : bool ) {
69
69
Attribute :: Naked . toggle_llfn ( Function , val, is_naked) ;
70
70
}
71
71
72
- pub fn set_frame_pointer_type ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
72
+ pub fn set_frame_pointer_type < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
73
73
let mut fp = cx. sess ( ) . target . frame_pointer ;
74
74
// "mcount" function relies on stack pointer.
75
75
// See <https://sourceware.org/binutils/docs/gprof/Implementation.html>.
@@ -92,7 +92,7 @@ pub fn set_frame_pointer_type(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
92
92
93
93
/// Tell LLVM what instrument function to insert.
94
94
#[ inline]
95
- fn set_instrument_function ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
95
+ fn set_instrument_function < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
96
96
if cx. sess ( ) . instrument_mcount ( ) {
97
97
// Similar to `clang -pg` behavior. Handled by the
98
98
// `post-inline-ee-instrument` LLVM pass.
@@ -110,7 +110,7 @@ fn set_instrument_function(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
110
110
}
111
111
}
112
112
113
- fn set_probestack ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
113
+ fn set_probestack < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
114
114
// Currently stack probes seem somewhat incompatible with the address
115
115
// sanitizer and thread sanitizer. With asan we're already protected from
116
116
// stack overflow anyway so we don't really need stack probes regardless.
@@ -161,7 +161,7 @@ fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
161
161
}
162
162
}
163
163
164
- fn set_stackprotector ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
164
+ fn set_stackprotector < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
165
165
let sspattr = match cx. sess ( ) . stack_protector ( ) {
166
166
StackProtector :: None => return ,
167
167
StackProtector :: All => Attribute :: StackProtectReq ,
@@ -172,7 +172,7 @@ fn set_stackprotector(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
172
172
sspattr. apply_llfn ( Function , llfn)
173
173
}
174
174
175
- pub fn apply_target_cpu_attr ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
175
+ pub fn apply_target_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
176
176
let target_cpu = SmallCStr :: new ( llvm_util:: target_cpu ( cx. tcx . sess ) ) ;
177
177
llvm:: AddFunctionAttrStringValue (
178
178
llfn,
@@ -182,7 +182,7 @@ pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
182
182
) ;
183
183
}
184
184
185
- pub fn apply_tune_cpu_attr ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
185
+ pub fn apply_tune_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , llfn : & ' ll Value ) {
186
186
if let Some ( tune) = llvm_util:: tune_cpu ( cx. tcx . sess ) {
187
187
let tune_cpu = SmallCStr :: new ( tune) ;
188
188
llvm:: AddFunctionAttrStringValue (
@@ -196,14 +196,14 @@ pub fn apply_tune_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
196
196
197
197
/// Sets the `NonLazyBind` LLVM attribute on a given function,
198
198
/// assuming the codegen options allow skipping the PLT.
199
- pub fn non_lazy_bind ( sess : & Session , llfn : & ' ll Value ) {
199
+ pub fn non_lazy_bind < ' ll > ( sess : & Session , llfn : & ' ll Value ) {
200
200
// Don't generate calls through PLT if it's not necessary
201
201
if !sess. needs_plt ( ) {
202
202
Attribute :: NonLazyBind . apply_llfn ( Function , llfn) ;
203
203
}
204
204
}
205
205
206
- pub ( crate ) fn default_optimisation_attrs ( sess : & Session , llfn : & ' ll Value ) {
206
+ pub ( crate ) fn default_optimisation_attrs < ' ll > ( sess : & Session , llfn : & ' ll Value ) {
207
207
match sess. opts . optimize {
208
208
OptLevel :: Size => {
209
209
llvm:: Attribute :: MinSize . unapply_llfn ( Function , llfn) ;
@@ -226,7 +226,11 @@ pub(crate) fn default_optimisation_attrs(sess: &Session, llfn: &'ll Value) {
226
226
227
227
/// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`)
228
228
/// attributes.
229
- pub fn from_fn_attrs ( cx : & CodegenCx < ' ll , ' tcx > , llfn : & ' ll Value , instance : ty:: Instance < ' tcx > ) {
229
+ pub fn from_fn_attrs < ' ll , ' tcx > (
230
+ cx : & CodegenCx < ' ll , ' tcx > ,
231
+ llfn : & ' ll Value ,
232
+ instance : ty:: Instance < ' tcx > ,
233
+ ) {
230
234
let codegen_fn_attrs = cx. tcx . codegen_fn_attrs ( instance. def_id ( ) ) ;
231
235
232
236
match codegen_fn_attrs. optimize {
0 commit comments