@@ -6,16 +6,16 @@ function dottosym(x::Expr)::Symbol
6
6
xa2 isa QuoteNode ? Symbol (s1, " ###extractarray###" , xa2. value) : Symbol (s1, " ###extractarray###" , xa2)
7
7
end
8
8
function extract_array_symbol_from_ref! (ls:: LoopSet , ex:: Expr , offset1:: Int ):: Symbol
9
- ar = ex. args[1 + offset1]
10
- if isa (ar, Symbol)
11
- return ar
12
- elseif isa (ar, Expr) && (ar. head === :(.) || ar. head === :ref )
13
- s = dottosym (ar)
14
- pushprepreamble! (ls, Expr (:(= ), s, ar))
15
- return s
16
- else
17
- throw (" Indexing into the following expression was not recognized: $ar " )
18
- end
9
+ ar = ex. args[1 + offset1]
10
+ if isa (ar, Symbol)
11
+ return ar
12
+ elseif isa (ar, Expr) && (ar. head === :(.) || ar. head === :ref )
13
+ s = dottosym (ar)
14
+ pushprepreamble! (ls, Expr (:(= ), s, ar))
15
+ return s
16
+ else
17
+ throw (" Indexing into the following expression was not recognized: $ar " )
18
+ end
19
19
end
20
20
21
21
@@ -27,12 +27,12 @@ ref_from_ref!(ls::LoopSet, ex::Expr) = ref_from_expr!(ls, ex, 0, 0)
27
27
ref_from_getindex! (ls:: LoopSet , ex:: Expr ) = ref_from_expr! (ls, ex, 1 , 1 )
28
28
ref_from_setindex! (ls:: LoopSet , ex:: Expr ) = ref_from_expr! (ls, ex, 1 , 2 )
29
29
function ref_from_expr! (ls:: LoopSet , ex:: Expr )
30
- if ex. head === :ref
31
- ref_from_ref! (ls, ex)
32
- else # if ex.head === :call
33
- f = first (ex. args):: Symbol
34
- f === :getindex ? ref_from_getindex! (ls, ex) : ref_from_setindex! (ls, ex)
35
- end
30
+ if ex. head === :ref
31
+ ref_from_ref! (ls, ex)
32
+ else # if ex.head === :call
33
+ f = first (ex. args):: Symbol
34
+ f === :getindex ? ref_from_getindex! (ls, ex) : ref_from_setindex! (ls, ex)
35
+ end
36
36
end
37
37
38
38
add_vptr! (ls:: LoopSet , op:: Operation ) = add_vptr! (ls, op. ref)
@@ -91,20 +91,20 @@ function subset_vptr!(ls::LoopSet, vptr::Symbol, indnum::Int, ind, previndices,
91
91
end
92
92
93
93
function gesp_const_offset! (ls:: LoopSet , vptrarray, ninds, indices, loopedindex, mlt:: Integer , sym)
94
- if isone (mlt)
95
- subset_vptr! (ls, vptrarray, ninds, sym, indices, loopedindex, false )
96
- else
97
- mltsym = Symbol (sym, " ##multiplied##by##" , mlt)
98
- pushprepreamble! (ls, Expr (:(= ), mltsym, Expr (:call , :(* ), mlt, sym))) # want same name for arrays to be given the same name if possible
99
- subset_vptr! (ls, vptrarray, ninds, mltsym, indices, loopedindex, false )
100
- end
94
+ if isone (mlt)
95
+ subset_vptr! (ls, vptrarray, ninds, sym, indices, loopedindex, false )
96
+ else
97
+ mltsym = Symbol (sym, " ##multiplied##by##" , mlt)
98
+ pushprepreamble! (ls, Expr (:(= ), mltsym, Expr (:call , :(* ), mlt, sym))) # want same name for arrays to be given the same name if possible
99
+ subset_vptr! (ls, vptrarray, ninds, mltsym, indices, loopedindex, false )
100
+ end
101
101
end
102
102
function gesp_const_offsets! (ls:: LoopSet , vptrarray, ninds, indices, loopedindex, mltsyms)
103
- length (mltsyms) > 1 && sort! (mltsyms, by = last) # if multiple have same combination of syms, make sure they match even if order is different
104
- for (mlt,sym) ∈ mltsyms
105
- vptrarray = gesp_const_offset! (ls, vptrarray, ninds, indices, loopedindex, mlt, sym)
106
- end
107
- vptrarray
103
+ length (mltsyms) > 1 && sort! (mltsyms, by = last) # if multiple have same combination of syms, make sure they match even if order is different
104
+ for (mlt,sym) ∈ mltsyms
105
+ vptrarray = gesp_const_offset! (ls, vptrarray, ninds, indices, loopedindex, mlt, sym)
106
+ end
107
+ vptrarray
108
108
end
109
109
110
110
@@ -296,7 +296,7 @@ function checkforoffset!(
296
296
addconstindex! (indices, offsets, strides, loopedindex, offset)
297
297
return vptrarray
298
298
elseif length (mult_syms) == 1
299
- mlt, sym = only ( mult_syms)
299
+ mlt, sym = mult_syms[ 1 ]
300
300
if sym ∈ ls. loopsymbols
301
301
if byterepresentable (mlt)
302
302
_addoffset! (indices, offsets, strides, loopedindex, loopdependencies, sym, offset, mlt)
0 commit comments