ldexp.h revision 33965
1/* ldexp.h -
2   Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
3
4   This file is part of GLD, the Gnu Linker.
5
6   GLD is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   GLD is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with GLD; see the file COPYING.  If not, write to
18   the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19
20#ifndef LDEXP_H
21#define LDEXP_H
22
23/* The result of an expression tree */
24typedef struct
25{
26  bfd_vma value;
27  struct lang_output_section_statement_struct *section;
28  boolean valid;
29} etree_value_type;
30
31
32
33typedef struct
34{
35  int node_code;
36  enum { etree_binary,
37	   etree_trinary,
38	   etree_unary,
39	   etree_name,
40	   etree_assign,
41	   etree_provide,
42	   etree_undef,
43	   etree_unspec,
44	   etree_value,
45	   etree_rel } node_class;
46} node_type;
47
48
49
50typedef union etree_union
51{
52  node_type type;
53  struct {
54    node_type type;
55    union etree_union *lhs;
56    union etree_union *rhs;
57  } binary;
58  struct {
59    node_type type;
60    union etree_union *cond;
61    union etree_union *lhs;
62    union etree_union *rhs;
63  } trinary;
64  struct {
65    node_type type;
66    CONST char *dst;
67    union etree_union *src;
68  } assign;
69
70  struct {
71    node_type type;
72    union   etree_union *child;
73  } unary;
74  struct {
75    node_type type;
76   CONST char *name;
77  } name;
78  struct {
79    node_type type;
80    bfd_vma value;
81  } value;
82  struct {
83    node_type type;
84    asection *section;
85    bfd_vma value;
86  } rel;
87
88} etree_type;
89
90
91etree_type *exp_intop PARAMS ((bfd_vma));
92etree_type *exp_relop PARAMS ((asection *, bfd_vma));
93etree_value_type invalid PARAMS ((void));
94etree_value_type exp_fold_tree PARAMS ((etree_type *, struct
95					lang_output_section_statement_struct *,
96					lang_phase_type,
97					bfd_vma, bfd_vma *));
98etree_type *exp_binop PARAMS ((int, etree_type *, etree_type *));
99etree_type *exp_trinop PARAMS ((int,etree_type *, etree_type *, etree_type *));
100etree_type *exp_unop PARAMS ((int, etree_type *));
101etree_type *exp_nameop PARAMS ((int, CONST char *));
102etree_type *exp_assop PARAMS ((int, CONST char *, etree_type *));
103etree_type *exp_provide PARAMS ((const char *, etree_type *));
104void exp_print_tree PARAMS ((etree_type *));
105bfd_vma exp_get_vma PARAMS ((etree_type *, bfd_vma, char *, lang_phase_type));
106int exp_get_value_int PARAMS ((etree_type *, int, char *,lang_phase_type));
107bfd_vma exp_get_abs_int PARAMS ((etree_type *, int, char *,lang_phase_type));
108
109#endif
110