3 /* expr.h -> header file for expr.c
4 Copyright (C) 1987 Free Software Foundation, Inc.
6 This file is part of GAS, the GNU Assembler.
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 1, or (at your option)
13 GAS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GAS; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
23 #import "struc-symbol.h"
28 /* FROM expr.h line 46 */
29 /* A nonexistent expression. */
30 O_absent
= SEG_NONE
, /* HACK, this isn't going to work, absent ones come up
32 /* X_add_symbol + X_add_number. */
34 /* X_add_number (a constant expression). */
35 O_constant
= SEG_ABSOLUTE
,
36 /* A big value. If X_add_number is negative or 0, the value is in
37 generic_floating_point_number. Otherwise the value is in
38 generic_bignum, and X_add_number is the number of LITTLENUMs in
43 extern char *seg_name
[];
44 extern segT N_TYPE_seg
[];
47 * When an expression is SEG_BIG, it is in these globals (see comments above
48 * about SEG_BIG). This data may be clobbered whenever expr() is called.
50 extern FLONUM_TYPE generic_floating_point_number
;
51 extern LITTLENUM_TYPE generic_bignum
[];
52 #define SIZE_OF_LARGE_NUMBER (20) /* Number of littlenums in above */
53 /* generic_bignum which is enough to */
54 /* hold most precise flonum. */
57 * Abbreviations (mnemonics).
65 * By popular demand, we define a struct to represent an expression.
66 * This will no doubt mutate as expressions become baroque.
68 * Currently, we support expressions like "foo-bar+42".
69 * In other words we permit a (possibly undefined) minuend, a
70 * (possibly undefined) subtrahend and an (absolute) augend.
71 * RMS says this is so we can have 1-pass assembly for any compiler
72 * emmissions, and a 'case' statement might emit 'undefined1 - undefined2'.
74 * To simplify table-driven dispatch, we also have a "segment" for the
75 * entire expression. That way we don't require complex reasoning about
76 * whether particular components are defined; and we can change component
77 * semantics without re-working all the dispatch tables in the assembler.
78 * In other words the "type" of an expression is its segment.
81 // This isn't really up to date with GNU as, but it helps for source
84 #define X_op_symbol X_add_symbol
87 * To allow 32-bit architectures to use things like .quad we need to make
88 * all expressions be 64-bit regardless of the target architecture's address
92 typedef int64_t signed_expr_t
;
95 symbolS
*X_add_symbol
; /* foo */
96 symbolS
*X_subtract_symbol
; /* bar */
98 X_add_number
; /* 42 (must be signed) */
99 segT X_seg
; /* What segment (expr type) */
101 /* Non-zero if X_add_number should be regarded as unsigned. This is
102 only valid for O_constant expressions. It is only used when an
103 O_constant must be extended into a bignum (i.e., it is not used
104 when performing arithmetic on these values).
105 FIXME: This field is not set very reliably. */
106 unsigned int X_unsigned
: 1,
108 /* Non-zero if we have the special assembly time constant expression
109 of the difference of two symbols defined in the same section then divided
111 X_sectdiff_divide_by_two
: 1;
114 extern segT
expression(
115 expressionS
*resultP
);
116 extern char get_symbol_end(
118 extern segT
try_to_make_absolute(
119 expressionS
*expressionP
);
121 extern symbolS
*make_expr_symbol (expressionS
* expressionP
);
123 extern symbolS
*expr_build_uconstant (offsetT
);
124 #endif /* _EXPR_H_ */