source: trunk/src/binutils/gas/expr.h@ 29

Last change on this file since 29 was 10, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 6.0 KB
Line 
1/* expr.h -> header file for expr.c
2 Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
3 Free Software Foundation, Inc.
4
5 This file is part of GAS, the GNU Assembler.
6
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22/*
23 * By popular demand, we define a struct to represent an expression.
24 * This will no doubt mutate as expressions become baroque.
25 *
26 * Currently, we support expressions like "foo OP bar + 42". In other
27 * words we permit a (possibly undefined) symbol, a (possibly
28 * undefined) symbol and the operation used to combine the symbols,
29 * and an (absolute) augend. RMS says this is so we can have 1-pass
30 * assembly for any compiler emissions, and a 'case' statement might
31 * emit 'undefined1 - undefined2'.
32 *
33 * The type of an expression used to be stored as a segment. That got
34 * confusing because it overloaded the concept of a segment. I added
35 * an operator field, instead.
36 */
37
38/* This is the type of an expression. The operator types are also
39 used while parsing an expression.
40
41 NOTE: This enumeration must match the op_rank array in expr.c. */
42
43typedef enum {
44 /* An illegal expression. */
45 O_illegal,
46 /* A nonexistent expression. */
47 O_absent,
48 /* X_add_number (a constant expression). */
49 O_constant,
50 /* X_add_symbol + X_add_number. */
51 O_symbol,
52 /* X_add_symbol + X_add_number - the base address of the image. */
53 O_symbol_rva,
54 /* A register (X_add_number is register number). */
55 O_register,
56 /* A big value. If X_add_number is negative or 0, the value is in
57 generic_floating_point_number. Otherwise the value is in
58 generic_bignum, and X_add_number is the number of LITTLENUMs in
59 the value. */
60 O_big,
61 /* (- X_add_symbol) + X_add_number. */
62 O_uminus,
63 /* (~ X_add_symbol) + X_add_number. */
64 O_bit_not,
65 /* (! X_add_symbol) + X_add_number. */
66 O_logical_not,
67 /* (X_add_symbol * X_op_symbol) + X_add_number. */
68 O_multiply,
69 /* (X_add_symbol / X_op_symbol) + X_add_number. */
70 O_divide,
71 /* X_add_symbol % X_op_symbol) + X_add_number. */
72 O_modulus,
73 /* X_add_symbol << X_op_symbol) + X_add_number. */
74 O_left_shift,
75 /* X_add_symbol >> X_op_symbol) + X_add_number. */
76 O_right_shift,
77 /* X_add_symbol | X_op_symbol) + X_add_number. */
78 O_bit_inclusive_or,
79 /* X_add_symbol |~ X_op_symbol) + X_add_number. */
80 O_bit_or_not,
81 /* X_add_symbol ^ X_op_symbol) + X_add_number. */
82 O_bit_exclusive_or,
83 /* X_add_symbol & X_op_symbol) + X_add_number. */
84 O_bit_and,
85 /* X_add_symbol + X_op_symbol) + X_add_number. */
86 O_add,
87 /* X_add_symbol - X_op_symbol) + X_add_number. */
88 O_subtract,
89 /* (X_add_symbol == X_op_symbol) + X_add_number. */
90 O_eq,
91 /* (X_add_symbol != X_op_symbol) + X_add_number. */
92 O_ne,
93 /* (X_add_symbol < X_op_symbol) + X_add_number. */
94 O_lt,
95 /* (X_add_symbol <= X_op_symbol) + X_add_number. */
96 O_le,
97 /* (X_add_symbol >= X_op_symbol) + X_add_number. */
98 O_ge,
99 /* (X_add_symbol > X_op_symbol) + X_add_number. */