@@ -15,18 +15,18 @@ use crate::errors::{MissingFeatures, SanitizerMemtagRequiresMte, TargetFeatureDi
15
15
use crate :: llvm:: AttributePlace :: Function ;
16
16
use crate :: llvm:: { self , AllocKindFlags , Attribute , AttributeKind , AttributePlace , MemoryEffects } ;
17
17
use crate :: llvm_util;
18
- pub use rustc_attr:: { InlineAttr , InstructionSetAttr , OptimizeAttr } ;
18
+ use rustc_attr:: { InlineAttr , InstructionSetAttr , OptimizeAttr } ;
19
19
20
20
use crate :: context:: CodegenCx ;
21
21
use crate :: value:: Value ;
22
22
23
- pub fn apply_to_llfn ( llfn : & Value , idx : AttributePlace , attrs : & [ & Attribute ] ) {
23
+ pub ( crate ) fn apply_to_llfn ( llfn : & Value , idx : AttributePlace , attrs : & [ & Attribute ] ) {
24
24
if !attrs. is_empty ( ) {
25
25
llvm:: AddFunctionAttributes ( llfn, idx, attrs) ;
26
26
}
27
27
}
28
28
29
- pub fn apply_to_callsite ( callsite : & Value , idx : AttributePlace , attrs : & [ & Attribute ] ) {
29
+ pub ( crate ) fn apply_to_callsite ( callsite : & Value , idx : AttributePlace , attrs : & [ & Attribute ] ) {
30
30
if !attrs. is_empty ( ) {
31
31
llvm:: AddCallSiteAttributes ( callsite, idx, attrs) ;
32
32
}
@@ -83,7 +83,7 @@ fn patchable_function_entry_attrs<'ll>(
83
83
84
84
/// Get LLVM sanitize attributes.
85
85
#[ inline]
86
- pub fn sanitize_attrs < ' ll > (
86
+ pub ( crate ) fn sanitize_attrs < ' ll > (
87
87
cx : & CodegenCx < ' ll , ' _ > ,
88
88
no_sanitize : SanitizerSet ,
89
89
) -> SmallVec < [ & ' ll Attribute ; 4 ] > {
@@ -123,15 +123,15 @@ pub fn sanitize_attrs<'ll>(
123
123
124
124
/// Tell LLVM to emit or not emit the information necessary to unwind the stack for the function.
125
125
#[ inline]
126
- pub fn uwtable_attr ( llcx : & llvm:: Context , use_sync_unwind : Option < bool > ) -> & Attribute {
126
+ pub ( crate ) fn uwtable_attr ( llcx : & llvm:: Context , use_sync_unwind : Option < bool > ) -> & Attribute {
127
127
// NOTE: We should determine if we even need async unwind tables, as they
128
128
// take have more overhead and if we can use sync unwind tables we
129
129
// probably should.
130
130
let async_unwind = !use_sync_unwind. unwrap_or ( false ) ;
131
131
llvm:: CreateUWTableAttr ( llcx, async_unwind)
132
132
}
133
133
134
- pub fn frame_pointer_type_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
134
+ pub ( crate ) fn frame_pointer_type_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
135
135
let mut fp = cx. sess ( ) . target . frame_pointer ;
136
136
let opts = & cx. sess ( ) . opts ;
137
137
// "mcount" function relies on stack pointer.
@@ -272,19 +272,19 @@ fn stackprotector_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
272
272
Some ( sspattr. create_attr ( cx. llcx ) )
273
273
}
274
274
275
- pub fn target_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> & ' ll Attribute {
275
+ pub ( crate ) fn target_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> & ' ll Attribute {
276
276
let target_cpu = llvm_util:: target_cpu ( cx. tcx . sess ) ;
277
277
llvm:: CreateAttrStringValue ( cx. llcx , "target-cpu" , target_cpu)
278
278
}
279
279
280
- pub fn tune_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
280
+ pub ( crate ) fn tune_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
281
281
llvm_util:: tune_cpu ( cx. tcx . sess )
282
282
. map ( |tune_cpu| llvm:: CreateAttrStringValue ( cx. llcx , "tune-cpu" , tune_cpu) )
283
283
}
284
284
285
285
/// Get the `NonLazyBind` LLVM attribute,
286
286
/// if the codegen options allow skipping the PLT.
287
- pub fn non_lazy_bind_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
287
+ pub ( crate ) fn non_lazy_bind_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
288
288
// Don't generate calls through PLT if it's not necessary
289
289
if !cx. sess ( ) . needs_plt ( ) {
290
290
Some ( AttributeKind :: NonLazyBind . create_attr ( cx. llcx ) )
@@ -318,7 +318,7 @@ fn create_alloc_family_attr(llcx: &llvm::Context) -> &llvm::Attribute {
318
318
319
319
/// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`)
320
320
/// attributes.
321
- pub fn from_fn_attrs < ' ll , ' tcx > (
321
+ pub ( crate ) fn from_fn_attrs < ' ll , ' tcx > (
322
322
cx : & CodegenCx < ' ll , ' tcx > ,
323
323
llfn : & ' ll Value ,
324
324
instance : ty:: Instance < ' tcx > ,
0 commit comments