]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/treelang/treelang.h
mips-protos.h (mips_simplify_dwarf_addr): Remove.
[thirdparty/gcc.git] / gcc / treelang / treelang.h
CommitLineData
6cfea11b
TJ
1/*
2
3 TREELANG Compiler common definitions (treelang.h)
4
27f94314 5 Copyright (C) 1986, 87, 89, 92-96, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6cfea11b
TJ
6
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
11
12 This program 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 this program; if not, write to the Free Software
19 Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
21
22 In other words, you are welcome to use, share and improve this program.
23 You are forbidden to forbid anyone else to use, share and improve
24 what you give them. Help stamp out software-hoarding!
25
26 ---------------------------------------------------------------------------
27
28 Written by Tim Josling 1999, 2000, 2001, based in part on other
29 parts of the GCC compiler.
30
31*/
32
33/* Parse structure type. */
34enum category_enum
35{ /* These values less likely to be there by chance unlike 0/1,
36 make checks more meaningful */
37 token_category = 111,
96e3ac4f
TJ
38 production_category = 222,
39 parameter_category = 333
6cfea11b
TJ
40};
41
42/* Input file name and FILE. */
4bfec483 43extern const char* in_fname;
6cfea11b
TJ
44extern FILE* yyin;
45
96e3ac4f
TJ
46/* Forward references to satisfy mutually recursive definitions. */
47struct token_part;
48struct production_part;
49struct prod_token_parm_item;
50typedef struct GTY(()) prod_token_parm_item item;
6cfea11b 51
96e3ac4f
TJ
52/* A token from the input file. */
53
54struct token_part GTY(())
6cfea11b 55{
6cfea11b
TJ
56 unsigned int lineno;
57 unsigned int charno;
58 unsigned int length; /* The value. */
59 unsigned char* chars;
60};
61
96e3ac4f
TJ
62/* Definitions for fields in production. */
63#define NESTING_LEVEL(a) a->tp.pro.info[0] /* Level used for variable definitions. */
64#define NUMERIC_TYPE(a) a->tp.pro.info[1] /* Numeric type used in type definitions and expressions. */
65#define SUB_COUNT 5
66#define SYMBOL_TABLE_NAME(a) (a->tp.pro.sub[0]) /* Name token. */
67#define EXPRESSION_TYPE(a) (a->tp.pro.sub[1]) /* Type identifier. */
68#define OP1(a) (a->tp.pro.sub[2]) /* Exp operand1. */
69#define PARAMETERS(a) (a->tp.pro.sub[2]) /* Function parameters. */
70#define VARIABLE(a) (a->tp.pro.sub[2]) /* Parameter variable ptr. */
71#define VAR_INIT(a) (a->tp.pro.sub[2]) /* Variable init. */
72#define OP2(a) (a->tp.pro.sub[3]) /* Exp operand2. */
73#define FIRST_PARMS(a) (a->tp.pro.sub[3]) /* Function parameters linked via struct tree_parameter_list. */
74#define OP3(a) (a->tp.pro.sub[4]) /* Exp operand3. */
75#define STORAGE_CLASS_TOKEN(a) (a->tp.pro.sub[4]) /* Storage class token. */
76#define STORAGE_CLASS(a) a->tp.pro.flag1 /* Values in treetree.h. */
77
78struct production_part GTY(())
6cfea11b 79{
96e3ac4f 80 struct prod_token_parm_item *main_token; /* Main token for error msgs; variable name token. */
6cfea11b
TJ
81
82 unsigned int info[2]; /* Extra information. */
6cfea11b 83
96e3ac4f
TJ
84 struct prod_token_parm_item *sub[SUB_COUNT]; /* Sub productions or tokens. */
85 tree code; /* Back end hook for this item. */
86 struct prod_token_parm_item *next; /* Next in chains of various types. */
6cfea11b
TJ
87
88 unsigned int flag1:2;
6cfea11b
TJ
89 unsigned int flag2:1;
90 unsigned int flag3:1;
91 unsigned int flag4:1;
92 unsigned int flag5:1;
93 unsigned int flag6:1;
94 unsigned int flag7:1;
95
96};
97
96e3ac4f
TJ
98/* Storage modes. */
99#define STATIC_STORAGE 0
100#define AUTOMATIC_STORAGE 1
101#define EXTERNAL_REFERENCE_STORAGE 2
102#define EXTERNAL_DEFINITION_STORAGE 3
103
104/* Numeric types. */
105#define SIGNED_CHAR 1
106#define UNSIGNED_CHAR 2
107#define SIGNED_INT 3
108#define UNSIGNED_INT 4
109#define VOID_TYPE 5
110
111/* Expression types. */
112#define EXP_PLUS 0 /* Addition expression. */
113#define EXP_REFERENCE 1 /* Variable reference. */
114#define EXP_ASSIGN 2 /* Assignment. */
115#define EXP_FUNCTION_INVOCATION 3 /* Call function. */
116#define EXP_MINUS 4 /* Subtraction. */
117#define EXP_EQUALS 5 /* Equality test. */
118
119/* Parameter list passed to back end. */
120struct parameter_part GTY(())
121{
122 struct prod_token_parm_item *next; /* Next entry. */
123 unsigned char* variable_name; /* Name. */
124 tree * GTY ((length ("1"))) where_to_put_var_tree; /* Where to save decl. */
125};
126
127/* A production or a token. */
128struct prod_token_parm_item GTY(())
129{
130 enum category_enum category; /* Token or production. */
131 unsigned int type; /* Token or production type. */
132 union t_or_p
133 {
134 struct token_part GTY((tag ("token_category"))) tok;
135 struct production_part GTY((tag ("production_category"))) pro;
136 struct parameter_part GTY((tag ("parameter_category"))) par;
137 } GTY((desc ("((item *)&%1)->category"))) tp;
138};
139
140
6cfea11b
TJ
141/* For parser. Alternatively you can define it using %union (bison) or
142 union. */
143#define YYSTYPE void *
144
145void *my_malloc (size_t size);
96e3ac4f
TJ
146int insert_tree_name (struct prod_token_parm_item *prod);
147struct prod_token_parm_item *lookup_tree_name (struct prod_token_parm_item *prod);
148struct prod_token_parm_item *make_production (int type, struct prod_token_parm_item *main_tok);
149void mark_production_used (struct prod_token_parm_item *pp);
150void mark_token_used (struct prod_token_parm_item *tt);
6cfea11b
TJ
151void treelang_debug (void);
152
27f94314 153void sanity_check (struct prod_token_parm_item *item);