Speling.
This commit is contained in:
@@ -13,7 +13,7 @@ use ir::condcodes::{IntCC, FloatCC};
|
||||
///
|
||||
/// The `InstBuilderBase` trait provides the basic functionality required by the methods of the
|
||||
/// generated `InstBuilder` trait. These methods should not normally be used directly. Use the
|
||||
/// methods in the `InstBuilder trait instead.
|
||||
/// methods in the `InstBuilder` trait instead.
|
||||
///
|
||||
/// Any data type that implements `InstBuilderBase` also gets all the methods of the `InstBuilder`
|
||||
/// trait.
|
||||
@@ -104,7 +104,7 @@ impl<'c, 'fc, 'fd> InstBuilderBase<'fd> for InsertBuilder<'c, 'fc, 'fd> {
|
||||
///
|
||||
/// If the old instruction still has secondary result values attached, it is assumed that the new
|
||||
/// instruction produces the same number and types of results. The old secondary values are
|
||||
/// preserved. If the replacemant instruction format does not support multiple results, the builder
|
||||
/// preserved. If the replacement instruction format does not support multiple results, the builder
|
||||
/// panics. It is a bug to leave result values dangling.
|
||||
///
|
||||
/// If the old instruction was capable of producing secondary results, but the values have been
|
||||
|
||||
@@ -12,7 +12,7 @@ use packed_option::PackedOption;
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::u16;
|
||||
|
||||
/// A data flow graph defines all instuctions and extended basic blocks in a function as well as
|
||||
/// A data flow graph defines all instructions and extended basic blocks in a function as well as
|
||||
/// the data flow dependencies between them. The DFG also tracks values which can be either
|
||||
/// instruction results or EBB arguments.
|
||||
///
|
||||
@@ -213,7 +213,7 @@ impl DataFlowGraph {
|
||||
original: original,
|
||||
};
|
||||
} else {
|
||||
panic!("Cannot change dirrect value {} into an alias", dest);
|
||||
panic!("Cannot change direct value {} into an alias", dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,7 +328,7 @@ impl DataFlowGraph {
|
||||
|
||||
// Additional values form a linked list starting from the second result value. Generate
|
||||
// the list backwards so we don't have to modify value table entries in place. (This
|
||||
// causes additional result values to be numbered backwards which is not the aestetic
|
||||
// causes additional result values to be numbered backwards which is not the aesthetic
|
||||
// choice, but since it is only visible in extremely rare instructions with 3+ results,
|
||||
// we don't care).
|
||||
let mut head = None;
|
||||
@@ -498,7 +498,7 @@ impl DataFlowGraph {
|
||||
return num as usize + 1;
|
||||
}
|
||||
}
|
||||
panic!("inconsistent value table entry for EBB arg");
|
||||
panic!("inconsistent value table entry for EBB argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,7 +514,7 @@ impl DataFlowGraph {
|
||||
next: None.into(),
|
||||
});
|
||||
match self.ebbs[ebb].last_arg.expand() {
|
||||
// If last_arg is `None`, we're adding the first EBB argument.
|
||||
// If last_argument is `None`, we're adding the first EBB argument.
|
||||
None => {
|
||||
self.ebbs[ebb].first_arg = val.into();
|
||||
}
|
||||
@@ -525,11 +525,11 @@ impl DataFlowGraph {
|
||||
if let ValueData::Arg { ref mut next, .. } = self.extended_values[idx] {
|
||||
*next = val.into();
|
||||
} else {
|
||||
panic!("inconsistent value table entry for EBB arg");
|
||||
panic!("inconsistent value table entry for EBB argument");
|
||||
}
|
||||
}
|
||||
ExpandedValue::Direct(_) => {
|
||||
panic!("inconsistent value table entry for EBB arg")
|
||||
panic!("inconsistent value table entry for EBB argument")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -556,7 +556,7 @@ impl DataFlowGraph {
|
||||
struct EbbData {
|
||||
// First argument to this EBB, or `None` if the block has no arguments.
|
||||
//
|
||||
// The arguments are all ValueData::Argument entries that form a linked list from `first_arg`
|
||||
// The arguments are all `ValueData::Argument` entries that form a linked list from `first_arg`
|
||||
// to `last_arg`.
|
||||
first_arg: PackedOption<Value>,
|
||||
|
||||
@@ -680,14 +680,14 @@ mod tests {
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
// Detach the 'c' value from iadd.
|
||||
// Detach the 'c' value from `iadd`.
|
||||
{
|
||||
let mut vals = dfg.detach_secondary_results(iadd);
|
||||
assert_eq!(vals.next(), Some(c));
|
||||
assert_eq!(vals.next(), None);
|
||||
}
|
||||
|
||||
// Replace iadd_cout with a normal iadd and an icmp.
|
||||
// Replace `iadd_cout` with a normal `iadd` and an `icmp`.
|
||||
dfg.replace(iadd).iadd(v1, arg0);
|
||||
let c2 = dfg.ins(pos).icmp(IntCC::UnsignedLessThan, s, v1);
|
||||
dfg.change_to_alias(c, c2);
|
||||
|
||||
@@ -65,7 +65,7 @@ pub struct Ebb(u32);
|
||||
entity_impl!(Ebb, "ebb");
|
||||
|
||||
impl Ebb {
|
||||
/// Create a new EBB reference from its number. This corresponds to the ebbNN representation.
|
||||
/// Create a new EBB reference from its number. This corresponds to the `ebbNN` representation.
|
||||
///
|
||||
/// This method is for use by the parser.
|
||||
pub fn with_number(n: u32) -> Option<Ebb> {
|
||||
@@ -90,7 +90,7 @@ pub enum ExpandedValue {
|
||||
|
||||
impl Value {
|
||||
/// Create a `Direct` value from its number representation.
|
||||
/// This is the number in the vNN notation.
|
||||
/// This is the number in the `vNN` notation.
|
||||
///
|
||||
/// This method is for use by the parser.
|
||||
pub fn direct_with_number(n: u32) -> Option<Value> {
|
||||
@@ -104,7 +104,7 @@ impl Value {
|
||||
}
|
||||
|
||||
/// Create a `Table` value from its number representation.
|
||||
/// This is the number in the vxNN notation.
|
||||
/// This is the number in the `vxNN` notation.
|
||||
///
|
||||
/// This method is for use by the parser.
|
||||
pub fn table_with_number(n: u32) -> Option<Value> {
|
||||
|
||||
@@ -60,7 +60,7 @@ impl Function {
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new empty, anomymous function.
|
||||
/// Create a new empty, anonymous function.
|
||||
pub fn new() -> Function {
|
||||
Self::with_name_signature(FunctionName::default(), Signature::new())
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ impl Display for Imm64 {
|
||||
impl FromStr for Imm64 {
|
||||
type Err = &'static str;
|
||||
|
||||
// Parse a decimal or hexadecimal Imm64, formatted as above.
|
||||
// Parse a decimal or hexadecimal `Imm64`, formatted as above.
|
||||
fn from_str(s: &str) -> Result<Imm64, &'static str> {
|
||||
let mut value: u64 = 0;
|
||||
let mut digits = 0;
|
||||
@@ -149,7 +149,7 @@ pub struct Ieee64(f64);
|
||||
|
||||
// Format a floating point number in a way that is reasonably human-readable, and that can be
|
||||
// converted back to binary without any rounding issues. The hexadecimal formatting of normal and
|
||||
// subnormal numbers is compatible with C99 and the printf "%a" format specifier. The NaN and Inf
|
||||
// subnormal numbers is compatible with C99 and the `printf "%a"` format specifier. The NaN and Inf
|
||||
// formats are not supported by C99.
|
||||
//
|
||||
// The encoding parameters are:
|
||||
@@ -380,7 +380,7 @@ impl Ieee32 {
|
||||
Ieee32(x)
|
||||
}
|
||||
|
||||
/// Construct Ieee32 immediate from raw bits.
|
||||
/// Construct `Ieee32` immediate from raw bits.
|
||||
pub fn from_bits(x: u32) -> Ieee32 {
|
||||
Ieee32(unsafe { mem::transmute(x) })
|
||||
}
|
||||
@@ -410,7 +410,7 @@ impl Ieee64 {
|
||||
Ieee64(x)
|
||||
}
|
||||
|
||||
/// Construct Ieee64 immediate from raw bits.
|
||||
/// Construct `Ieee64` immediate from raw bits.
|
||||
pub fn from_bits(x: u64) -> Ieee64 {
|
||||
Ieee64(unsafe { mem::transmute(x) })
|
||||
}
|
||||
@@ -496,7 +496,7 @@ mod tests {
|
||||
"Negative number too small for Imm64");
|
||||
parse_ok::<Imm64>("18446744073709551615", "-1");
|
||||
parse_ok::<Imm64>("-9223372036854775808", "0x8000_0000_0000_0000");
|
||||
// Overflow both the checked_add and checked_mul.
|
||||
// Overflow both the `checked_add` and `checked_mul`.
|
||||
parse_err::<Imm64>("18446744073709551616", "Too large decimal Imm64");
|
||||
parse_err::<Imm64>("184467440737095516100", "Too large decimal Imm64");
|
||||
parse_err::<Imm64>("-9223372036854775809",
|
||||
|
||||
@@ -57,9 +57,9 @@ impl Opcode {
|
||||
}
|
||||
}
|
||||
|
||||
// This trait really belongs in lib/reader where it is used by the .cton file parser, but since it
|
||||
// critically depends on the `opcode_name()` function which is needed here anyway, it lives in this
|
||||
// module. This also saves us from running the build script twice to generate code for the two
|
||||
// This trait really belongs in lib/reader where it is used by the `.cton` file parser, but since
|
||||
// it critically depends on the `opcode_name()` function which is needed here anyway, it lives in
|
||||
// this module. This also saves us from running the build script twice to generate code for the two
|
||||
// separate crates.
|
||||
impl FromStr for Opcode {
|
||||
type Err = &'static str;
|
||||
@@ -141,7 +141,7 @@ pub enum InstructionData {
|
||||
arg: Value,
|
||||
imm: Imm64,
|
||||
},
|
||||
// Same as BinaryImm, but the immediate is the lhs operand.
|
||||
// Same as `BinaryImm`, but the immediate is the left-hand-side operand.
|
||||
BinaryImmRev {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
@@ -246,7 +246,7 @@ impl VariableArgs {
|
||||
}
|
||||
}
|
||||
|
||||
// Coerce VariableArgs into a &[Value] slice.
|
||||
// Coerce `VariableArgs` into a `&[Value]` slice.
|
||||
impl Deref for VariableArgs {
|
||||
type Target = [Value];
|
||||
|
||||
@@ -311,7 +311,7 @@ impl Display for TernaryOverflowData {
|
||||
}
|
||||
|
||||
/// Payload data for jump instructions. These need to carry lists of EBB arguments that won't fit
|
||||
/// in the allowed InstructionData size.
|
||||
/// in the allowed `InstructionData` size.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct JumpData {
|
||||
/// Jump destination EBB.
|
||||
@@ -331,7 +331,7 @@ impl Display for JumpData {
|
||||
}
|
||||
|
||||
/// Payload data for branch instructions. These need to carry lists of EBB arguments that won't fit
|
||||
/// in the allowed InstructionData size.
|
||||
/// in the allowed `InstructionData` size.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BranchData {
|
||||
/// Value argument controlling the branch.
|
||||
@@ -702,11 +702,10 @@ mod tests {
|
||||
#[test]
|
||||
fn instruction_data() {
|
||||
use std::mem;
|
||||
// The size of the InstructionData enum is important for performance. It should not exceed
|
||||
// 16 bytes. Use `Box<FooData>` out-of-line payloads for instruction formats that require
|
||||
// more space than that.
|
||||
// It would be fine with a data structure smaller than 16 bytes, but what are the odds of
|
||||
// that?
|
||||
// The size of the `InstructionData` enum is important for performance. It should not
|
||||
// exceed 16 bytes. Use `Box<FooData>` out-of-line payloads for instruction formats that
|
||||
// require more space than that. It would be fine with a data structure smaller than 16
|
||||
// bytes, but what are the odds of that?
|
||||
assert_eq!(mem::size_of::<InstructionData>(), 16);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ impl JumpTableData {
|
||||
|
||||
/// Set a table entry.
|
||||
///
|
||||
/// The table will grow as needed to fit 'idx'.
|
||||
/// The table will grow as needed to fit `idx`.
|
||||
pub fn set_entry(&mut self, idx: usize, dest: Ebb) {
|
||||
// Resize table to fit `idx`.
|
||||
if idx >= self.table.len() {
|
||||
|
||||
@@ -573,10 +573,10 @@ impl<'f> DoubleEndedIterator for Insts<'f> {
|
||||
///
|
||||
/// A `Cursor` represents a position in a function layout where instructions can be inserted and
|
||||
/// removed. It can be used to iterate through the instructions of a function while editing them at
|
||||
/// the same time. A normal instruction iterator can't do this since it holds an immutable refernce
|
||||
/// to the Layout.
|
||||
/// the same time. A normal instruction iterator can't do this since it holds an immutable
|
||||
/// reference to the Layout.
|
||||
///
|
||||
/// When new instructions are added, the cursor can either apend them to an EBB or insert them
|
||||
/// When new instructions are added, the cursor can either append them to an EBB or insert them
|
||||
/// before the current instruction.
|
||||
pub struct Cursor<'f> {
|
||||
layout: &'f mut Layout,
|
||||
@@ -592,7 +592,7 @@ pub enum CursorPosition {
|
||||
/// New instructions will be inserted *before* the current instruction.
|
||||
At(Inst),
|
||||
/// Cursor is before the beginning of an EBB. No instructions can be inserted. Calling
|
||||
/// `next_inst()` wil move to the first instruction in the EBB.
|
||||
/// `next_inst()` will move to the first instruction in the EBB.
|
||||
Before(Ebb),
|
||||
/// Cursor is pointing after the end of an EBB.
|
||||
/// New instructions will be appended to the EBB.
|
||||
@@ -851,7 +851,7 @@ impl<'f> Cursor<'f> {
|
||||
/// - If pointing at the bottom of an EBB, the new instruction is appended to the EBB.
|
||||
/// - Otherwise panic.
|
||||
///
|
||||
/// In either case, the cursor is not moved, such that repeates calls to `insert_inst()` causes
|
||||
/// In either case, the cursor is not moved, such that repeated calls to `insert_inst()` causes
|
||||
/// instructions to appear in insertion order in the EBB.
|
||||
pub fn insert_inst(&mut self, inst: Inst) {
|
||||
use self::CursorPosition::*;
|
||||
@@ -1263,7 +1263,7 @@ mod tests {
|
||||
assert_eq!(cur.prev_ebb(), None);
|
||||
}
|
||||
|
||||
// Check ProgramOrder.
|
||||
// Check `ProgramOrder`.
|
||||
assert_eq!(layout.cmp(e2, e2), Ordering::Equal);
|
||||
assert_eq!(layout.cmp(e2, i2), Ordering::Less);
|
||||
assert_eq!(layout.cmp(i3, i2), Ordering::Greater);
|
||||
|
||||
@@ -43,7 +43,7 @@ impl Type {
|
||||
Type(self.0 & 0x0f)
|
||||
}
|
||||
|
||||
/// Get log2 of the number of bits in a lane.
|
||||
/// Get log_2 of the number of bits in a lane.
|
||||
pub fn log2_lane_bits(self) -> u8 {
|
||||
match self.lane_type() {
|
||||
B1 => 0,
|
||||
@@ -157,7 +157,7 @@ impl Type {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get log2 of the number of lanes in this SIMD vector type.
|
||||
/// Get log_2 of the number of lanes in this SIMD vector type.
|
||||
///
|
||||
/// All SIMD types have a lane count that is a power of two and no larger than 256, so this
|
||||
/// will be a number in the range 0-8.
|
||||
|
||||
Reference in New Issue
Block a user