libyasm
Main Page
Data Structures
Files
File List
Globals
libyasm
expr.h
Go to the documentation of this file.
1
30
#ifndef YASM_EXPR_H
31
#define YASM_EXPR_H
32
33
#ifndef YASM_LIB_DECL
34
#define YASM_LIB_DECL
35
#endif
36
42
typedef
enum
yasm_expr__type
{
43
YASM_EXPR_NONE
= 0,
44
YASM_EXPR_REG
= 1<<0,
45
YASM_EXPR_INT
= 1<<1,
46
YASM_EXPR_SUBST
= 1<<2,
47
YASM_EXPR_FLOAT
= 1<<3,
48
YASM_EXPR_SYM
= 1<<4,
49
YASM_EXPR_PRECBC
= 1<<5,
50
YASM_EXPR_EXPR
= 1<<6
51
}
yasm_expr__type
;
52
54
typedef
struct
yasm_expr__item
{
55
yasm_expr__type
type
;
58
union
{
59
yasm_bytecode
*
precbc
;
60
yasm_symrec
*
sym
;
61
yasm_expr
*
expn
;
62
yasm_intnum
*
intn
;
63
yasm_floatnum
*
flt
;
64
uintptr_t
reg
;
65
unsigned
int
subst
;
66
} data;
67
}
yasm_expr__item
;
68
70
struct
yasm_expr
{
71
yasm_expr_op
op
;
72
unsigned
long
line
;
73
int
numterms
;
79
yasm_expr__item
terms
[2];
80
};
81
89
YASM_LIB_DECL
90
/*@only@*/
yasm_expr
*
yasm_expr_create
91
(
yasm_expr_op
op,
/*@only@*/
yasm_expr__item
*a,
92
/*@only@*/
/*@null@*/
yasm_expr__item
*b,
unsigned
long
line);
93
98
YASM_LIB_DECL
99
/*@only@*/
yasm_expr__item
*
yasm_expr_precbc
(
/*@keep@*/
yasm_bytecode
*precbc);
100
105
YASM_LIB_DECL
106
/*@only@*/
yasm_expr__item
*
yasm_expr_sym
(
/*@keep@*/
yasm_symrec
*sym);
107
112
YASM_LIB_DECL
113
/*@only@*/
yasm_expr__item
*
yasm_expr_expr
(
/*@keep@*/
yasm_expr
*e);
114
119
YASM_LIB_DECL
120
/*@only@*/
yasm_expr__item
*
yasm_expr_int
(
/*@keep@*/
yasm_intnum
*intn);
121
126
YASM_LIB_DECL
127
/*@only@*/
yasm_expr__item
*
yasm_expr_float
(
/*@keep@*/
yasm_floatnum
*flt);
128
133
YASM_LIB_DECL
134
/*@only@*/
yasm_expr__item
*
yasm_expr_reg
(uintptr_t reg);
135
143
#define yasm_expr_create_tree(l,o,r,i) \
144
yasm_expr_create ((o), yasm_expr_expr(l), yasm_expr_expr(r), i)
145
152
#define yasm_expr_create_branch(o,r,i) \
153
yasm_expr_create ((o), yasm_expr_expr(r), (yasm_expr__item *)NULL, i)
154
160
#define yasm_expr_create_ident(r,i) \
161
yasm_expr_create (YASM_EXPR_IDENT, (r), (yasm_expr__item *)NULL, i)
162
167
yasm_expr
*
yasm_expr_copy
(
const
yasm_expr
*e);
168
#ifndef YASM_DOXYGEN
169
#define yasm_expr_copy(e) yasm_expr__copy_except(e, -1)
170
#endif
171
175
YASM_LIB_DECL
176
void
yasm_expr_destroy
(
/*@only@*/
/*@null@*/
yasm_expr
*e);
177
184
YASM_LIB_DECL
185
int
yasm_expr_is_op
(
const
yasm_expr
*e,
yasm_expr_op
op);
186
193
typedef
/*@only@*/
yasm_expr
* (*yasm_expr_xform_func)
194
(
/*@returned@*/
/*@only@*/
yasm_expr
*e,
/*@null@*/
void
*d);
195
208
YASM_LIB_DECL
209
/*@only@*/
/*@null@*/
yasm_expr
*
yasm_expr__level_tree
210
(
/*@returned@*/
/*@only@*/
/*@null@*/
yasm_expr
*e,
int
fold_const,
211
int
simplify_ident,
int
simplify_reg_mul,
int
calc_bc_dist,
212
/*@null@*/
yasm_expr_xform_func
expr_xform_extra,
213
/*@null@*/
void
*expr_xform_extra_data);
214
222
#define yasm_expr_simplify(e, cbd) \
223
yasm_expr__level_tree(e, 1, 1, 1, cbd, NULL, NULL)
224
233
YASM_LIB_DECL
234
/*@only@*/
/*@null@*/
yasm_expr
*
yasm_expr_extract_deep_segoff
(
yasm_expr
**ep);
235
243
YASM_LIB_DECL
244
/*@only@*/
/*@null@*/
yasm_expr
*
yasm_expr_extract_segoff
(
yasm_expr
**ep);
245
254
YASM_LIB_DECL
255
/*@only@*/
/*@null@*/
yasm_expr
*
yasm_expr_extract_wrt
(
yasm_expr
**ep);
256
265
YASM_LIB_DECL
266
/*@dependent@*/
/*@null@*/
yasm_intnum
*
yasm_expr_get_intnum
267
(
yasm_expr
**ep,
int
calc_bc_dist);
268
275
YASM_LIB_DECL
276
/*@dependent@*/
/*@null@*/
const
yasm_symrec
*
yasm_expr_get_symrec
277
(
yasm_expr
**ep,
int
simplify);
278
285
YASM_LIB_DECL
286
/*@dependent@*/
/*@null@*/
const
uintptr_t *
yasm_expr_get_reg
287
(
yasm_expr
**ep,
int
simplify);
288
293
YASM_LIB_DECL
294
void
yasm_expr_print
(
/*@null@*/
const
yasm_expr
*e, FILE *f);
295
299
YASM_LIB_DECL
300
unsigned
int
yasm_expr_size
(
const
yasm_expr
*e);
301
305
YASM_LIB_DECL
306
const
char
*
yasm_expr_segment
(
const
yasm_expr
*e);
307
316
YASM_LIB_DECL
317
int
yasm_expr__traverse_leaves_in_const
318
(
const
yasm_expr
*e,
/*@null@*/
void
*d,
319
int
(*func) (
/*@null@*/
const
yasm_expr__item
*ei,
/*@null@*/
void
*d));
320
329
YASM_LIB_DECL
330
int
yasm_expr__traverse_leaves_in
331
(
yasm_expr
*e,
/*@null@*/
void
*d,
332
int
(*func) (
/*@null@*/
yasm_expr__item
*ei,
/*@null@*/
void
*d));
333
342
YASM_LIB_DECL
343
void
yasm_expr__order_terms
(
yasm_expr
*e);
344
350
YASM_LIB_DECL
351
yasm_expr
*
yasm_expr__copy_except
(
const
yasm_expr
*e,
int
except);
352
359
YASM_LIB_DECL
360
int
yasm_expr__contains
(
const
yasm_expr
*e,
yasm_expr__type
t);
361
370
YASM_LIB_DECL
371
int
yasm_expr__bc_dist_subst
(
yasm_expr
**ep,
void
*cbd,
372
void
(*callback) (
unsigned
int
subst,
373
yasm_bytecode
*precbc,
374
yasm_bytecode
*precbc2,
375
void
*cbd));
376
384
YASM_LIB_DECL
385
int
yasm_expr__subst
(
yasm_expr
*e,
unsigned
int
num_items,
386
const
yasm_expr__item
*items);
387
388
#endif
Generated on Sat Jan 31 2015 01:25:12 for libyasm by
1.8.3.1