Fix typos.
This commit is contained in:
committed by
Dan Gohman
parent
4224a95f0d
commit
4f8753fa11
@@ -2,7 +2,7 @@
|
||||
Cranelift DSL classes.
|
||||
|
||||
This module defines the classes that are used to define Cranelift instructions
|
||||
and other entitties.
|
||||
and other entities.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
import re
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Abstract syntax trees.
|
||||
|
||||
This module defines classes that can be used to create abstract syntax trees
|
||||
for patern matching an rewriting of cranelift instructions.
|
||||
for pattern matching an rewriting of cranelift instructions.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from . import instructions
|
||||
@@ -79,7 +79,7 @@ class Def(object):
|
||||
# type: (VarAtomMap) -> Def
|
||||
"""
|
||||
Return a copy of this Def with vars replaced with fresh variables,
|
||||
in accordance with the map m. Update m as neccessary.
|
||||
in accordance with the map m. Update m as necessary.
|
||||
"""
|
||||
new_expr = self.expr.copy(m)
|
||||
new_defs = [] # type: List[Var]
|
||||
@@ -423,7 +423,7 @@ class Apply(Expr):
|
||||
# type: (VarAtomMap) -> Apply
|
||||
"""
|
||||
Return a copy of this Expr with vars replaced with fresh variables,
|
||||
in accordance with the map m. Update m as neccessary.
|
||||
in accordance with the map m. Update m as necessary.
|
||||
"""
|
||||
return Apply(self.inst, tuple(map(lambda e: replace_var(e, m),
|
||||
self.args)))
|
||||
@@ -441,7 +441,7 @@ class Apply(Expr):
|
||||
def substitution(self, other, s):
|
||||
# type: (Apply, VarAtomMap) -> Optional[VarAtomMap]
|
||||
"""
|
||||
If there is a substituion from Var->Atom that converts self to other,
|
||||
If there is a substitution from Var->Atom that converts self to other,
|
||||
return it, otherwise return None. Note that this is strictly weaker
|
||||
than unification (see TestXForm.test_subst_enum_bad_var_const for
|
||||
example).
|
||||
@@ -513,7 +513,7 @@ class ConstantInt(Literal):
|
||||
A value of an integer immediate operand.
|
||||
|
||||
Immediate operands like `imm64` or `offset32` can be specified in AST
|
||||
expressions using the call syntax: `imm64(5)` which greates a `ConstantInt`
|
||||
expressions using the call syntax: `imm64(5)` which creates a `ConstantInt`
|
||||
node.
|
||||
"""
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ class TestXForm(TypeCheckingBaseTest):
|
||||
# For any patterns where the type env includes constraints, at
|
||||
# least one of the "theoretically possible" concrete typings must
|
||||
# be prevented by the constraints. (i.e. we are not emitting
|
||||
# unneccessary constraints).
|
||||
# unnecessary constraints).
|
||||
# We check that by asserting that the number of concrete typings is
|
||||
# less than the number of all possible free typevar assignments
|
||||
if (len(xform.ti.constraints) > 0):
|
||||
|
||||
@@ -233,7 +233,7 @@ class TestTypeVar(TestCase):
|
||||
intersect = ts1.copy()
|
||||
intersect &= ts2
|
||||
|
||||
# Propagate instersections backward
|
||||
# Propagate intersections backward
|
||||
ts1_src = reduce(lambda ts, func: ts.preimage(func),
|
||||
reversed(i1),
|
||||
intersect)
|
||||
|
||||
@@ -276,7 +276,7 @@ class SameWidth(TypeConstraint):
|
||||
|
||||
class TypeEnv(object):
|
||||
"""
|
||||
Class encapsulating the neccessary book keeping for type inference.
|
||||
Class encapsulating the necessary book keeping for type inference.
|
||||
:attribute type_map: dict holding the equivalence relations between tvs
|
||||
:attribute constraints: a list of accumulated constraints - tuples
|
||||
(tv1, tv2)) where tv1 and tv2 are equal
|
||||
@@ -331,7 +331,7 @@ class TypeEnv(object):
|
||||
"""
|
||||
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
|
||||
cannonical representative.
|
||||
canonical representative.
|
||||
"""
|
||||
assert not tv1.is_derived
|
||||
assert self[tv1] == tv1
|
||||
@@ -376,7 +376,7 @@ class TypeEnv(object):
|
||||
non-derived TVs implicitly get the lowest rank (0). Derived variables
|
||||
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.
|
||||
than TVs associated with temporary vars.
|
||||
"""
|
||||
default_rank = TypeEnv.RANK_INTERNAL if tv.singleton_type() is None \
|
||||
else TypeEnv.RANK_SINGLETON
|
||||
@@ -837,7 +837,7 @@ def ti_def(definition, typ):
|
||||
fresh_formal_tvs = move_first(fresh_formal_tvs, idx)
|
||||
actual_tvs = move_first(actual_tvs, idx)
|
||||
|
||||
# Unify each actual typevar with the correpsonding fresh formal tv
|
||||
# Unify each actual typevar with the corresponding fresh formal tv
|
||||
for (actual_tv, formal_tv) in zip(actual_tvs, fresh_formal_tvs):
|
||||
typ_or_err = unify(actual_tv, formal_tv, typ)
|
||||
err = get_error(typ_or_err)
|
||||
|
||||
@@ -51,7 +51,7 @@ class Rtl(object):
|
||||
# type: (VarAtomMap) -> Rtl
|
||||
"""
|
||||
Return a copy of this rtl with all Vars substituted with copies or
|
||||
according to m. Update m as neccessary.
|
||||
according to m. Update m as necessary.
|
||||
"""
|
||||
return Rtl(*[d.copy(m) for d in self.rtl])
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@ except ImportError:
|
||||
def get_runtime_typechecks(xform):
|
||||
# type: (XForm) -> List[TypeConstraint]
|
||||
"""
|
||||
Given a XForm build a list of runtime type checks neccessary to determine
|
||||
Given a XForm build a list of runtime type checks necessary to determine
|
||||
if it applies. We have 2 types of runtime checks:
|
||||
1) typevar tv belongs to typeset T - needed for free tvs whose
|
||||
typeset is constrainted by their use in the dst pattern
|
||||
typeset is constrained by their use in the dst pattern
|
||||
|
||||
2) tv1 == tv2 where tv1 and tv2 are derived TVs - caused by unification
|
||||
of non-bijective functions
|
||||
|
||||
@@ -201,7 +201,7 @@ def equivalent(r1, r2, inp_m, out_m):
|
||||
assert isinstance(v2, Var)
|
||||
results_eq_exp.append(mk_eq(m1[v1], m2[v2]))
|
||||
|
||||
# Put the whole query toghether
|
||||
# Put the whole query together
|
||||
return q1 + q2 + args_eq_exp + [Not(And(*results_eq_exp))]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user