diff --git a/cranelift/codegen/meta/src/cdsl/instructions.rs b/cranelift/codegen/meta/src/cdsl/instructions.rs index 699e30cb3f..0d27159cd9 100644 --- a/cranelift/codegen/meta/src/cdsl/instructions.rs +++ b/cranelift/codegen/meta/src/cdsl/instructions.rs @@ -18,12 +18,12 @@ use crate::shared::types::{Bool, Float, Int, Reference}; use cranelift_codegen_shared::condcodes::IntCC; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct OpcodeNumber(u32); +pub(crate) struct OpcodeNumber(u32); entity_impl!(OpcodeNumber); -pub type AllInstructions = PrimaryMap; +pub(crate) type AllInstructions = PrimaryMap; -pub struct InstructionGroupBuilder<'format_reg, 'all_inst> { +pub(crate) struct InstructionGroupBuilder<'format_reg, 'all_inst> { _name: &'static str, _doc: &'static str, format_registry: &'format_reg FormatRegistry, @@ -67,7 +67,7 @@ impl<'format_reg, 'all_inst> InstructionGroupBuilder<'format_reg, 'all_inst> { /// Every instruction must belong to exactly one instruction group. A given /// target architecture can support instructions from multiple groups, and it /// does not necessarily support all instructions in a group. -pub struct InstructionGroup { +pub(crate) struct InstructionGroup { _name: &'static str, _doc: &'static str, instructions: Vec, @@ -85,20 +85,20 @@ impl InstructionGroup { /// Instructions can have parameters bound to them to specialize them for more specific encodings /// (e.g. the encoding for adding two float types may be different than that of adding two /// integer types) -pub trait Bindable { +pub(crate) trait Bindable { /// Bind a parameter to an instruction fn bind(&self, parameter: impl Into) -> BoundInstruction; } #[derive(Debug)] -pub struct PolymorphicInfo { +pub(crate) struct PolymorphicInfo { pub use_typevar_operand: bool, pub ctrl_typevar: TypeVar, pub other_typevars: Vec, } #[derive(Debug)] -pub struct InstructionContent { +pub(crate) struct InstructionContent { /// Instruction mnemonic, also becomes opcode name. pub name: String, pub camel_name: String, @@ -153,7 +153,7 @@ pub struct InstructionContent { } #[derive(Clone, Debug)] -pub struct Instruction { +pub(crate) struct Instruction { content: Rc, } @@ -221,7 +221,7 @@ impl fmt::Display for Instruction { } } -pub struct InstructionBuilder { +pub(crate) struct InstructionBuilder { name: String, doc: String, operands_in: Option>, @@ -384,7 +384,7 @@ impl InstructionBuilder { /// A thin wrapper like Option, but with more precise semantics. #[derive(Clone)] -pub enum ValueTypeOrAny { +pub(crate) enum ValueTypeOrAny { ValueType(ValueType), Any, } @@ -467,7 +467,7 @@ impl Display for Immediate { } #[derive(Clone)] -pub struct BoundInstruction { +pub(crate) struct BoundInstruction { pub inst: Instruction, pub value_types: Vec, pub immediate_values: Vec, @@ -941,7 +941,7 @@ impl InstructionPredicateNode { } #[derive(Clone, Hash, PartialEq, Eq)] -pub struct InstructionPredicate { +pub(crate) struct InstructionPredicate { node: Option, } @@ -1191,15 +1191,16 @@ impl InstructionPredicate { } #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct InstructionPredicateNumber(u32); +pub(crate) struct InstructionPredicateNumber(u32); entity_impl!(InstructionPredicateNumber); -pub type InstructionPredicateMap = PrimaryMap; +pub(crate) type InstructionPredicateMap = + PrimaryMap; /// A registry of predicates to help deduplicating them, during Encodings construction. When the /// construction process is over, it needs to be extracted with `extract` and associated to the /// TargetIsa. -pub struct InstructionPredicateRegistry { +pub(crate) struct InstructionPredicateRegistry { /// Maps a predicate number to its actual predicate. map: InstructionPredicateMap, @@ -1231,7 +1232,7 @@ impl InstructionPredicateRegistry { } /// An instruction specification, containing an instruction that has bound types or not. -pub enum InstSpec { +pub(crate) enum InstSpec { Inst(Instruction), Bound(BoundInstruction), } diff --git a/cranelift/codegen/meta/src/cdsl/recipes.rs b/cranelift/codegen/meta/src/cdsl/recipes.rs index 8157e08864..ed31cbbfd8 100644 --- a/cranelift/codegen/meta/src/cdsl/recipes.rs +++ b/cranelift/codegen/meta/src/cdsl/recipes.rs @@ -103,7 +103,7 @@ impl Into for Stack { /// branch instructions. It is an `(origin, bits)` tuple describing the exact /// range that can be encoded in a branch instruction. #[derive(Clone)] -pub struct EncodingRecipe { +pub(crate) struct EncodingRecipe { /// Short mnemonic name for this recipe. pub name: String, @@ -158,13 +158,13 @@ impl PartialEq for EncodingRecipe { impl Eq for EncodingRecipe {} #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct EncodingRecipeNumber(u32); +pub(crate) struct EncodingRecipeNumber(u32); entity_impl!(EncodingRecipeNumber); -pub type Recipes = PrimaryMap; +pub(crate) type Recipes = PrimaryMap; #[derive(Clone)] -pub struct EncodingRecipeBuilder { +pub(crate) struct EncodingRecipeBuilder { pub name: String, format: InstructionFormatIndex, pub base_size: u64, diff --git a/cranelift/codegen/meta/src/cdsl/type_inference.rs b/cranelift/codegen/meta/src/cdsl/type_inference.rs index 5181739969..9cb894d911 100644 --- a/cranelift/codegen/meta/src/cdsl/type_inference.rs +++ b/cranelift/codegen/meta/src/cdsl/type_inference.rs @@ -5,7 +5,7 @@ use std::collections::{HashMap, HashSet}; use std::iter::FromIterator; #[derive(Debug, Hash, PartialEq, Eq)] -pub enum Constraint { +pub(crate) enum Constraint { /// Constraint specifying that a type var tv1 must be wider than or equal to type var tv2 at /// runtime. This requires that: /// 1) They have the same number of lanes diff --git a/cranelift/codegen/meta/src/isa/riscv/recipes.rs b/cranelift/codegen/meta/src/isa/riscv/recipes.rs index f32bbd568c..b1297479ec 100644 --- a/cranelift/codegen/meta/src/isa/riscv/recipes.rs +++ b/cranelift/codegen/meta/src/isa/riscv/recipes.rs @@ -7,7 +7,7 @@ use crate::cdsl::regs::IsaRegs; use crate::shared::Definitions as SharedDefinitions; /// An helper to create recipes and use them when defining the RISCV encodings. -pub struct RecipeGroup<'formats> { +pub(crate) struct RecipeGroup<'formats> { /// Memoized format registry, to pass it to the builders. formats: &'formats FormatRegistry, diff --git a/cranelift/codegen/meta/src/isa/x86/recipes.rs b/cranelift/codegen/meta/src/isa/x86/recipes.rs index ce0999c04c..8063e9441f 100644 --- a/cranelift/codegen/meta/src/isa/x86/recipes.rs +++ b/cranelift/codegen/meta/src/isa/x86/recipes.rs @@ -164,7 +164,7 @@ fn replace_nonrex_constraints( /// Encodings, in encodings.rs. This is an idiosyncrasy of the x86 meta-language, and could be /// reconsidered later. #[derive(Clone)] -pub struct Template<'builder> { +pub(crate) struct Template<'builder> { /// Mapping of format indexes to format data, used in the build() method. formats: &'builder FormatRegistry,