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