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