From 5889dd2c641ac32c6afff7a8f14a2b7d7a89dde9 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 28 Oct 2019 18:13:25 +0100 Subject: [PATCH] [meta] Add more pub(crate) definitions. --- cranelift/codegen/meta/src/cdsl/formats.rs | 2 +- .../codegen/meta/src/cdsl/instructions.rs | 14 +++++----- cranelift/codegen/meta/src/cdsl/operands.rs | 21 +++++---------- cranelift/codegen/meta/src/cdsl/recipes.rs | 8 +++--- cranelift/codegen/meta/src/cdsl/regs.rs | 18 ++++++------- cranelift/codegen/meta/src/cdsl/settings.rs | 26 +++++++++---------- cranelift/codegen/meta/src/cdsl/types.rs | 18 ++++++------- cranelift/codegen/meta/src/cdsl/typevar.rs | 14 +++++----- cranelift/codegen/meta/src/gen_inst.rs | 2 +- cranelift/codegen/meta/src/gen_settings.rs | 2 +- .../codegen/meta/src/isa/x86/registers.rs | 2 +- .../codegen/meta/src/isa/x86/settings.rs | 2 +- cranelift/codegen/meta/src/shared/entities.rs | 20 +++++++------- cranelift/codegen/meta/src/shared/settings.rs | 2 +- cranelift/codegen/meta/src/shared/types.rs | 20 +++++++------- cranelift/codegen/meta/src/srcgen.rs | 4 +-- cranelift/codegen/meta/src/unique_table.rs | 4 +-- 17 files changed, 86 insertions(+), 93 deletions(-) diff --git a/cranelift/codegen/meta/src/cdsl/formats.rs b/cranelift/codegen/meta/src/cdsl/formats.rs index d03929b5f6..bcfc6f5650 100644 --- a/cranelift/codegen/meta/src/cdsl/formats.rs +++ b/cranelift/codegen/meta/src/cdsl/formats.rs @@ -7,7 +7,7 @@ use std::rc::Rc; /// This corresponds to a single member of a variant of the `InstructionData` /// data type. #[derive(Debug)] -pub struct FormatField { +pub(crate) struct FormatField { /// Immediate operand kind. pub kind: OperandKind, diff --git a/cranelift/codegen/meta/src/cdsl/instructions.rs b/cranelift/codegen/meta/src/cdsl/instructions.rs index 416eaebaff..a00d20a386 100644 --- a/cranelift/codegen/meta/src/cdsl/instructions.rs +++ b/cranelift/codegen/meta/src/cdsl/instructions.rs @@ -393,7 +393,7 @@ impl ValueTypeOrAny { type VectorBitWidth = u64; /// An parameter used for binding instructions to specific types or values -pub enum BindParameter { +pub(crate) enum BindParameter { Any, Lane(LaneType), Vector(LaneType, VectorBitWidth), @@ -402,7 +402,7 @@ pub enum BindParameter { } /// Constructor for more easily building vector parameters from any lane type -pub fn vector(parameter: impl Into, vector_size: VectorBitWidth) -> BindParameter { +pub(crate) fn vector(parameter: impl Into, vector_size: VectorBitWidth) -> BindParameter { BindParameter::Vector(parameter.into(), vector_size) } @@ -443,7 +443,7 @@ impl From for BindParameter { } #[derive(Clone)] -pub enum Immediate { +pub(crate) enum Immediate { // When needed, this enum should be expanded to include other immediate types (e.g. u8, u128). IntCC(IntCC), } @@ -750,7 +750,7 @@ fn is_ctrl_typevar_candidate( } #[derive(Clone, Hash, PartialEq, Eq)] -pub enum FormatPredicateKind { +pub(crate) enum FormatPredicateKind { /// Is the field member equal to the expected value (stored here)? IsEqual(String), @@ -791,7 +791,7 @@ pub enum FormatPredicateKind { } #[derive(Clone, Hash, PartialEq, Eq)] -pub struct FormatPredicateNode { +pub(crate) struct FormatPredicateNode { format_name: &'static str, member_name: &'static str, kind: FormatPredicateKind, @@ -879,7 +879,7 @@ impl FormatPredicateNode { } #[derive(Clone, Hash, PartialEq, Eq)] -pub enum TypePredicateNode { +pub(crate) enum TypePredicateNode { /// Is the value argument (at the index designated by the first member) the same type as the /// type name (second member)? TypeVarCheck(usize, String), @@ -905,7 +905,7 @@ impl TypePredicateNode { /// A basic node in an instruction predicate: either an atom, or an AND of two conditions. #[derive(Clone, Hash, PartialEq, Eq)] -pub enum InstructionPredicateNode { +pub(crate) enum InstructionPredicateNode { FormatPredicate(FormatPredicateNode), TypePredicate(TypePredicateNode), diff --git a/cranelift/codegen/meta/src/cdsl/operands.rs b/cranelift/codegen/meta/src/cdsl/operands.rs index 6283b08736..9f821a7a6d 100644 --- a/cranelift/codegen/meta/src/cdsl/operands.rs +++ b/cranelift/codegen/meta/src/cdsl/operands.rs @@ -17,7 +17,7 @@ use crate::cdsl::typevar::TypeVar; /// 4. An `EntityRefKind` instance indicates an operand that references another entity in the /// function, typically something declared in the function preamble. #[derive(Clone, Debug)] -pub struct Operand { +pub(crate) struct Operand { pub name: &'static str, pub doc: Option, pub kind: OperandKind, @@ -75,7 +75,7 @@ impl Operand { } } -pub struct OperandBuilder { +pub(crate) struct OperandBuilder { name: &'static str, doc: Option, kind: OperandKind, @@ -114,7 +114,7 @@ impl OperandBuilder { type EnumValues = HashMap<&'static str, &'static str>; #[derive(Clone, Debug)] -pub enum OperandKindFields { +pub(crate) enum OperandKindFields { EntityRef, VariableArgs, ImmValue, @@ -123,7 +123,7 @@ pub enum OperandKindFields { } #[derive(Clone, Debug)] -pub struct OperandKind { +pub(crate) struct OperandKind { pub name: &'static str, doc: Option, @@ -145,16 +145,9 @@ impl OperandKind { _ => None, } } - - pub fn type_var(&self) -> TypeVar { - match &self.fields { - OperandKindFields::TypeVar(tvar) => tvar.clone(), - _ => panic!("not a typevar"), - } - } } -pub struct OperandKindBuilder { +pub(crate) struct OperandKindBuilder { name: &'static str, doc: Option, @@ -270,12 +263,12 @@ impl Into for &OperandKind { } /// Helper to create an operand in definitions files. -pub fn create_operand(name: &'static str, kind: impl Into) -> Operand { +pub(crate) fn create_operand(name: &'static str, kind: impl Into) -> Operand { OperandBuilder::new(name, kind.into()).build() } /// Helper to create an operand with a documentation in definitions files. -pub fn create_operand_doc( +pub(crate) fn create_operand_doc( name: &'static str, kind: impl Into, doc: &'static str, diff --git a/cranelift/codegen/meta/src/cdsl/recipes.rs b/cranelift/codegen/meta/src/cdsl/recipes.rs index 4aad4debe2..9bb966f605 100644 --- a/cranelift/codegen/meta/src/cdsl/recipes.rs +++ b/cranelift/codegen/meta/src/cdsl/recipes.rs @@ -18,7 +18,7 @@ use crate::cdsl::settings::SettingPredicateNumber; /// Register instances can be created with the constructor, or accessed as /// attributes on the register class: `GPR.rcx`. #[derive(Copy, Clone, Hash, PartialEq, Eq)] -pub struct Register { +pub(crate) struct Register { pub regclass: RegClassIndex, pub unit: u8, } @@ -34,7 +34,7 @@ impl Register { /// A `Stack` object can be used to indicate an operand constraint for a value /// operand that must live in a stack slot. #[derive(Copy, Clone, Hash, PartialEq)] -pub struct Stack { +pub(crate) struct Stack { pub regclass: RegClassIndex, } @@ -49,13 +49,13 @@ impl Stack { } #[derive(Clone, Hash, PartialEq)] -pub struct BranchRange { +pub(crate) struct BranchRange { pub inst_size: u64, pub range: u64, } #[derive(Copy, Clone, Hash, PartialEq)] -pub enum OperandConstraint { +pub(crate) enum OperandConstraint { RegClass(RegClassIndex), FixedReg(Register), TiedInput(usize), diff --git a/cranelift/codegen/meta/src/cdsl/regs.rs b/cranelift/codegen/meta/src/cdsl/regs.rs index 69efe6b660..98a5751f2e 100644 --- a/cranelift/codegen/meta/src/cdsl/regs.rs +++ b/cranelift/codegen/meta/src/cdsl/regs.rs @@ -2,10 +2,10 @@ use cranelift_codegen_shared::constants; use cranelift_entity::{entity_impl, EntityRef, PrimaryMap}; #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct RegBankIndex(u32); +pub(crate) struct RegBankIndex(u32); entity_impl!(RegBankIndex); -pub struct RegBank { +pub(crate) struct RegBank { pub name: &'static str, pub first_unit: u8, pub units: u8, @@ -73,10 +73,10 @@ impl RegBank { } #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] -pub struct RegClassIndex(u32); +pub(crate) struct RegClassIndex(u32); entity_impl!(RegClassIndex); -pub struct RegClass { +pub(crate) struct RegClass { pub name: &'static str, pub index: RegClassIndex, pub width: u8, @@ -130,12 +130,12 @@ impl RegClass { } } -pub enum RegClassProto { +pub(crate) enum RegClassProto { TopLevel(RegBankIndex), SubClass(RegClassIndex), } -pub struct RegClassBuilder { +pub(crate) struct RegClassBuilder { pub name: &'static str, pub width: u8, pub count: u8, @@ -181,7 +181,7 @@ impl RegClassBuilder { } } -pub struct RegBankBuilder { +pub(crate) struct RegBankBuilder { pub name: &'static str, pub units: u8, pub names: Vec<&'static str>, @@ -220,7 +220,7 @@ impl RegBankBuilder { } } -pub struct IsaRegsBuilder { +pub(crate) struct IsaRegsBuilder { pub banks: PrimaryMap, pub classes: PrimaryMap, } @@ -384,7 +384,7 @@ impl IsaRegsBuilder { } } -pub struct IsaRegs { +pub(crate) struct IsaRegs { pub banks: PrimaryMap, pub classes: PrimaryMap, } diff --git a/cranelift/codegen/meta/src/cdsl/settings.rs b/cranelift/codegen/meta/src/cdsl/settings.rs index 3d56fa9839..217bad9955 100644 --- a/cranelift/codegen/meta/src/cdsl/settings.rs +++ b/cranelift/codegen/meta/src/cdsl/settings.rs @@ -1,24 +1,24 @@ use std::iter; #[derive(Clone, Copy, Hash, PartialEq, Eq)] -pub struct BoolSettingIndex(usize); +pub(crate) struct BoolSettingIndex(usize); #[derive(Hash, PartialEq, Eq)] -pub struct BoolSetting { +pub(crate) struct BoolSetting { pub default: bool, pub bit_offset: u8, pub predicate_number: u8, } #[derive(Hash, PartialEq, Eq)] -pub enum SpecificSetting { +pub(crate) enum SpecificSetting { Bool(BoolSetting), Enum(Vec<&'static str>), Num(u8), } #[derive(Hash, PartialEq, Eq)] -pub struct Setting { +pub(crate) struct Setting { pub name: &'static str, pub comment: &'static str, pub specific: SpecificSetting, @@ -66,10 +66,10 @@ impl Setting { } #[derive(Hash, PartialEq, Eq)] -pub struct PresetIndex(usize); +pub(crate) struct PresetIndex(usize); #[derive(Hash, PartialEq, Eq)] -pub enum PresetType { +pub(crate) enum PresetType { BoolSetting(BoolSettingIndex), OtherPreset(PresetIndex), } @@ -86,7 +86,7 @@ impl Into for PresetIndex { } #[derive(Hash, PartialEq, Eq)] -pub struct Preset { +pub(crate) struct Preset { pub name: &'static str, values: Vec, } @@ -110,7 +110,7 @@ impl Preset { } } -pub struct SettingGroup { +pub(crate) struct SettingGroup { pub name: &'static str, pub settings: Vec, pub bool_start_byte_offset: u8, @@ -160,7 +160,7 @@ impl SettingGroup { /// This is the basic information needed to track the specific parts of a setting when building /// them. -pub enum ProtoSpecificSetting { +pub(crate) enum ProtoSpecificSetting { Bool(bool), Enum(Vec<&'static str>), Num(u8), @@ -174,7 +174,7 @@ struct ProtoSetting { } #[derive(Hash, PartialEq, Eq)] -pub enum PredicateNode { +pub(crate) enum PredicateNode { OwnedBool(BoolSettingIndex), SharedBool(&'static str, &'static str), Not(Box), @@ -217,9 +217,9 @@ struct ProtoPredicate { node: PredicateNode, } -pub type SettingPredicateNumber = u8; +pub(crate) type SettingPredicateNumber = u8; -pub struct Predicate { +pub(crate) struct Predicate { pub name: &'static str, node: PredicateNode, pub number: SettingPredicateNumber, @@ -231,7 +231,7 @@ impl Predicate { } } -pub struct SettingGroupBuilder { +pub(crate) struct SettingGroupBuilder { name: &'static str, settings: Vec, presets: Vec, diff --git a/cranelift/codegen/meta/src/cdsl/types.rs b/cranelift/codegen/meta/src/cdsl/types.rs index 83faa538c3..9e0556a850 100644 --- a/cranelift/codegen/meta/src/cdsl/types.rs +++ b/cranelift/codegen/meta/src/cdsl/types.rs @@ -15,7 +15,7 @@ static _RUST_NAME_PREFIX: &str = "ir::types::"; /// All SSA values have a type that is described by an instance of `ValueType` /// or one of its subclasses. #[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub enum ValueType { +pub(crate) enum ValueType { BV(BVType), Lane(LaneType), Reference(ReferenceType), @@ -151,7 +151,7 @@ impl From for ValueType { /// A concrete scalar type that can appear as a vector lane too. #[derive(Clone, Copy, PartialEq, Eq, Hash)] -pub enum LaneType { +pub(crate) enum LaneType { BoolType(shared_types::Bool), FloatType(shared_types::Float), IntType(shared_types::Int), @@ -319,7 +319,7 @@ impl From for LaneType { } /// An iterator for different lane types. -pub struct LaneTypeIterator { +pub(crate) struct LaneTypeIterator { bool_iter: shared_types::BoolIterator, int_iter: shared_types::IntIterator, float_iter: shared_types::FloatIterator, @@ -356,7 +356,7 @@ impl Iterator for LaneTypeIterator { /// A vector type has a lane type which is an instance of `LaneType`, /// and a positive number of lanes. #[derive(Clone, PartialEq, Eq, Hash)] -pub struct VectorType { +pub(crate) struct VectorType { base: LaneType, lanes: u64, } @@ -422,7 +422,7 @@ impl fmt::Debug for VectorType { /// A flat bitvector type. Used for semantics description only. #[derive(Clone, PartialEq, Eq, Hash)] -pub struct BVType { +pub(crate) struct BVType { bits: u64, } @@ -459,7 +459,7 @@ impl fmt::Debug for BVType { /// /// Special types cannot be used to form vectors. #[derive(Clone, Copy, PartialEq, Eq, Hash)] -pub enum SpecialType { +pub(crate) enum SpecialType { Flag(shared_types::Flag), } @@ -521,7 +521,7 @@ impl From for SpecialType { } } -pub struct SpecialTypeIterator { +pub(crate) struct SpecialTypeIterator { flag_iter: shared_types::FlagIterator, } @@ -546,7 +546,7 @@ impl Iterator for SpecialTypeIterator { /// Reference type is scalar type, but not lane type. #[derive(Clone, Copy, PartialEq, Eq, Hash)] -pub struct ReferenceType(pub shared_types::Reference); +pub(crate) struct ReferenceType(pub shared_types::Reference); impl ReferenceType { /// Return a string containing the documentation comment for this reference type. @@ -600,7 +600,7 @@ impl From for ReferenceType { } /// An iterator for different reference types. -pub struct ReferenceTypeIterator { +pub(crate) struct ReferenceTypeIterator { reference_iter: shared_types::ReferenceIterator, } diff --git a/cranelift/codegen/meta/src/cdsl/typevar.rs b/cranelift/codegen/meta/src/cdsl/typevar.rs index 947d0dd82d..03fb52a4ad 100644 --- a/cranelift/codegen/meta/src/cdsl/typevar.rs +++ b/cranelift/codegen/meta/src/cdsl/typevar.rs @@ -21,7 +21,7 @@ const MAX_BITVEC: u16 = MAX_BITS * MAX_LANES; /// types and whether the type variable can assume scalar or vector types, or /// both. #[derive(Debug)] -pub struct TypeVarContent { +pub(crate) struct TypeVarContent { /// Short name of type variable used in instruction descriptions. pub name: String, @@ -37,7 +37,7 @@ pub struct TypeVarContent { } #[derive(Clone, Debug)] -pub struct TypeVar { +pub(crate) struct TypeVar { content: Rc>, } @@ -336,7 +336,7 @@ impl ops::Deref for TypeVar { } #[derive(Clone, Copy, Debug, Hash, PartialEq)] -pub enum DerivedFunc { +pub(crate) enum DerivedFunc { LaneOf, AsBool, HalfWidth, @@ -372,7 +372,7 @@ impl DerivedFunc { } #[derive(Debug, Hash)] -pub struct TypeVarParent { +pub(crate) struct TypeVarParent { pub type_var: TypeVar, pub derived_func: DerivedFunc, } @@ -406,7 +406,7 @@ macro_rules! num_set { } #[derive(Clone, PartialEq, Eq, Hash)] -pub struct TypeSet { +pub(crate) struct TypeSet { pub lanes: NumSet, pub ints: NumSet, pub floats: NumSet, @@ -784,7 +784,7 @@ impl fmt::Debug for TypeSet { } } -pub struct TypeSetBuilder { +pub(crate) struct TypeSetBuilder { ints: Interval, floats: Interval, bools: Interval, @@ -883,7 +883,7 @@ impl TypeSetBuilder { } #[derive(PartialEq)] -pub enum Interval { +pub(crate) enum Interval { None, All, Range(Range), diff --git a/cranelift/codegen/meta/src/gen_inst.rs b/cranelift/codegen/meta/src/gen_inst.rs index b5d2454881..adf5589227 100644 --- a/cranelift/codegen/meta/src/gen_inst.rs +++ b/cranelift/codegen/meta/src/gen_inst.rs @@ -664,7 +664,7 @@ fn typeset_to_string(ts: &TypeSet) -> String { } /// Generate the table of ValueTypeSets described by type_sets. -pub fn gen_typesets_table(type_sets: &UniqueTable, fmt: &mut Formatter) { +pub(crate) fn gen_typesets_table(type_sets: &UniqueTable, fmt: &mut Formatter) { if type_sets.len() == 0 { return; } diff --git a/cranelift/codegen/meta/src/gen_settings.rs b/cranelift/codegen/meta/src/gen_settings.rs index f8b5792ef1..a40afbdf4a 100644 --- a/cranelift/codegen/meta/src/gen_settings.rs +++ b/cranelift/codegen/meta/src/gen_settings.rs @@ -10,7 +10,7 @@ use crate::error; use crate::srcgen::{Formatter, Match}; use crate::unique_table::UniqueSeqTable; -pub enum ParentGroup { +pub(crate) enum ParentGroup { None, Shared, } diff --git a/cranelift/codegen/meta/src/isa/x86/registers.rs b/cranelift/codegen/meta/src/isa/x86/registers.rs index 4157084c15..5c31401a3c 100644 --- a/cranelift/codegen/meta/src/isa/x86/registers.rs +++ b/cranelift/codegen/meta/src/isa/x86/registers.rs @@ -1,6 +1,6 @@ use crate::cdsl::regs::{IsaRegs, IsaRegsBuilder, RegBankBuilder, RegClassBuilder}; -pub fn define() -> IsaRegs { +pub(crate) fn define() -> IsaRegs { let mut regs = IsaRegsBuilder::new(); let builder = RegBankBuilder::new("IntRegs", "r") diff --git a/cranelift/codegen/meta/src/isa/x86/settings.rs b/cranelift/codegen/meta/src/isa/x86/settings.rs index 10cb516207..bef8fc3f81 100644 --- a/cranelift/codegen/meta/src/isa/x86/settings.rs +++ b/cranelift/codegen/meta/src/isa/x86/settings.rs @@ -1,6 +1,6 @@ use crate::cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder}; -pub fn define(shared: &SettingGroup) -> SettingGroup { +pub(crate) fn define(shared: &SettingGroup) -> SettingGroup { let mut settings = SettingGroupBuilder::new("x86"); // CPUID.01H:ECX diff --git a/cranelift/codegen/meta/src/shared/entities.rs b/cranelift/codegen/meta/src/shared/entities.rs index 910722789b..631e0855d2 100644 --- a/cranelift/codegen/meta/src/shared/entities.rs +++ b/cranelift/codegen/meta/src/shared/entities.rs @@ -1,35 +1,35 @@ use crate::cdsl::operands::{OperandKind, OperandKindBuilder as Builder, OperandKindFields}; -pub struct EntityRefs { +pub(crate) struct EntityRefs { /// A reference to an extended basic block in the same function. /// This is primarliy used in control flow instructions. - pub ebb: OperandKind, + pub(crate) ebb: OperandKind, /// A reference to a stack slot declared in the function preamble. - pub stack_slot: OperandKind, + pub(crate) stack_slot: OperandKind, /// A reference to a global value. - pub global_value: OperandKind, + pub(crate) global_value: OperandKind, /// A reference to a function signature declared in the function preamble. /// This is used to provide the call signature in a call_indirect instruction. - pub sig_ref: OperandKind, + pub(crate) sig_ref: OperandKind, /// A reference to an external function declared in the function preamble. /// This is used to provide the callee and signature in a call instruction. - pub func_ref: OperandKind, + pub(crate) func_ref: OperandKind, /// A reference to a jump table declared in the function preamble. - pub jump_table: OperandKind, + pub(crate) jump_table: OperandKind, /// A reference to a heap declared in the function preamble. - pub heap: OperandKind, + pub(crate) heap: OperandKind, /// A reference to a table declared in the function preamble. - pub table: OperandKind, + pub(crate) table: OperandKind, /// A variable-sized list of value operands. Use for Ebb and function call arguments. - pub varargs: OperandKind, + pub(crate) varargs: OperandKind, } impl EntityRefs { diff --git a/cranelift/codegen/meta/src/shared/settings.rs b/cranelift/codegen/meta/src/shared/settings.rs index 43fe357ab7..e375a8e66e 100644 --- a/cranelift/codegen/meta/src/shared/settings.rs +++ b/cranelift/codegen/meta/src/shared/settings.rs @@ -1,6 +1,6 @@ use crate::cdsl::settings::{SettingGroup, SettingGroupBuilder}; -pub fn define() -> SettingGroup { +pub(crate) fn define() -> SettingGroup { let mut settings = SettingGroupBuilder::new("shared"); settings.add_enum( diff --git a/cranelift/codegen/meta/src/shared/types.rs b/cranelift/codegen/meta/src/shared/types.rs index 52fa9545c6..631e5433e9 100644 --- a/cranelift/codegen/meta/src/shared/types.rs +++ b/cranelift/codegen/meta/src/shared/types.rs @@ -1,7 +1,7 @@ //! This module predefines all the Cranelift scalar types. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] -pub enum Bool { +pub(crate) enum Bool { /// 1-bit bool. B1 = 1, /// 8-bit bool. @@ -17,7 +17,7 @@ pub enum Bool { } /// This provides an iterator through all of the supported bool variants. -pub struct BoolIterator { +pub(crate) struct BoolIterator { index: u8, } @@ -45,7 +45,7 @@ impl Iterator for BoolIterator { } #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] -pub enum Int { +pub(crate) enum Int { /// 8-bit int. I8 = 8, /// 16-bit int. @@ -59,7 +59,7 @@ pub enum Int { } /// This provides an iterator through all of the supported int variants. -pub struct IntIterator { +pub(crate) struct IntIterator { index: u8, } @@ -86,13 +86,13 @@ impl Iterator for IntIterator { } #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] -pub enum Float { +pub(crate) enum Float { F32 = 32, F64 = 64, } /// Iterator through the variants of the Float enum. -pub struct FloatIterator { +pub(crate) struct FloatIterator { index: u8, } @@ -120,7 +120,7 @@ impl Iterator for FloatIterator { /// /// Flags can't be stored in memory. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] -pub enum Flag { +pub(crate) enum Flag { /// CPU flags from an integer comparison. IFlags, /// CPU flags from a floating point comparison. @@ -128,7 +128,7 @@ pub enum Flag { } /// Iterator through the variants of the Flag enum. -pub struct FlagIterator { +pub(crate) struct FlagIterator { index: u8, } @@ -152,7 +152,7 @@ impl Iterator for FlagIterator { } #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] -pub enum Reference { +pub(crate) enum Reference { /// 32-bit reference. R32 = 32, /// 64-bit reference. @@ -160,7 +160,7 @@ pub enum Reference { } /// This provides an iterator through all of the supported reference variants. -pub struct ReferenceIterator { +pub(crate) struct ReferenceIterator { index: u8, } diff --git a/cranelift/codegen/meta/src/srcgen.rs b/cranelift/codegen/meta/src/srcgen.rs index 5a11d1d785..ad8db175d7 100644 --- a/cranelift/codegen/meta/src/srcgen.rs +++ b/cranelift/codegen/meta/src/srcgen.rs @@ -35,7 +35,7 @@ macro_rules! fmtln { }; } -pub struct Formatter { +pub(crate) struct Formatter { indent: usize, lines: Vec, } @@ -260,7 +260,7 @@ fn parse_multiline(s: &str) -> Vec { /// Note that this class is ignorant of Rust types, and considers two fields /// with the same name to be equivalent. BTreeMap/BTreeSet are used to /// represent the arms in order to make the order deterministic. -pub struct Match { +pub(crate) struct Match { expr: String, arms: BTreeMap<(Vec, String), BTreeSet>, /// The clause for the placeholder pattern _. diff --git a/cranelift/codegen/meta/src/unique_table.rs b/cranelift/codegen/meta/src/unique_table.rs index 7bc694fe26..949aa6b9d3 100644 --- a/cranelift/codegen/meta/src/unique_table.rs +++ b/cranelift/codegen/meta/src/unique_table.rs @@ -3,7 +3,7 @@ use std::hash::Hash; use std::slice; /// Collect items into the `table` list, removing duplicates. -pub struct UniqueTable<'entries, T: Eq + Hash> { +pub(crate) struct UniqueTable<'entries, T: Eq + Hash> { table: Vec<&'entries T>, map: HashMap<&'entries T, usize>, } @@ -40,7 +40,7 @@ impl<'entries, T: Eq + Hash> UniqueTable<'entries, T> { } /// A table of sequences which tries to avoid common subsequences. -pub struct UniqueSeqTable { +pub(crate) struct UniqueSeqTable { table: Vec, }