From c59e9180decea441e783979caaa4df84b35273f5 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sun, 4 Mar 2018 22:37:34 -0800 Subject: [PATCH] Tidy up whitespace. --- lib/cretonne/meta/base/instructions.py | 6 +++--- lib/cretonne/meta/cdsl/test_ti.py | 2 +- lib/cretonne/meta/cdsl/ti.py | 12 ++++++------ lib/cretonne/meta/cdsl/xform.py | 4 ++-- lib/cretonne/meta/gen_legalizer.py | 2 +- lib/cretonne/meta/isa/intel/instructions.py | 4 ++-- lib/cretonne/meta/semantics/__init__.py | 2 +- lib/cretonne/src/bforest/path.rs | 2 +- lib/cretonne/src/divconst_magic_numbers.rs | 10 +++++----- lib/cretonne/src/legalizer/boundary.rs | 2 +- lib/cretonne/src/preopt.rs | 18 +++++++++--------- lib/wasm/src/code_translator.rs | 2 +- 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/lib/cretonne/meta/base/instructions.py b/lib/cretonne/meta/base/instructions.py index 7db8bed202..8ba1aa65fa 100644 --- a/lib/cretonne/meta/base/instructions.py +++ b/lib/cretonne/meta/base/instructions.py @@ -1699,7 +1699,7 @@ fpromote = Instruction( This is an exact operation. Cretonne currently only supports two floating point formats - - :type:`f32` and :type:`f64`. This may change in the future. + - :type:`f32` and :type:`f64`. This may change in the future. The result type must have the same number of vector lanes as the input, and the result lanes must not have fewer bits than the input lanes. If @@ -1715,10 +1715,10 @@ fdemote = Instruction( by rounding to nearest, ties to even. Cretonne currently only supports two floating point formats - - :type:`f32` and :type:`f64`. This may change in the future. + - :type:`f32` and :type:`f64`. This may change in the future. The result type must have the same number of vector lanes as the input, - and the result lanes must not have more bits than the input lanes. If + and the result lanes must not have more bits than the input lanes. If the input and output types are the same, this is a no-op. """, ins=x, outs=a, constraints=WiderOrEq(Float, FloatTo)) diff --git a/lib/cretonne/meta/cdsl/test_ti.py b/lib/cretonne/meta/cdsl/test_ti.py index b9b3e0b646..d3baa4d3c5 100644 --- a/lib/cretonne/meta/cdsl/test_ti.py +++ b/lib/cretonne/meta/cdsl/test_ti.py @@ -96,7 +96,7 @@ def check_concrete_typing_rtl(var_types, rtl): # type: (VarTyping, Rtl) -> None """ Check that a concrete type assignment var_types (Dict[Var, TypeVar]) is - valid for an Rtl rtl. Specifically check that: + valid for an Rtl rtl. Specifically check that: 1) For each Var v \in rtl, v is defined in var_types diff --git a/lib/cretonne/meta/cdsl/ti.py b/lib/cretonne/meta/cdsl/ti.py index b2673366be..bc2c16d5b1 100644 --- a/lib/cretonne/meta/cdsl/ti.py +++ b/lib/cretonne/meta/cdsl/ti.py @@ -322,7 +322,7 @@ class TypeEnv(object): # type: (TypeVar, TypeVar) -> None """ Record a that the free tv1 is part of the same equivalence class as - tv2. The canonical representative of the merged class is tv2's + tv2. The canonical representative of the merged class is tv2's cannonical representative. """ assert not tv1.is_derived @@ -364,9 +364,9 @@ class TypeEnv(object): # type: (TypeVar) -> int """ Get the rank of tv in the partial order. TVs directly associated with a - Var get their rank from the Var (see register()). Internally generated + Var get their rank from the Var (see register()). Internally generated non-derived TVs implicitly get the lowest rank (0). Derived variables - get their rank from their free typevar. Singletons have the highest + get their rank from their free typevar. Singletons have the highest rank. TVs associated with vars in a source pattern have a higher rank than TVs associted with temporary vars. """ @@ -381,7 +381,7 @@ class TypeEnv(object): def register(self, v): # type: (Var) -> None """ - Register a new Var v. This computes a rank for the associated TypeVar + Register a new Var v. This computes a rank for the associated TypeVar for v, which is used to impose a partial order on type variables. """ self.vars.add(v) @@ -848,7 +848,7 @@ def ti_def(definition, typ): def ti_rtl(rtl, typ): # type: (Rtl, TypeEnv) -> TypingOrError """ - Perform type inference on an Rtl in a starting type env typ. Return an + Perform type inference on an Rtl in a starting type env typ. Return an updated type environment or error. """ for (i, d) in enumerate(rtl.rtl): @@ -866,7 +866,7 @@ def ti_rtl(rtl, typ): def ti_xform(xform, typ): # type: (XForm, TypeEnv) -> TypingOrError """ - Perform type inference on an Rtl in a starting type env typ. Return an + Perform type inference on an Rtl in a starting type env typ. Return an updated type environment or error. """ typ_or_err = ti_rtl(xform.src, typ) diff --git a/lib/cretonne/meta/cdsl/xform.py b/lib/cretonne/meta/cdsl/xform.py index bad15e0245..607c1776a2 100644 --- a/lib/cretonne/meta/cdsl/xform.py +++ b/lib/cretonne/meta/cdsl/xform.py @@ -113,8 +113,8 @@ class Rtl(object): # type: (Rtl) -> None """ Given that there is only 1 possible concrete typing T for self, assign - a singleton TV with type t=T[v] for each Var v \in self. Its an error - to call this on an Rtl with more than 1 possible typing. This modifies + a singleton TV with type t=T[v] for each Var v \in self. Its an error + to call this on an Rtl with more than 1 possible typing. This modifies the Rtl in-place. """ from .ti import ti_rtl, TypeEnv diff --git a/lib/cretonne/meta/gen_legalizer.py b/lib/cretonne/meta/gen_legalizer.py index 51368fea44..0f7b1f68e4 100644 --- a/lib/cretonne/meta/gen_legalizer.py +++ b/lib/cretonne/meta/gen_legalizer.py @@ -211,7 +211,7 @@ def unwrap_inst(iref, node, fmt): fmt.format('let typeof_{0} = pos.func.dfg.value_type({0});', v) # If the node has results, detach the values. - # Place the values in locals. + # Place the values in locals. replace_inst = False if len(node.defs) > 0: if node.defs == node.defs[0].dst_def.defs: diff --git a/lib/cretonne/meta/isa/intel/instructions.py b/lib/cretonne/meta/isa/intel/instructions.py index e5265e2d15..1fe75ff984 100644 --- a/lib/cretonne/meta/isa/intel/instructions.py +++ b/lib/cretonne/meta/isa/intel/instructions.py @@ -154,7 +154,7 @@ rflags = Operand('rflags', iflags) bsr = Instruction( 'x86_bsr', r""" Bit Scan Reverse -- returns the bit-index of the most significant 1 - in the word. Result is undefined if the argument is zero. However, it + in the word. Result is undefined if the argument is zero. However, it sets the Z flag depending on the argument, so it is at least easy to detect and handle that case. @@ -166,7 +166,7 @@ bsr = Instruction( bsf = Instruction( 'x86_bsf', r""" Bit Scan Forwards -- returns the bit-index of the least significant 1 - in the word. Is otherwise identical to 'bsr', just above. + in the word. Is otherwise identical to 'bsr', just above. """, ins=x, outs=(y, rflags)) diff --git a/lib/cretonne/meta/semantics/__init__.py b/lib/cretonne/meta/semantics/__init__.py index 94e32b652c..8a55b1d595 100644 --- a/lib/cretonne/meta/semantics/__init__.py +++ b/lib/cretonne/meta/semantics/__init__.py @@ -17,7 +17,7 @@ def verify_semantics(inst, src, xforms): # type: (Instruction, Rtl, InstructionSemantics) -> None """ Verify that the semantics transforms in xforms correctly describe the - instruction described by the src Rtl. This involves checking that: + instruction described by the src Rtl. This involves checking that: 0) src is a single instance of inst 1) For all x\in xforms x.src is a single instance of inst 2) For any concrete values V of Literals in inst: diff --git a/lib/cretonne/src/bforest/path.rs b/lib/cretonne/src/bforest/path.rs index 3393014fee..c0f9550645 100644 --- a/lib/cretonne/src/bforest/path.rs +++ b/lib/cretonne/src/bforest/path.rs @@ -285,7 +285,7 @@ impl Path { fn split_and_insert(&mut self, mut key: F::Key, value: F::Value, pool: &mut NodePool) { let orig_root = self.node[0]; - // Loop invariant: We need to split the node at `level` and then retry a failed insertion. + // Loop invariant: We need to split the node at `level` and then retry a failed insertion. // The items to insert are either `(key, ins_node)` or `(key, value)`. let mut ins_node = None; let mut split; diff --git a/lib/cretonne/src/divconst_magic_numbers.rs b/lib/cretonne/src/divconst_magic_numbers.rs index a34608359f..968ca67f5c 100644 --- a/lib/cretonne/src/divconst_magic_numbers.rs +++ b/lib/cretonne/src/divconst_magic_numbers.rs @@ -4,11 +4,11 @@ //---------------------------------------------------------------------- // -// Math helpers for division by (non-power-of-2) constants. This is based -// on the presentation in "Hacker's Delight" by Henry Warren, 2003. There -// are four cases: {unsigned, signed} x {32 bit, 64 bit}. The word size +// Math helpers for division by (non-power-of-2) constants. This is based +// on the presentation in "Hacker's Delight" by Henry Warren, 2003. There +// are four cases: {unsigned, signed} x {32 bit, 64 bit}. The word size // makes little difference, but the signed-vs-unsigned aspect has a large -// effect. Therefore everything is presented in the order U32 U64 S32 S64 +// effect. Therefore everything is presented in the order U32 U64 S32 S64 // so as to emphasise the similarity of the U32 and U64 cases and the S32 // and S64 cases. @@ -478,7 +478,7 @@ mod tests { fn test_magic_generators_dont_panic() { // The point of this is to check that the magic number generators // don't panic with integer wraparounds, especially at boundary - // cases for their arguments. The actual results are thrown away. + // cases for their arguments. The actual results are thrown away. let mut total: u64 = 0; println!("Testing UP magicU32"); for x in 2..(200 * 1000u32) { diff --git a/lib/cretonne/src/legalizer/boundary.rs b/lib/cretonne/src/legalizer/boundary.rs index ea81c1ff95..9ea50b202d 100644 --- a/lib/cretonne/src/legalizer/boundary.rs +++ b/lib/cretonne/src/legalizer/boundary.rs @@ -180,7 +180,7 @@ where // We theoretically allow for call instructions that return a number of fixed results before // the call return values. In practice, it doesn't happen. let fixed_results = pos.func.dfg[call].opcode().constraints().fixed_results(); - assert_eq!(fixed_results, 0, "Fixed results on calls not supported"); + assert_eq!(fixed_results, 0, "Fixed results on calls not supported"); let results = pos.func.dfg.detach_results(call); let mut next_res = 0; diff --git a/lib/cretonne/src/preopt.rs b/lib/cretonne/src/preopt.rs index 0e4582d7a7..1fdee0ad80 100644 --- a/lib/cretonne/src/preopt.rs +++ b/lib/cretonne/src/preopt.rs @@ -20,7 +20,7 @@ use timing; // Simple math helpers // if `x` is a power of two, or the negation thereof, return the power along -// with a boolean that indicates whether `x` is negative. Else return None. +// with a boolean that indicates whether `x` is negative. Else return None. #[inline] fn isPowerOf2_S32(x: i32) -> Option<(bool, u32)> { // We have to special-case this because abs(x) isn't representable. @@ -128,10 +128,10 @@ fn get_div_info(inst: Inst, dfg: &DataFlowGraph) -> Option { } // TODO: should we actually bother to do this (that is, manually match - // the case that the second argument is an iconst)? Or should we assume + // the case that the second argument is an iconst)? Or should we assume // that some previous constant propagation pass has pushed all such // immediates to their use points, creating BinaryImm instructions - // instead? For now we take the conservative approach. + // instead? For now we take the conservative approach. if let &InstructionData::Binary { opcode, args } = idata { let (isSigned, isRem) = match opcode { Opcode::Udiv => (false, false), @@ -153,10 +153,10 @@ fn get_div_info(inst: Inst, dfg: &DataFlowGraph) -> Option { } // Actually do the transformation given a bundle containing the relevant -// information. `divrem_info` describes a div or rem by a constant, that +// information. `divrem_info` describes a div or rem by a constant, that // `pos` currently points at, and `inst` is the associated instruction. // `inst` is replaced by a sequence of other operations that calculate the -// same result. Note that there are various `divrem_info` cases where we +// same result. Note that there are various `divrem_info` cases where we // cannot do any transformation, in which case `inst` is left unchanged. fn do_divrem_transformation(divrem_info: &DivRemByConstInfo, pos: &mut FuncCursor, inst: Inst) { let isRem = match *divrem_info { @@ -234,7 +234,7 @@ fn do_divrem_transformation(divrem_info: &DivRemByConstInfo, pos: &mut FuncCurso qf = q1; } } - // Now qf holds the final quotient. If necessary calculate the + // Now qf holds the final quotient. If necessary calculate the // remainder instead. if isRem { let tt = pos.ins().imul_imm(qf, d as i64); @@ -306,7 +306,7 @@ fn do_divrem_transformation(divrem_info: &DivRemByConstInfo, pos: &mut FuncCurso qf = q1; } } - // Now qf holds the final quotient. If necessary calculate the + // Now qf holds the final quotient. If necessary calculate the // remainder instead. if isRem { let tt = pos.ins().imul_imm(qf, d as i64); @@ -382,7 +382,7 @@ fn do_divrem_transformation(divrem_info: &DivRemByConstInfo, pos: &mut FuncCurso }; let t1 = pos.ins().ushr_imm(q3, 31); let qf = pos.ins().iadd(q3, t1); - // Now qf holds the final quotient. If necessary calculate + // Now qf holds the final quotient. If necessary calculate // the remainder instead. if isRem { let tt = pos.ins().imul_imm(qf, d as i64); @@ -459,7 +459,7 @@ fn do_divrem_transformation(divrem_info: &DivRemByConstInfo, pos: &mut FuncCurso }; let t1 = pos.ins().ushr_imm(q3, 63); let qf = pos.ins().iadd(q3, t1); - // Now qf holds the final quotient. If necessary calculate + // Now qf holds the final quotient. If necessary calculate // the remainder instead. if isRem { let tt = pos.ins().imul_imm(qf, d); diff --git a/lib/wasm/src/code_translator.rs b/lib/wasm/src/code_translator.rs index 765b1a4577..5d7e59f829 100644 --- a/lib/wasm/src/code_translator.rs +++ b/lib/wasm/src/code_translator.rs @@ -90,7 +90,7 @@ pub fn translate_operator( } } /********************************* Stack misc *************************************** - * `drop`, `nop`, `unreachable` and `select`. + * `drop`, `nop`, `unreachable` and `select`. ***********************************************************************************/ Operator::Drop => { state.pop1();