[meta] Make more things pub(crate) instead of pub;

This could help the compiler find unused fields/methods. It didn't find any
during this migration.
This commit is contained in:
Benjamin Bouvier
2019-09-17 10:57:28 +02:00
parent c2587c9d61
commit f0244516c5
16 changed files with 38 additions and 38 deletions

View File

@@ -8,7 +8,7 @@ use cranelift_entity::{entity_impl, PrimaryMap};
use std::fmt;
pub enum Expr {
pub(crate) enum Expr {
Var(VarIndex),
Literal(Literal),
}
@@ -43,7 +43,7 @@ impl Expr {
}
/// An AST definition associates a set of variables with the values produced by an expression.
pub struct Def {
pub(crate) struct Def {
pub apply: Apply,
pub defined_vars: Vec<VarIndex>,
}
@@ -66,7 +66,7 @@ impl Def {
}
}
pub struct DefPool {
pub(crate) struct DefPool {
pool: PrimaryMap<DefIndex, Def>,
}
@@ -91,11 +91,11 @@ impl DefPool {
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct DefIndex(u32);
pub(crate) struct DefIndex(u32);
entity_impl!(DefIndex);
#[derive(Clone, Debug)]
pub enum Literal {
pub(crate) enum Literal {
/// A value of an enumerated immediate operand.
///
/// Some immediate operand kinds like `intcc` and `floatcc` have an enumerated range of values
@@ -157,7 +157,7 @@ impl Literal {
}
#[derive(Clone, Copy, Debug)]
pub enum PatternPosition {
pub(crate) enum PatternPosition {
Source,
Destination,
}
@@ -179,7 +179,7 @@ pub enum PatternPosition {
/// deleted immediately.
///
/// Temporary values are defined only in the destination pattern.
pub struct Var {
pub(crate) struct Var {
pub name: &'static str,
/// The `Def` defining this variable in a source pattern.
@@ -307,10 +307,10 @@ impl fmt::Debug for Var {
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct VarIndex(u32);
pub(crate) struct VarIndex(u32);
entity_impl!(VarIndex);
pub struct VarPool {
pub(crate) struct VarPool {
pool: PrimaryMap<VarIndex, Var>,
}
@@ -335,7 +335,7 @@ impl VarPool {
///
/// An `Apply` AST expression is created by using function call syntax on instructions. This
/// applies to both bound and unbound polymorphic instructions.
pub struct Apply {
pub(crate) struct Apply {
pub inst: Instruction,
pub args: Vec<Expr>,
pub value_types: Vec<ValueType>,
@@ -506,14 +506,14 @@ impl Apply {
// Simple helpers for legalize actions construction.
pub enum DummyExpr {
pub(crate) enum DummyExpr {
Var(DummyVar),
Literal(Literal),
Apply(InstSpec, Vec<DummyExpr>),
}
#[derive(Clone)]
pub struct DummyVar {
pub(crate) struct DummyVar {
pub name: &'static str,
}
@@ -528,16 +528,16 @@ impl Into<DummyExpr> for Literal {
}
}
pub fn var(name: &'static str) -> DummyVar {
pub(crate) fn var(name: &'static str) -> DummyVar {
DummyVar { name }
}
pub struct DummyDef {
pub(crate) struct DummyDef {
pub expr: DummyExpr,
pub defined_vars: Vec<DummyVar>,
}
pub struct ExprBuilder {
pub(crate) struct ExprBuilder {
expr: DummyExpr,
}

View File

@@ -5,7 +5,7 @@ use crate::cdsl::encodings::Encoding;
use crate::cdsl::types::{LaneType, ValueType};
use crate::cdsl::xform::{TransformGroup, TransformGroupIndex};
pub struct CpuMode {
pub(crate) struct CpuMode {
pub name: &'static str,
default_legalize: Option<TransformGroupIndex>,
monomorphic_legalize: Option<TransformGroupIndex>,

View File

@@ -20,7 +20,7 @@ use crate::cdsl::types::ValueType;
/// 3. With operands providing constraints: `icmp.i32(intcc.eq, x, y)`.
///
/// If the instruction is polymorphic, all type variables must be provided.
pub struct EncodingContent {
pub(crate) struct EncodingContent {
/// The `Instruction` or `BoundInstruction` being encoded.
inst: InstSpec,
@@ -49,9 +49,9 @@ impl EncodingContent {
}
}
pub type Encoding = Rc<EncodingContent>;
pub(crate) type Encoding = Rc<EncodingContent>;
pub struct EncodingBuilder {
pub(crate) struct EncodingBuilder {
inst: InstSpec,
recipe: EncodingRecipeNumber,
encbits: u16,

View File

@@ -8,7 +8,7 @@ use crate::cdsl::regs::IsaRegs;
use crate::cdsl::settings::SettingGroup;
use crate::cdsl::xform::{TransformGroupIndex, TransformGroups};
pub struct TargetIsa {
pub(crate) struct TargetIsa {
pub name: &'static str,
pub instructions: InstructionGroup,
pub settings: SettingGroup,

View File

@@ -122,7 +122,7 @@ enum TypeEnvRank {
}
/// Class encapsulating the necessary bookkeeping for type inference.
pub struct TypeEnvironment {
pub(crate) struct TypeEnvironment {
vars: HashSet<VarIndex>,
ranks: HashMap<TypeVar, TypeEnvRank>,
equivalency_map: HashMap<TypeVar, TypeVar>,
@@ -602,7 +602,7 @@ fn infer_definition(
}
/// Perform type inference on an transformation. Return an updated type environment or error.
pub fn infer_transform(
pub(crate) fn infer_transform(
src: DefIndex,
dst: &Vec<DefIndex>,
def_pool: &DefPool,

View File

@@ -17,7 +17,7 @@ use std::iter::FromIterator;
/// cases when it applies.
///
/// The source pattern can contain only a single instruction.
pub struct Transform {
pub(crate) struct Transform {
pub src: DefIndex,
pub dst: Vec<DefIndex>,
pub var_pool: VarPool,
@@ -268,7 +268,7 @@ fn rewrite_def_list(
}
/// A group of related transformations.
pub struct TransformGroup {
pub(crate) struct TransformGroup {
pub name: &'static str,
pub doc: &'static str,
pub chain_with: Option<TransformGroupIndex>,
@@ -294,10 +294,10 @@ impl TransformGroup {
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TransformGroupIndex(u32);
pub(crate) struct TransformGroupIndex(u32);
entity_impl!(TransformGroupIndex);
pub struct TransformGroupBuilder {
pub(crate) struct TransformGroupBuilder {
name: &'static str,
doc: &'static str,
chain_with: Option<TransformGroupIndex>,
@@ -369,7 +369,7 @@ impl TransformGroupBuilder {
}
}
pub struct TransformGroups {
pub(crate) struct TransformGroups {
groups: PrimaryMap<TransformGroupIndex, TransformGroup>,
}