@@ -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
}
@@ -55,7 +55,7 @@ fn inline_attr<'ll>(cx: &CodegenCx<'ll, '_>, inline: InlineAttr) -> Option<&'ll
55
55
56
56
/// Get LLVM sanitize attributes.
57
57
#[ inline]
58
- pub fn sanitize_attrs < ' ll > (
58
+ pub ( crate ) fn sanitize_attrs < ' ll > (
59
59
cx : & CodegenCx < ' ll , ' _ > ,
60
60
no_sanitize : SanitizerSet ,
61
61
) -> SmallVec < [ & ' ll Attribute ; 4 ] > {
@@ -95,15 +95,15 @@ pub fn sanitize_attrs<'ll>(
95
95
96
96
/// Tell LLVM to emit or not emit the information necessary to unwind the stack for the function.
97
97
#[ inline]
98
- pub fn uwtable_attr ( llcx : & llvm:: Context , use_sync_unwind : Option < bool > ) -> & Attribute {
98
+ pub ( crate ) fn uwtable_attr ( llcx : & llvm:: Context , use_sync_unwind : Option < bool > ) -> & Attribute {
99
99
// NOTE: We should determine if we even need async unwind tables, as they
100
100
// take have more overhead and if we can use sync unwind tables we
101
101
// probably should.
102
102
let async_unwind = !use_sync_unwind. unwrap_or ( false ) ;
103
103
llvm:: CreateUWTableAttr ( llcx, async_unwind)
104
104
}
105
105
106
- pub fn frame_pointer_type_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
106
+ pub ( crate ) fn frame_pointer_type_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
107
107
let mut fp = cx. sess ( ) . target . frame_pointer ;
108
108
let opts = & cx. sess ( ) . opts ;
109
109
// "mcount" function relies on stack pointer.
@@ -243,19 +243,19 @@ fn stackprotector_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
243
243
Some ( sspattr. create_attr ( cx. llcx ) )
244
244
}
245
245
246
- pub fn target_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> & ' ll Attribute {
246
+ pub ( crate ) fn target_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> & ' ll Attribute {
247
247
let target_cpu = llvm_util:: target_cpu ( cx. tcx . sess ) ;
248
248
llvm:: CreateAttrStringValue ( cx. llcx , "target-cpu" , target_cpu)
249
249
}
250
250
251
- pub fn tune_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
251
+ pub ( crate ) fn tune_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
252
252
llvm_util:: tune_cpu ( cx. tcx . sess )
253
253
. map ( |tune_cpu| llvm:: CreateAttrStringValue ( cx. llcx , "tune-cpu" , tune_cpu) )
254
254
}
255
255
256
256
/// Get the `NonLazyBind` LLVM attribute,
257
257
/// if the codegen options allow skipping the PLT.
258
- pub fn non_lazy_bind_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
258
+ pub ( crate ) fn non_lazy_bind_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
259
259
// Don't generate calls through PLT if it's not necessary
260
260
if !cx. sess ( ) . needs_plt ( ) {
261
261
Some ( AttributeKind :: NonLazyBind . create_attr ( cx. llcx ) )
@@ -289,7 +289,7 @@ fn create_alloc_family_attr(llcx: &llvm::Context) -> &llvm::Attribute {
289
289
290
290
/// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`)
291
291
/// attributes.
292
- pub fn from_fn_attrs < ' ll , ' tcx > (
292
+ pub ( crate ) fn from_fn_attrs < ' ll , ' tcx > (
293
293
cx : & CodegenCx < ' ll , ' tcx > ,
294
294
llfn : & ' ll Value ,
295
295
instance : ty:: Instance < ' tcx > ,
0 commit comments