Minir typo/Grammar fixes (#6187)
* fix typo * add test to check that Option<EntityRef> is twice as large as EntityRef * grammar * grammar * reverse snakecase -- Not sure if folks want this type of change
This commit is contained in:
@@ -138,10 +138,10 @@ pub struct DataFlowGraph {
|
|||||||
/// Saves Value labels.
|
/// Saves Value labels.
|
||||||
pub values_labels: Option<BTreeMap<Value, ValueLabelAssignments>>,
|
pub values_labels: Option<BTreeMap<Value, ValueLabelAssignments>>,
|
||||||
|
|
||||||
/// Constants used within the function
|
/// Constants used within the function.
|
||||||
pub constants: ConstantPool,
|
pub constants: ConstantPool,
|
||||||
|
|
||||||
/// Stores large immediates that otherwise will not fit on InstructionData
|
/// Stores large immediates that otherwise will not fit on InstructionData.
|
||||||
pub immediates: PrimaryMap<Immediate, ConstantData>,
|
pub immediates: PrimaryMap<Immediate, ConstantData>,
|
||||||
|
|
||||||
/// Jump tables used in this function.
|
/// Jump tables used in this function.
|
||||||
@@ -275,12 +275,12 @@ fn resolve_aliases(values: &PrimaryMap<Value, ValueDataPacked>, value: Value) ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterator over all Values in a DFG
|
/// Iterator over all Values in a DFG.
|
||||||
pub struct Values<'a> {
|
pub struct Values<'a> {
|
||||||
inner: entity::Iter<'a, Value, ValueDataPacked>,
|
inner: entity::Iter<'a, Value, ValueDataPacked>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check for non-values
|
/// Check for non-values.
|
||||||
fn valid_valuedata(data: ValueDataPacked) -> bool {
|
fn valid_valuedata(data: ValueDataPacked) -> bool {
|
||||||
let data = ValueData::from(data);
|
let data = ValueData::from(data);
|
||||||
if let ValueData::Alias {
|
if let ValueData::Alias {
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ entity_impl!(UserExternalNameRef, "userextname");
|
|||||||
/// An opaque reference to a function [`Signature`](super::Signature).
|
/// An opaque reference to a function [`Signature`](super::Signature).
|
||||||
///
|
///
|
||||||
/// `SigRef`s are used to declare a function with
|
/// `SigRef`s are used to declare a function with
|
||||||
/// [`FunctionBuiler::import_function`](https://docs.rs/cranelift-frontend/*/cranelift_frontend/struct.FunctionBuilder.html#method.import_function)
|
/// [`FunctionBuilder::import_function`](https://docs.rs/cranelift-frontend/*/cranelift_frontend/struct.FunctionBuilder.html#method.import_function)
|
||||||
/// as well as to make an [indirect function call](super::InstBuilder::call_indirect).
|
/// as well as to make an [indirect function call](super::InstBuilder::call_indirect).
|
||||||
///
|
///
|
||||||
/// `SigRef`s can be created with
|
/// `SigRef`s can be created with
|
||||||
@@ -551,6 +551,14 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn memory_option() {
|
||||||
|
use core::mem;
|
||||||
|
// PackedOption is used because Option<EntityRef> is twice as large
|
||||||
|
// as EntityRef. If this ever fails to be the case, this test will fail.
|
||||||
|
assert_eq!(mem::size_of::<Value>() * 2, mem::size_of::<Option<Value>>());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn constant_with_number() {
|
fn constant_with_number() {
|
||||||
assert_eq!(Constant::with_number(0).unwrap().to_string(), "const0");
|
assert_eq!(Constant::with_number(0).unwrap().to_string(), "const0");
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ impl FunctionStencil {
|
|||||||
self.global_values.push(data)
|
self.global_values.push(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the global dyn_scale value associated with given DynamicType
|
/// Find the global dyn_scale value associated with given DynamicType.
|
||||||
pub fn get_dyn_scale(&self, ty: DynamicType) -> GlobalValue {
|
pub fn get_dyn_scale(&self, ty: DynamicType) -> GlobalValue {
|
||||||
self.dfg.dynamic_types.get(ty).unwrap().dynamic_scale
|
self.dfg.dynamic_types.get(ty).unwrap().dynamic_scale
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ pub struct JumpTableData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl JumpTableData {
|
impl JumpTableData {
|
||||||
/// Create a new jump table with the provided blocks
|
/// Create a new jump table with the provided blocks.
|
||||||
pub fn new(def: BlockCall, table: &[BlockCall]) -> Self {
|
pub fn new(def: BlockCall, table: &[BlockCall]) -> Self {
|
||||||
Self {
|
Self {
|
||||||
table: std::iter::once(def).chain(table.iter().copied()).collect(),
|
table: std::iter::once(def).chain(table.iter().copied()).collect(),
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ impl Layout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A single node in the linked-list of blocks.
|
/// A single node in the linked-list of blocks.
|
||||||
// Whenever you add new fields here, don't forget to update the custom serializer for `Layout` too.
|
// **Note:** Whenever you add new fields here, don't forget to update the custom serializer for `Layout` too.
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Hash)]
|
#[derive(Clone, Debug, Default, PartialEq, Hash)]
|
||||||
struct BlockNode {
|
struct BlockNode {
|
||||||
prev: PackedOption<Block>,
|
prev: PackedOption<Block>,
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ pub struct ValueLabelStart {
|
|||||||
pub label: ValueLabel,
|
pub label: ValueLabel,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Value label assignements: label starts or value aliases.
|
/// Value label assignments: label starts or value aliases.
|
||||||
#[derive(Debug, Clone, PartialEq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Hash)]
|
||||||
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
|
||||||
pub enum ValueLabelAssignments {
|
pub enum ValueLabelAssignments {
|
||||||
|
|||||||
Reference in New Issue
Block a user