Reduce visibility

This commit is contained in:
bjorn3 2020-01-14 17:11:06 +01:00
parent 29fafb44b1
commit 09b44f5d25
8 changed files with 19 additions and 19 deletions

View File

@ -1,5 +1,7 @@
use crate::prelude::*;
pub(super) use EmptySinglePair::*;
#[derive(Copy, Clone, Debug)]
pub enum PassMode {
NoPass,
@ -9,18 +11,18 @@ pub enum PassMode {
}
#[derive(Copy, Clone, Debug)]
pub enum EmptySinglePair<T> {
pub(super) enum EmptySinglePair<T> {
Empty,
Single(T),
Pair(T, T),
}
impl<T> EmptySinglePair<T> {
pub fn into_iter(self) -> EmptySinglePairIter<T> {
pub(super) fn into_iter(self) -> EmptySinglePairIter<T> {
EmptySinglePairIter(self)
}
pub fn map<U>(self, mut f: impl FnMut(T) -> U) -> EmptySinglePair<U> {
pub(super) fn map<U>(self, mut f: impl FnMut(T) -> U) -> EmptySinglePair<U> {
match self {
Empty => Empty,
Single(v) => Single(f(v)),
@ -29,7 +31,7 @@ impl<T> EmptySinglePair<T> {
}
}
pub struct EmptySinglePairIter<T>(EmptySinglePair<T>);
pub(super) struct EmptySinglePairIter<T>(EmptySinglePair<T>);
impl<T> Iterator for EmptySinglePairIter<T> {
type Item = T;
@ -47,14 +49,14 @@ impl<T> Iterator for EmptySinglePairIter<T> {
}
impl<T: std::fmt::Debug> EmptySinglePair<T> {
pub fn assert_single(self) -> T {
pub(super) fn assert_single(self) -> T {
match self {
Single(v) => v,
_ => panic!("Called assert_single on {:?}", self),
}
}
pub fn assert_pair(self) -> (T, T) {
pub(super) fn assert_pair(self) -> (T, T) {
match self {
Pair(a, b) => (a, b),
_ => panic!("Called assert_pair on {:?}", self),
@ -62,10 +64,8 @@ impl<T: std::fmt::Debug> EmptySinglePair<T> {
}
}
pub use EmptySinglePair::*;
impl PassMode {
pub fn get_param_ty(self, tcx: TyCtxt<'_>) -> EmptySinglePair<Type> {
pub(super) fn get_param_ty(self, tcx: TyCtxt<'_>) -> EmptySinglePair<Type> {
match self {
PassMode::NoPass => Empty,
PassMode::ByVal(clif_type) => Single(clif_type),
@ -108,7 +108,7 @@ pub fn get_pass_mode<'tcx>(tcx: TyCtxt<'tcx>, layout: TyLayout<'tcx>) -> PassMod
}
}
pub fn adjust_arg_for_abi<'tcx>(
pub(super) fn adjust_arg_for_abi<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
arg: CValue<'tcx>,
) -> EmptySinglePair<Value> {
@ -123,7 +123,7 @@ pub fn adjust_arg_for_abi<'tcx>(
}
}
pub fn cvalue_for_param<'tcx>(
pub(super) fn cvalue_for_param<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
start_ebb: Ebb,
local: Option<mir::Local>,

View File

@ -13,7 +13,7 @@ pub fn can_return_to_ssa_var<'tcx>(tcx: TyCtxt<'tcx>, dest_layout: TyLayout<'tcx
}
}
pub fn codegen_return_param(
pub(super) fn codegen_return_param(
fx: &mut FunctionCx<impl Backend>,
ssa_analyzed: &rustc_index::vec::IndexVec<Local, crate::analyze::SsaKind>,
start_ebb: Ebb,
@ -54,7 +54,7 @@ pub fn codegen_return_param(
);
}
pub fn codegen_with_call_return_arg<'tcx, B: Backend, T>(
pub(super) fn codegen_with_call_return_arg<'tcx, B: Backend, T>(
fx: &mut FunctionCx<'_, 'tcx, B>,
fn_sig: FnSig<'tcx>,
ret_place: Option<CPlace<'tcx>>,

View File

@ -28,7 +28,7 @@ pub fn codegen(tcx: TyCtxt<'_>, module: &mut Module<impl Backend + 'static>) ->
}
}
pub fn codegen_inner(module: &mut Module<impl Backend + 'static>, kind: AllocatorKind) {
fn codegen_inner(module: &mut Module<impl Backend + 'static>, kind: AllocatorKind) {
let usize_ty = module.target_config().pointer_type();
for method in ALLOCATOR_METHODS {

View File

@ -34,7 +34,7 @@ pub fn scalar_to_clif_type(tcx: TyCtxt, scalar: Scalar) -> Type {
}
}
pub fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Type> {
fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Type> {
Some(match ty.kind {
ty::Bool => types::I8,
ty::Uint(size) => match size {

View File

@ -101,7 +101,7 @@ impl<'tcx> DebugContext<'tcx> {
}
impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
pub(crate) fn create_debug_lines(
pub(super) fn create_debug_lines(
&mut self,
context: &Context,
isa: &dyn cranelift_codegen::isa::TargetIsa,

View File

@ -127,7 +127,7 @@ macro atomic_minmax($fx:expr, $cc:expr, <$T:ident> ($ptr:ident, $src:ident) -> $
$ret.write_cvalue($fx, ret_val);
}
pub fn lane_type_and_count<'tcx>(
fn lane_type_and_count<'tcx>(
tcx: TyCtxt<'tcx>,
layout: TyLayout<'tcx>,
) -> (TyLayout<'tcx>, u32) {

View File

@ -1,7 +1,7 @@
use crate::prelude::*;
use super::*;
pub fn codegen_simd_intrinsic_call<'tcx>(
pub(super) fn codegen_simd_intrinsic_call<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
instance: Instance<'tcx>,
args: &[mir::Operand<'tcx>],

View File

@ -10,7 +10,7 @@
use crate::prelude::*;
pub fn optimize_function(ctx: &mut Context, cold_ebbs: &EntitySet<Ebb>) {
pub(super) fn optimize_function(ctx: &mut Context, cold_ebbs: &EntitySet<Ebb>) {
// FIXME Move the ebb in place instead of remove and append once
// bytecodealliance/cranelift#1339 is implemented.