11//! Set and unset common attributes on LLVM values.
22
3- pub use rustc_attr:: { InlineAttr , InstructionSetAttr , OptimizeAttr } ;
3+ use rustc_attr:: { InlineAttr , InstructionSetAttr , OptimizeAttr } ;
44use rustc_codegen_ssa:: traits:: * ;
55use rustc_hir:: def_id:: DefId ;
66use rustc_middle:: middle:: codegen_fn_attrs:: { CodegenFnAttrFlags , PatchableFunctionEntry } ;
@@ -17,13 +17,13 @@ use crate::llvm::{self, AllocKindFlags, Attribute, AttributeKind, AttributePlace
1717use crate :: value:: Value ;
1818use crate :: { attributes, llvm_util} ;
1919
20- pub fn apply_to_llfn ( llfn : & Value , idx : AttributePlace , attrs : & [ & Attribute ] ) {
20+ pub ( crate ) fn apply_to_llfn ( llfn : & Value , idx : AttributePlace , attrs : & [ & Attribute ] ) {
2121 if !attrs. is_empty ( ) {
2222 llvm:: AddFunctionAttributes ( llfn, idx, attrs) ;
2323 }
2424}
2525
26- pub fn apply_to_callsite ( callsite : & Value , idx : AttributePlace , attrs : & [ & Attribute ] ) {
26+ pub ( crate ) fn apply_to_callsite ( callsite : & Value , idx : AttributePlace , attrs : & [ & Attribute ] ) {
2727 if !attrs. is_empty ( ) {
2828 llvm:: AddCallSiteAttributes ( callsite, idx, attrs) ;
2929 }
@@ -80,7 +80,7 @@ fn patchable_function_entry_attrs<'ll>(
8080
8181/// Get LLVM sanitize attributes.
8282#[ inline]
83- pub fn sanitize_attrs < ' ll > (
83+ pub ( crate ) fn sanitize_attrs < ' ll > (
8484 cx : & CodegenCx < ' ll , ' _ > ,
8585 no_sanitize : SanitizerSet ,
8686) -> SmallVec < [ & ' ll Attribute ; 4 ] > {
@@ -120,15 +120,15 @@ pub fn sanitize_attrs<'ll>(
120120
121121/// Tell LLVM to emit or not emit the information necessary to unwind the stack for the function.
122122#[ inline]
123- pub fn uwtable_attr ( llcx : & llvm:: Context , use_sync_unwind : Option < bool > ) -> & Attribute {
123+ pub ( crate ) fn uwtable_attr ( llcx : & llvm:: Context , use_sync_unwind : Option < bool > ) -> & Attribute {
124124 // NOTE: We should determine if we even need async unwind tables, as they
125125 // take have more overhead and if we can use sync unwind tables we
126126 // probably should.
127127 let async_unwind = !use_sync_unwind. unwrap_or ( false ) ;
128128 llvm:: CreateUWTableAttr ( llcx, async_unwind)
129129}
130130
131- pub fn frame_pointer_type_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
131+ pub ( crate ) fn frame_pointer_type_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
132132 let mut fp = cx. sess ( ) . target . frame_pointer ;
133133 let opts = & cx. sess ( ) . opts ;
134134 // "mcount" function relies on stack pointer.
@@ -280,19 +280,19 @@ fn backchain_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
280280 if found_positive { Some ( llvm:: CreateAttrString ( cx. llcx , "backchain" ) ) } else { None }
281281}
282282
283- pub fn target_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> & ' ll Attribute {
283+ pub ( crate ) fn target_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> & ' ll Attribute {
284284 let target_cpu = llvm_util:: target_cpu ( cx. tcx . sess ) ;
285285 llvm:: CreateAttrStringValue ( cx. llcx , "target-cpu" , target_cpu)
286286}
287287
288- pub fn tune_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
288+ pub ( crate ) fn tune_cpu_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
289289 llvm_util:: tune_cpu ( cx. tcx . sess )
290290 . map ( |tune_cpu| llvm:: CreateAttrStringValue ( cx. llcx , "tune-cpu" , tune_cpu) )
291291}
292292
293293/// Get the `NonLazyBind` LLVM attribute,
294294/// if the codegen options allow skipping the PLT.
295- pub fn non_lazy_bind_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
295+ pub ( crate ) fn non_lazy_bind_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
296296 // Don't generate calls through PLT if it's not necessary
297297 if !cx. sess ( ) . needs_plt ( ) {
298298 Some ( AttributeKind :: NonLazyBind . create_attr ( cx. llcx ) )
@@ -327,7 +327,7 @@ fn create_alloc_family_attr(llcx: &llvm::Context) -> &llvm::Attribute {
327327/// Helper for `FnAbi::apply_attrs_llfn`:
328328/// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`)
329329/// attributes.
330- pub fn llfn_attrs_from_instance < ' ll , ' tcx > (
330+ pub ( crate ) fn llfn_attrs_from_instance < ' ll , ' tcx > (
331331 cx : & CodegenCx < ' ll , ' tcx > ,
332332 llfn : & ' ll Value ,
333333 instance : ty:: Instance < ' tcx > ,
0 commit comments