15 byval vn
as ASTNODE
ptr, _
16 byval n
as ASTNODE
ptr _
19 if( vn->
class <> n->
class )
then
23 if( vn->
class = AST_NODECLASS_VAR )
then
24 if( vn->sym <> n->sym )
then
29 if( astIsCONST( vn ) )
then
30 if( astGetDataType( vn ) <> astGetDataType( n ) )
then
34 if( typeGetClass( vn->dtype ) = FB_DATACLASS_FPOINT )
then
35 if( astConstGetFloat( vn ) <> astConstGetFloat( n ) )
then
39 if( astConstGetInt( vn ) <> astConstGetInt( n ) )
then
50 byval n
as ASTNODE
ptr, _
51 byval deref
as integer _
54 dim as integer dtype =
any
57 if( deref )
then return TRUE
60 select case as const n->
class
61 case AST_NODECLASS_BOP
62 if( n->op.op = AST_OP_ADD )
then return TRUE
63 if( n->op.op = AST_OP_SUB )
then return TRUE
64 if( n->op.op = AST_OP_MUL )
then return TRUE
65 if( n->op.op = AST_OP_DIV )
then return TRUE
66 if( n->op.op = AST_OP_ASSIGN )
then return TRUE
68 case AST_NODECLASS_UOP
69 if( n->op.op = AST_OP_SWZ_REPEAT )
then return TRUE
71 case AST_NODECLASS_ASSIGN, AST_NODECLASS_LOAD
74 case AST_NODECLASS_CONV, AST_NODECLASS_CONST
75 dtype = ( n->dtype
And FB_DT_TYPEMASK )
76 if( dtype = FB_DATATYPE_SINGLE )
then return TRUE
77 if( dtype = FB_DATATYPE_DOUBLE )
then
82 case AST_NODECLASS_VAR
84 dtype = ( n->sym->typ
And FB_DT_TYPEMASK )
87 if( ( dtype = FB_DATATYPE_SINGLE )
or ( dtype = FB_DATATYPE_STRUCT ) )
then
89 elseif ( dtype = FB_DATATYPE_DOUBLE )
then
95 case AST_NODECLASS_FIELD
97 dtype = ( n->sym->typ
And FB_DT_TYPEMASK )
100 if( dtype = FB_DATATYPE_SINGLE )
then return TRUE
101 if( dtype = FB_DATATYPE_DOUBLE )
then
107 case AST_NODECLASS_DEREF, AST_NODECLASS_ADDROF, AST_NODECLASS_IDX
121 byval vn
as ASTNODE
ptr, _
122 byval vn_ofs
as integer ptr, _
123 byval n
as ASTNODE
ptr, _
124 byval n_ofs
as integer ptr _
127 if( ( vn->
class = AST_NODECLASS_DEREF )
or ( vn->
class = AST_NODECLASS_IDX ) )
then
128 *vn_ofs += vn->idx.ofs
132 if( vn->
class = AST_NODECLASS_VAR )
then
133 *vn_ofs += vn->var_.ofs
134 *n_ofs += n->var_.ofs
137 if( vn->l = NULL )
then exit sub
138 if( n->l = NULL )
then exit sub
150 byval n
as ASTNODE
ptr, _
151 byval doMerge
as integer _
154 dim as ASTNODE
ptr oldNode =
any
158 if( n->
class = AST_NODECLASS_UOP )
then
159 if( ( n->op.op = AST_OP_SWZ_REPEAT )
or ( n->op.op = AST_OP_HADD ) )
then
161 n->vector =
iif( n->vector = 0, 2, n->vector + 1)
166 if( oldnode = n )
then
179 byval vn
as ASTNODE
ptr, _
180 byval n
as ASTNODE
ptr, _
181 byval deref
as integer _
185 if( ( vn = NULL )
and ( n = NULL ) )
then return TRUE
187 if( ( vn = NULL )
or ( n = NULL ) )
then return FALSE
191 if( ( vn->
class = AST_NODECLASS_DEREF )
or ( vn->
class = AST_NODECLASS_IDX ) )
then
204 if(
hCheckLoad( vn->l, n->l, deref ) = FALSE )
then return FALSE
205 if(
hCheckLoad( vn->r, n->r, deref ) = FALSE )
then return FALSE
215 byval n
as ASTNODE
ptr _
218 dim as ASTNODE
ptr swznode = NULL, varNode = NULL
224 swznode =
astNewUOP( AST_OP_SWZ_REPEAT, varNode )
239 byval n
as ASTNODE
ptr, _
240 byval dist
as integer _
244 if( n = NULL )
then return n
246 if( ( n->
class = AST_NODECLASS_UOP )
or ( n->
class = AST_NODECLASS_BOP ) )
then
247 n->vector =
iif( n->vector = 0, 2, n->vector + 1)
252 n->vector =
iif( n->vector = 0, 2, n->vector + 1)
266 byval n
as ASTNODE
ptr, _
267 byval dtype
as integer ptr _
270 dim as integer result = FALSE
272 if( n = NULL )
then return result
276 case AST_NODECLASS_CONV
278 *dtype = ( n->dtype
and FB_DT_TYPEMASK )
281 if( ( *dtype = FB_DATATYPE_SINGLE )
or ( *dtype = FB_DATATYPE_DOUBLE ) )
then
286 case AST_NODECLASS_VAR, AST_NODECLASS_FIELD
287 *dtype = ( n->sym->typ
and FB_DT_TYPEMASK )
288 if( ( *dtype = FB_DATATYPE_SINGLE )
or ( *dtype = FB_DATATYPE_DOUBLE ) )
then
306 byval n
as ASTNODE
ptr, _
307 byval dtype
as integer ptr _
312 if( n = NULL )
then exit function
314 if( n->
class = AST_NODECLASS_VAR )
then
315 *dtype = ( n->sym->typ
and FB_DT_TYPEMASK )
316 if( ( *dtype = FB_DATATYPE_SINGLE )
or ( *dtype = FB_DATATYPE_DOUBLE ) )
then
327 byval vectorNode
as ASTNODE
ptr, _
328 byval offset as integer, _
329 byval dtype
as FB_DATATYPE _
332 dim as integer needOffset = 0
335 if( vectorNode->vector )
then
337 needOffset = (
vectorWidth * typeGetSize( dtype ) )
339 needOffset = typeGetSize( dtype )
344 if( ( dtype = FB_DATATYPE_SINGLE )
or ( dtype = FB_DATATYPE_DOUBLE ) )
then
347 if( ( vectorNode->vector )
and (
offset = 0 ) )
then
362 byval n
as ASTNODE
ptr _
365 if( n = NULL )
then return 0
368 case AST_NODECLASS_CONV
369 return ( n->dtype
And FB_DT_TYPEMASK )
370 case AST_NODECLASS_VAR, AST_NODECLASS_FIELD
371 return ( n->sym->typ
And FB_DT_TYPEMASK )
385 byval vectorNode
as ASTNODE
ptr, _
386 byval n
as ASTNODE
ptr, _
387 byval doMerge
as integer _
390 dim as integer offset =
any, needOffset = 0
391 dim as integer vn_ofs =
any, n_ofs =
any
392 dim as integer dtype =
any
397 if( n = NULL )
then return TRUE
398 if( vectorNode = NULL )
then return TRUE
403 if( doMerge = 0 )
then
415 if( vectorNode->
class = AST_NODECLASS_ASSIGN )
then
418 n_ofs = 0: vn_ofs = 0
421 offset = ( n_ofs - vn_ofs )
423 if( vectorNode->vector )
then
425 needOffset = (
vectorWidth * typeGetSize( dtype ) )
427 needOffset = typeGetSize( dtype )
430 if(
offset <> needOffset )
then
440 if( vectorNode->
class = AST_NODECLASS_FIELD )
then
441 if( doMerge = FALSE )
then
442 if(
hCheckLoad( vectorNode, n, FALSE ) = FALSE )
then
447 n_ofs = 0: vn_ofs = 0
450 offset = ( n_ofs - vn_ofs )
452 dtype = vectorNode->sym->typ
And FB_DT_TYPEMASK
468 if( ( vectorNode->
class = AST_NODECLASS_DEREF )
or ( vectorNode->
class = AST_NODECLASS_IDX ) )
then
469 if( doMerge = FALSE )
then
470 if(
hCheckLoad( vectorNode, n, TRUE ) = FALSE )
then
475 if( vectorNode->
class = AST_NODECLASS_DEREF )
then
488 n_ofs = 0: vn_ofs = 0
491 offset = ( n_ofs - vn_ofs )
507 if( vectorNode->
class = AST_NODECLASS_VAR )
then
508 if( doMerge = FALSE )
then
509 if(
hCheckLoad( vectorNode, n, FALSE ) = FALSE )
then
523 if( vectorNode->
class = AST_NODECLASS_CONST )
then
524 dtype = ( n->dtype
And FB_DT_TYPEMASK )
525 if( ( dtype = FB_DATATYPE_SINGLE )
or ( dtype = FB_DATATYPE_DOUBLE ) )
then
543 if(
hMergeNode( vectorNode->l, n->l, doMerge ) = FALSE )
then return FALSE
544 if(
hMergeNode( vectorNode->r, n->r, doMerge ) = FALSE )
then return FALSE
552 byval n
as ASTNODE
ptr _
555 if( n->
class = AST_NODECLASS_ASSIGN )
then return TRUE
566 byval n
as ASTNODE
ptr _
569 dim as ASTNODE
ptr l =
any
570 dim as integer changed = FALSE
572 if( n = NULL )
then return FALSE
574 if( n->
class = AST_NODECLASS_BOP )
then
575 if( n->op.op = AST_OP_ADD )
then
586 if( l->
class = AST_NODECLASS_UOP )
then
587 if( l->op.op = AST_OP_HADD )
then
598 n->
class = AST_NODECLASS_UOP
599 n->op.op = AST_OP_HADD
620 byval n
as ASTNODE
ptr _
623 dim as ASTNODE
ptr nextNode = NULL
627 if( n->
class <> AST_NODECLASS_DBG )
And _
628 ( n->
class <> AST_NODECLASS_LIT )
And _
629 ( n->
class <> AST_NODECLASS_LABEL )
And _
630 ( n->
class <> AST_NODECLASS_DECL )
And _
631 ( n->
class <> AST_NODECLASS_NOP )
And _
632 ( n->
class <> AST_NODECLASS_SCOPEBEGIN )
And _
633 ( n->
class <> AST_NODECLASS_SCOPEEND )
then
636 if( nextNode )
then exit do
646 byval n
as ASTNODE
ptr _
651 if( n->
class <> AST_NODECLASS_LINK )
then exit function
653 if( n->l->
class <> AST_NODECLASS_DECL )
then exit function
654 if( n->r->
class = AST_NODECLASS_ASSIGN )
then
666 byval p as ASTNODE
ptr _
669 dim as ASTNODE
ptr treeA =
any, treeB =
any, nodeA =
any, nodeB =
any, prev =
any, nxt =
any
670 dim as integer intraTree =
any, parallelA =
any, parallelB =
any, doNext =
any
676 if( treeA = NULL )
then exit do
698 if( ( treeB = NULL )
or ( parallelA = FALSE ) )
then
710 if( parallelA
and parallelB )
then
723 treeB->prev->
next = treeB
724 if( treeB->
next )
then
725 treeB->
next->prev = treeB
733 if( ( intraTree = TRUE )
and ( env.clopt.vectorize >= FB_VECTORIZE_INTRATREE ) )
then