fix spaces redundant trailing spaces and missing line break at EOF

This commit is contained in:
Siu Kwan Lam 2013-09-18 11:58:05 -05:00
commit 6e55bfc406
19 changed files with 594 additions and 594 deletions

View file

@ -1,18 +1,18 @@
# This should be moved to llvmpy
#
#
# There are different array kinds parameterized by eltype and nd
#
# Contiguous or Fortran
#
# Contiguous or Fortran
# struct {
# eltype *data;
# intp shape[nd];
# intp shape[nd];
# } contiguous_array(eltype, nd)
#
# struct {
# eltype *data;
# diminfo shape[nd];
# } strided_array(eltype, nd)
#
#
# struct {
# eltype *data;
# intp shape[nd];
@ -40,7 +40,7 @@
# int32 nd;
# diminfo shape[nd];
# } strided_array_nd(eltype)
#
#
#
# Backward compatible but deprecated:
# struct {
@ -50,25 +50,25 @@
# intp stride[nd];
# } strided_soa_array_nd(eltype)
#
#
#
# The most general (where the kind of array is stored as well as number
# of dimensions)
# Rarely needed.
#
#
# struct {
# eltype *data;
# int16 nd;
# int16 dimkind;
# ???
# } array_nd(eltype)
#
#
# where ??? is run-time interpreted based on the dimkind to either:
# intp shape[nd]; for dimkind = C_CONTIGUOUS or F_CONTIGUOUS
#
# diminfo shape[nd]; for dimkind = STRIDED
#
# intp shape[ind];
# intp strides[ind]; dimkind = STRIDED_SOA
# intp strides[ind]; dimkind = STRIDED_SOA
#
import llvm.core as lc
@ -95,7 +95,7 @@ STRIDED_DK = STRIDED + HAS_DIMKIND
STRIDED_SOA_DK = STRIDED_SOA + HAS_DIMKIND
array_kinds = (C_CONTIGUOUS, F_CONTIGUOUS, STRIDED, STRIDED_SOA,
C_CONTIGUOUS_ND, F_CONTIGUOUS_ND, STRIDED_ND, STRIDED_SOA_DK,
C_CONTIGUOUS_ND, F_CONTIGUOUS_ND, STRIDED_ND, STRIDED_SOA_DK,
C_CONTIGUOUS_DK, F_CONTIGUOUS_DK, STRIDED_DK, STRIDED_SOA_DK)
_invmap = {}
@ -105,7 +105,7 @@ def kind_to_str(kind):
if not _invmap:
for key, value in globals().items():
if isinstance(value, int) and value in array_kinds:
_invmap[value] = key
_invmap[value] = key
return _invmap[kind]
def str_to_kind(str):
@ -157,7 +157,7 @@ def array_type(nd, kind, el_type=char_type):
terms.append(Type.array(intp_type, nd)) # shape
elif base == STRIDED:
terms.append(Type.array(diminfo_type, nd)) # diminfo
elif base == STRIDED_SOA:
elif base == STRIDED_SOA:
terms.extend([Type.array(intp_type, nd), # shape
Type.array(intp_type, nd)]) # strides
@ -184,8 +184,8 @@ def _raw_check_array(arrtyp):
a0 = arrtyp.elements[0]
a1 = arrtyp.elements[1]
if not isinstance(a0, lc.PointerType) or \
not (isinstance(a1, lc.ArrayType) or
(a1 == int32_type) or (a1 == int16_type)):
not (isinstance(a1, lc.ArrayType) or
(a1 == int32_type) or (a1 == int16_type)):
return None
data_type = a0.pointee
@ -214,7 +214,7 @@ def _raw_check_array(arrtyp):
c_contiguous = C_CONTIGUOUS_DK
f_contiguous = F_CONTIGUOUS_DK
else:
num = 1
num = 1
strided = STRIDED
strided_soa = STRIDED_SOA
c_contiguous = C_CONTIGUOUS
@ -254,4 +254,4 @@ def test():
assert check_array(arr) == (STRIDED_SOA, 3, char_type)
if __name__ == '__main__':
test()
test()