14 byval op as integer, _
15 byval dtype
as integer, _
16 byval subtype
as FBSYMBOL
ptr, _
17 byval l as ASTNODE
ptr _
20 if( typeGetClass(
l->dtype ) = FB_DATACLASS_FPOINT )
then
21 select case as const(
op )
25 l->
val.f =
abs(
l->
val.f )
27 l->
val.f =
sgn(
l->
val.f )
29 l->
val.f =
sin(
l->
val.f )
31 l->
val.f =
asin(
l->
val.f )
33 l->
val.f =
cos(
l->
val.f )
35 l->
val.f =
acos(
l->
val.f )
37 l->
val.f =
tan(
l->
val.f )
39 l->
val.f =
atn(
l->
val.f )
41 l->
val.f =
sqr(
l->
val.f )
43 l->
val.f =
log(
l->
val.f )
45 l->
val.f =
exp(
l->
val.f )
47 l->
val.f =
int(
l->
val.f )
49 l->
val.f =
fix(
l->
val.f )
51 l->
val.f =
frac(
l->
val.f )
56 select case as const(
op )
58 l->
val.i =
not l->
val.i
62 l->
val.i =
abs(
l->
val.i )
64 l->
val.i =
sgn(
l->
val.i )
77 byval op as integer, _
78 byval o as ASTNODE
ptr _
81 dim as ASTNODE
ptr n =
any
82 dim as integer dtype =
any, rank =
any, intrank =
any, uintrank =
any
83 dim as FBSYMBOL
ptr subtype =
any
92 if( symb.globOpOvlTb(
op).head <> NULL )
then
93 dim as FBSYMBOL
ptr proc =
any
94 dim as FB_ERRMSG err_num =
any
96 if( proc <> NULL )
then
100 if( err_num <> FB_ERRMSG_OK )
then
106 if(
op = AST_OP_SWZ_REPEAT )
then
108 n =
astNewNode( AST_NODECLASS_UOP,
o->dtype,
o->subtype )
114 n->
op.options = AST_OPOPT_ALLOCRES
119 if( typeGetClass(
o->dtype ) = FB_DATACLASS_STRING )
then
123 select case as const( typeGet(
o->dtype ) )
125 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
127 if( astIsDEREF(
o ) = FALSE )
then
132 case FB_DATATYPE_STRUCT
136 o =
astNewCONV( typeJoin(
o->dtype, FB_DATATYPE_VOID ), NULL,
o )
142 case FB_DATATYPE_ENUM
147 o =
astNewCONV( typeJoin(
o->dtype, FB_DATATYPE_INTEGER ), NULL,
o )
150 case FB_DATATYPE_POINTER
152 if(
op <> AST_OP_NOT )
then
163 if( (env.clopt.lang <> FB_LANG_QB)
and _
164 (typeGetClass(
o->dtype ) = FB_DATACLASS_INTEGER) )
then
165 rank = typeGetIntRank( typeGetRemapType(
o->dtype ) )
166 intrank = typeGetIntRank( FB_DATATYPE_INTEGER )
167 uintrank = typeGetIntRank( FB_DATATYPE_UINT )
170 if( rank < intrank )
then
171 o =
astNewCONV( typeJoin(
o->dtype, FB_DATATYPE_INTEGER ), NULL,
o )
174 if( (intrank < rank)
and (rank < uintrank) )
then
179 o =
astNewCONV( typeJoin(
o->dtype, FB_DATATYPE_UINT ), NULL,
o )
188 select case as const op
191 if( typeGetClass(
o->dtype ) <> FB_DATACLASS_INTEGER )
then
192 o =
astNewCONV( typeJoin(
o->dtype, FB_DATATYPE_INTEGER ), NULL,
o )
199 if( typeGetClass(
o->dtype ) = FB_DATACLASS_INTEGER )
then
204 case AST_OP_SIN, AST_OP_ASIN, AST_OP_COS, AST_OP_ACOS, _
205 AST_OP_TAN, AST_OP_ATAN, AST_OP_SQRT, AST_OP_LOG, _
208 if( typeGetClass(
o->dtype ) <> FB_DATACLASS_FPOINT )
then
209 o =
astNewCONV( typeJoin(
o->dtype, FB_DATATYPE_DOUBLE ), NULL,
o )
215 case AST_OP_FIX, AST_OP_FLOOR
217 if( typeGetClass(
o->dtype ) = FB_DATACLASS_INTEGER )
then
225 if( typeGetClass(
o->dtype ) = FB_DATACLASS_INTEGER )
then
237 if( astIsCONST(
o ) )
then
238 if(
op = AST_OP_NEG )
then
239 if( typeIsSigned(
o->dtype ) = FALSE )
then
246 if( astConstGetUint(
o ) > (1ull
shl (typeGetBits( dtype ) - 1)) )
then
262 if( irGetOption( IR_OPT_NOINLINEOPS ) )
then
263 select case as const op
264 case AST_OP_SGN, AST_OP_ABS, AST_OP_FIX, AST_OP_FRAC, _
265 AST_OP_SIN, AST_OP_ASIN, AST_OP_COS, AST_OP_ACOS, _
266 AST_OP_TAN, AST_OP_ATAN, AST_OP_SQRT, AST_OP_LOG, _
267 AST_OP_EXP, AST_OP_FLOOR
273 n =
astNewNode( AST_NODECLASS_UOP, dtype, subtype )
279 n->
op.options = AST_OPOPT_ALLOCRES
287 byval n
as ASTNODE
ptr _
290 dim as ASTNODE
ptr o =
any
291 dim as integer op =
any
292 dim as IRVREG
ptr v1 =
any, vr =
any
301 if(
o->
class = AST_NODECLASS_CONV )
then
302 astUpdateCONVFD2FS(
o, n->dtype, TRUE )
307 if( ast.doemit )
then
308 if( (n->
op.options
and AST_OPOPT_ALLOCRES) <> 0 )
then
309 vr = irAllocVREG( astGetDataType(
o ),
o->subtype )
310 v1->vector = n->vector
311 vr->vector = n->vector
314 v1->vector = n->vector
317 irEmitUOP(
op, v1, vr )