Skip to content

Commit

Permalink
rustc_codegen_llvm: less pubs
Browse files Browse the repository at this point in the history
  • Loading branch information
klensy committed Jul 3, 2024
1 parent 7d97c59 commit 7c6ea65
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 24 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use rustc_codegen_ssa::traits::*;
use rustc_codegen_ssa::MemFlags;
use rustc_middle::bug;
use rustc_middle::ty::layout::LayoutOf;
pub use rustc_middle::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA};
pub(crate) use rustc_middle::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA};
use rustc_middle::ty::Ty;
use rustc_session::config;
pub use rustc_target::abi::call::*;
pub(crate) use rustc_target::abi::call::*;
use rustc_target::abi::{self, HasDataLayout, Int, Size};
pub use rustc_target::spec::abi::Abi;
pub(crate) use rustc_target::spec::abi::Abi;
use rustc_target::spec::SanitizerSet;

use libc::c_uint;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::errors::{MissingFeatures, SanitizerMemtagRequiresMte, TargetFeatureDi
use crate::llvm::AttributePlace::Function;
use crate::llvm::{self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects};
use crate::llvm_util;
pub use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr};
pub(crate) use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr};

use crate::context::CodegenCx;
use crate::value::Value;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/common.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Code that is useful in various codegen modules.
use crate::consts::const_alloc_to_llvm;
pub use crate::context::CodegenCx;
pub(crate) use crate::context::CodegenCx;
use crate::llvm::{self, BasicBlock, Bool, ConstantInt, False, OperandBundleDef, True};
use crate::type_::Type;
use crate::value::Value;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub mod metadata;
mod namespace;
mod utils;

pub use self::create_scope_map::compute_mir_scopes;
pub use self::metadata::build_global_var_di_node;
pub(crate) use self::create_scope_map::compute_mir_scopes;
pub(crate) use self::metadata::build_global_var_di_node;

#[allow(non_upper_case_globals)]
const DW_TAG_auto_variable: c_uint = 0x100;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use back::owned_target_machine::OwnedTargetMachine;
use back::write::{create_informational_target_machine, create_target_machine};

use errors::ParseTargetMachineConfig;
pub use llvm_util::target_features;
pub(crate) use llvm_util::target_features;
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
use rustc_codegen_ssa::back::write::{
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/llvm/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! LLVM diagnostic reports.
pub use self::Diagnostic::*;
pub use self::OptimizationDiagnosticKind::*;
pub(crate) use self::Diagnostic::*;
pub(crate) use self::OptimizationDiagnosticKind::*;

use crate::value::Value;
use libc::c_uint;
Expand Down
23 changes: 19 additions & 4 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ pub enum DLLStorageClass {
#[derive(Copy, Clone, Debug)]
pub enum AttributeKind {
AlwaysInline = 0,
#[allow(dead_code)]
ByVal = 1,
Cold = 2,
InlineHint = 3,
Expand All @@ -176,15 +177,19 @@ pub enum AttributeKind {
OptimizeForSize = 13,
ReadOnly = 14,
SExt = 15,
#[allow(dead_code)]
StructRet = 16,
#[allow(dead_code)]
UWTable = 17,
ZExt = 18,
InReg = 19,
SanitizeThread = 20,
SanitizeAddress = 21,
SanitizeMemory = 22,
NonLazyBind = 23,
#[allow(dead_code)]
OptimizeNone = 24,
#[allow(dead_code)]
ReadNone = 26,
SanitizeHWAddress = 28,
WillReturn = 29,
Expand All @@ -195,6 +200,7 @@ pub enum AttributeKind {
SanitizeMemTag = 34,
NoCfCheck = 35,
ShadowCallStack = 36,
#[allow(dead_code)]
AllocSize = 37,
AllocatedPointer = 38,
AllocAlign = 39,
Expand Down Expand Up @@ -289,6 +295,7 @@ impl RealPredicate {
/// LLVMTypeKind
#[derive(Copy, Clone, PartialEq, Debug)]
#[repr(C)]
#[allow(dead_code)]
pub enum TypeKind {
Void = 0,
Half = 1,
Expand Down Expand Up @@ -418,16 +425,24 @@ pub enum FileType {
#[derive(Copy, Clone)]
#[repr(C)]
pub enum MetadataType {
#[allow(dead_code)]
MD_dbg = 0,
#[allow(dead_code)]
MD_tbaa = 1,
#[allow(dead_code)]
MD_prof = 2,
#[allow(dead_code)]
MD_fpmath = 3,
MD_range = 4,
#[allow(dead_code)]
MD_tbaa_struct = 5,
MD_invariant_load = 6,
#[allow(dead_code)]
MD_alias_scope = 7,
#[allow(dead_code)]
MD_noalias = 8,
MD_nontemporal = 9,
#[allow(dead_code)]
MD_mem_parallel_loop_access = 10,
MD_nonnull = 11,
MD_align = 17,
Expand Down Expand Up @@ -598,6 +613,7 @@ pub enum ThreadLocalMode {
/// LLVMRustTailCallKind
#[derive(Copy, Clone)]
#[repr(C)]
#[allow(dead_code)]
pub enum TailCallKind {
None,
Tail,
Expand Down Expand Up @@ -662,9 +678,6 @@ extern "C" {
pub struct Builder<'a>(InvariantOpaque<'a>);
#[repr(C)]
pub struct PassManager<'a>(InvariantOpaque<'a>);
extern "C" {
pub type Pass;
}
extern "C" {
pub type TargetMachine;
}
Expand Down Expand Up @@ -696,7 +709,6 @@ extern "C" {
}

pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);

pub mod debuginfo {
use super::{InvariantOpaque, Metadata};
Expand Down Expand Up @@ -804,6 +816,7 @@ pub mod debuginfo {
#[repr(C)]
pub enum DebugNameTableKind {
Default,
#[allow(dead_code)]
Gnu,
None,
}
Expand Down Expand Up @@ -1563,6 +1576,8 @@ extern "C" {
Name: *const c_char,
NameLen: size_t,
) -> Option<&Value>;

#[allow(dead_code)]
pub fn LLVMRustSetTailCallKind(CallInst: &Value, TKC: TailCallKind);

// Operations on attributes
Expand Down
12 changes: 4 additions & 8 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#![allow(non_snake_case)]

pub use self::AtomicRmwBinOp::*;
pub use self::CallConv::*;
pub use self::CodeGenOptSize::*;
pub use self::IntPredicate::*;
pub use self::Linkage::*;
pub use self::MetadataType::*;
pub use self::RealPredicate::*;
pub(crate) use self::CallConv::*;
pub(crate) use self::CodeGenOptSize::*;
pub(crate) use self::MetadataType::*;

use libc::c_uint;
use rustc_data_structures::small_c_str::SmallCStr;
Expand All @@ -21,7 +17,7 @@ pub mod archive_ro;
pub mod diagnostic;
mod ffi;

pub use self::ffi::*;
pub(crate) use self::ffi::*;

impl LLVMRustResult {
pub fn into_result(self) -> Result<(), ()> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/type_.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use crate::llvm::Type;
pub(crate) use crate::llvm::Type;

use crate::abi::{FnAbiLlvmExt, LlvmType};
use crate::common;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/value.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use crate::llvm::Value;
pub(crate) use crate::llvm::Value;

use crate::llvm;

Expand Down

0 comments on commit 7c6ea65

Please sign in to comment.