mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
Reduce visibility
This commit is contained in:
parent
29fafb44b1
commit
09b44f5d25
@ -1,5 +1,7 @@
|
|||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
pub(super) use EmptySinglePair::*;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum PassMode {
|
pub enum PassMode {
|
||||||
NoPass,
|
NoPass,
|
||||||
@ -9,18 +11,18 @@ pub enum PassMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum EmptySinglePair<T> {
|
pub(super) enum EmptySinglePair<T> {
|
||||||
Empty,
|
Empty,
|
||||||
Single(T),
|
Single(T),
|
||||||
Pair(T, T),
|
Pair(T, T),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> EmptySinglePair<T> {
|
impl<T> EmptySinglePair<T> {
|
||||||
pub fn into_iter(self) -> EmptySinglePairIter<T> {
|
pub(super) fn into_iter(self) -> EmptySinglePairIter<T> {
|
||||||
EmptySinglePairIter(self)
|
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 {
|
match self {
|
||||||
Empty => Empty,
|
Empty => Empty,
|
||||||
Single(v) => Single(f(v)),
|
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> {
|
impl<T> Iterator for EmptySinglePairIter<T> {
|
||||||
type Item = T;
|
type Item = T;
|
||||||
@ -47,14 +49,14 @@ impl<T> Iterator for EmptySinglePairIter<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T: std::fmt::Debug> EmptySinglePair<T> {
|
impl<T: std::fmt::Debug> EmptySinglePair<T> {
|
||||||
pub fn assert_single(self) -> T {
|
pub(super) fn assert_single(self) -> T {
|
||||||
match self {
|
match self {
|
||||||
Single(v) => v,
|
Single(v) => v,
|
||||||
_ => panic!("Called assert_single on {:?}", self),
|
_ => panic!("Called assert_single on {:?}", self),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn assert_pair(self) -> (T, T) {
|
pub(super) fn assert_pair(self) -> (T, T) {
|
||||||
match self {
|
match self {
|
||||||
Pair(a, b) => (a, b),
|
Pair(a, b) => (a, b),
|
||||||
_ => panic!("Called assert_pair on {:?}", self),
|
_ => panic!("Called assert_pair on {:?}", self),
|
||||||
@ -62,10 +64,8 @@ impl<T: std::fmt::Debug> EmptySinglePair<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use EmptySinglePair::*;
|
|
||||||
|
|
||||||
impl PassMode {
|
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 {
|
match self {
|
||||||
PassMode::NoPass => Empty,
|
PassMode::NoPass => Empty,
|
||||||
PassMode::ByVal(clif_type) => Single(clif_type),
|
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>,
|
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
|
||||||
arg: CValue<'tcx>,
|
arg: CValue<'tcx>,
|
||||||
) -> EmptySinglePair<Value> {
|
) -> 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>,
|
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
|
||||||
start_ebb: Ebb,
|
start_ebb: Ebb,
|
||||||
local: Option<mir::Local>,
|
local: Option<mir::Local>,
|
||||||
|
@ -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>,
|
fx: &mut FunctionCx<impl Backend>,
|
||||||
ssa_analyzed: &rustc_index::vec::IndexVec<Local, crate::analyze::SsaKind>,
|
ssa_analyzed: &rustc_index::vec::IndexVec<Local, crate::analyze::SsaKind>,
|
||||||
start_ebb: Ebb,
|
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>,
|
fx: &mut FunctionCx<'_, 'tcx, B>,
|
||||||
fn_sig: FnSig<'tcx>,
|
fn_sig: FnSig<'tcx>,
|
||||||
ret_place: Option<CPlace<'tcx>>,
|
ret_place: Option<CPlace<'tcx>>,
|
||||||
|
@ -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();
|
let usize_ty = module.target_config().pointer_type();
|
||||||
|
|
||||||
for method in ALLOCATOR_METHODS {
|
for method in ALLOCATOR_METHODS {
|
||||||
|
@ -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 {
|
Some(match ty.kind {
|
||||||
ty::Bool => types::I8,
|
ty::Bool => types::I8,
|
||||||
ty::Uint(size) => match size {
|
ty::Uint(size) => match size {
|
||||||
|
@ -101,7 +101,7 @@ impl<'tcx> DebugContext<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||||
pub(crate) fn create_debug_lines(
|
pub(super) fn create_debug_lines(
|
||||||
&mut self,
|
&mut self,
|
||||||
context: &Context,
|
context: &Context,
|
||||||
isa: &dyn cranelift_codegen::isa::TargetIsa,
|
isa: &dyn cranelift_codegen::isa::TargetIsa,
|
||||||
|
@ -127,7 +127,7 @@ macro atomic_minmax($fx:expr, $cc:expr, <$T:ident> ($ptr:ident, $src:ident) -> $
|
|||||||
$ret.write_cvalue($fx, ret_val);
|
$ret.write_cvalue($fx, ret_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn lane_type_and_count<'tcx>(
|
fn lane_type_and_count<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
layout: TyLayout<'tcx>,
|
layout: TyLayout<'tcx>,
|
||||||
) -> (TyLayout<'tcx>, u32) {
|
) -> (TyLayout<'tcx>, u32) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub fn codegen_simd_intrinsic_call<'tcx>(
|
pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||||
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
|
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
|
||||||
instance: Instance<'tcx>,
|
instance: Instance<'tcx>,
|
||||||
args: &[mir::Operand<'tcx>],
|
args: &[mir::Operand<'tcx>],
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
use crate::prelude::*;
|
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
|
// FIXME Move the ebb in place instead of remove and append once
|
||||||
// bytecodealliance/cranelift#1339 is implemented.
|
// bytecodealliance/cranelift#1339 is implemented.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user