Allow maybe annotations even for D code
[delight/core.git] / symbol.h
blob12ab35c0b371bfff37520711d44cba16b66e552a
1 /* GDC -- D front-end for GCC
2 Copyright (C) 2004 David Friedman
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef DMD_SYMBOL_H
20 #define DMD_SYMBOL_H
22 #include "root.h"
24 #include "d-gcc-tree.h"
26 #include "mtype.h"
28 enum mangle_t
30 mTY_INVALID,
31 mTYman_c,
32 mTYman_cpp,
33 mTYman_std,
34 mTYman_pas,
35 mTYman_d
38 enum TypeType
40 // no clue about which can be used together..
41 TYnptr = 0x001,
42 TYnfunc = 0x010,
43 TYjfunc = 0x020,
44 TYstruct = 0x040,
45 TYarray = 0x080,
46 TYbit = 0x100,
47 TYint = 0x200,
48 mTYconst = 0x1000,
49 mTYvolatile = 0x2000
52 typedef int tym_t;
54 enum TypeFlag
56 TFsizeunknown = 0x01,
57 TFforward = 0x02,
58 TFprototype = 0x04,
59 TFfixed = 0x08
63 struct TYPE : Object
65 tym_t Tty;
66 mangle_t Tmangle;
67 TYPE * Tnext;
68 int Tcount;
69 int Tflags;
70 void * Ttag;
71 void * Tparamtypes;
72 tree Ttree;
74 TYPE();
77 extern TYPE * tsvoid;
79 extern TYPE * type_alloc(tym_t ty); // ty: combination of TypeType values
80 extern TYPE * type_fake(tym_t ty);
81 extern void type_setcv(TYPE ** pp_type, int ty);
82 extern void type_setmangle(TYPE ** pp_type, mangle_t mangle);
83 extern int/ *?* / type_paramsize(TYPE * t);
86 enum SymbolStorageClass
88 SC_INVALID,
89 SCextern,
90 SCstatic,
91 SCauto,
92 SCglobal,
93 SCstruct,
94 SCcomdat
97 typedef enum SymbolStorageClass enum_SC;
99 enum SymbolFL
101 FL_INVALID,
102 FLextern = 0x01,
103 FLauto = 0x02,
104 FLdata = 0x04,
107 enum SymbolFlag
109 SFLimplem = 0x01,
110 SFLnodebug = 0x02,
111 STRglobal = 0x04,
112 SFLweak = 0x08
115 enum SymbolSegment
117 DATA,
118 CDATA,
119 UDATA
122 // not sure if this needs to inherit object..
123 // union tree_node; typedef union tree_node dt_t;
124 struct dt_t;
126 enum OutputStage
128 NotStarted,
129 InProgress,
130 Finished
133 struct FuncFrameInfo;
135 struct Symbol : Object
137 Symbol();
139 char *Sident;
140 //unused in GCC//TYPE *Stype; // maybe type/TYPE ?
141 SymbolStorageClass Sclass;
142 SymbolFL Sfl;
143 SymbolSegment Sseg;
144 int Sflags;
146 //unused in GCC//int Ssymnum;
148 dt_t * Sdt;
150 // fake classsym....
151 //unused in GCC//Symbol * Sstruct;
152 //unused in GCC//int Sstructalign;
154 // Specific to GNU backend
155 tree Stree;
156 tree ScontextDecl; // The DECL_CONTEXT to use for child declarations, but see IRState::declContext
157 unsigned Sunique; // For conflicting symbol names
158 #if V2
159 tree SclosureField; // FIELD_DECL in closure frame struct that this variable is allocated in -- Eventually move back into Stree once everything works right
160 #endif
162 // For FuncDeclarations:
163 Array * thunks; // of struct Thunk
164 FuncDeclarations * otherNestedFuncs;
165 OutputStage outputStage;
166 FuncFrameInfo *frameInfo;
169 struct Thunk
171 target_ptrdiff_t offset;
172 Symbol * symbol;
173 Thunk();
176 extern Symbol * symbol_calloc(const char * string);
177 extern Symbol * symbol_name(const char * id, int sclass, TYPE * t);
178 extern Symbol * struct_calloc();
179 extern Symbol * symbol_generate(SymbolStorageClass sc, TYPE * type);
180 extern void symbol_func(Symbol * sym);
181 extern void outdata(Symbol * sym);
182 inline void obj_export(Symbol *, int) { }
183 extern void obj_moduleinfo(Symbol *sym);
185 extern Symbol * symbol_tree(tree);
186 extern Symbol * static_sym();
188 #endif