comparison dmd/backend/Symbol.d @ 69:c876339731a4

dead code removed
author korDen
date Tue, 24 Aug 2010 16:59:45 +0400
parents fd4acc376c45
children e28b18c23469
comparison
equal deleted inserted replaced
68:ee3a9f34dc48 69:c876339731a4
146 } 146 }
147 147
148 std.stdio.writefln("(*foo).Sclass %d = %d", (cast(char*)&foo.Sclass - cast(char*)foo), cast(int)foo.Sclass); 148 std.stdio.writefln("(*foo).Sclass %d = %d", (cast(char*)&foo.Sclass - cast(char*)foo), cast(int)foo.Sclass);
149 //std.stdio.writeln("printf(\"(*foo).Sclass %d %d\\n\", ((char*)&foo->Sclass - (char*)foo), (int)foo->Sclass);"); 149 //std.stdio.writeln("printf(\"(*foo).Sclass %d %d\\n\", ((char*)&foo->Sclass - (char*)foo), (int)foo->Sclass);");
150 } 150 }
151
152 /+
153 struct Symbol
154 {
155 debug {
156 ushort id;
157 ///#define IDsymbol 0x5678
158 ///#define symbol_debug(s) assert((s)->id == IDsymbol)
159 ///#define class_debug(s) assert((s)->id == IDsymbol)
160 } else {
161 ///#define symbol_debug(s)
162 ///#define class_debug(s)
163 }
164
165 Symbol* Sl;
166 Symbol* Sr; // left, right child
167
168 version (TX86) {
169 Symbol *Snext; // next in threaded list
170 }
171 dt_t* Sdt; // variables: initializer
172 type* Stype; // type of Symbol
173
174 auto ty() {
175 assert(false);
176 //return Stype.Tty;
177 }
178
179 auto Senumlist()
180 {
181 return Senum.SEenumlist;
182 }
183
184 union // variants for different Symbol types
185 {
186 enum_t* Senum; // SCenum
187 struct
188 {
189 func_t* Sfunc; // tyfunc
190 list_t Spath1; // SCfuncalias member functions: same as Spath
191 // and in same position
192 // SCadl: list of associated functions for ADL lookup
193 }
194 struct // SClabel
195 {
196 int Slabel; // TRUE if label was defined
197 block* Slabelblk_; // label block
198 }
199
200 version (TX86) {
201 struct // SClinkage
202 {
203 long Slinkage; // tym linkage bits
204 uint Smangle;
205 }
206 } else {
207 long Slinkage; // SClinkage, tym linkage bits
208 }
209
210 struct
211 {
212 char Sbit; // SCfield: bit position of start of bit field
213 char Swidth; // SCfield: width in bits of bit field
214 version (TX86) {
215 targ_size_t Smemoff; // SCmember,SCfield: offset from start of struct
216 }
217 }
218
219 elem* Svalue; /* SFLvalue: value of const
220 SFLdtorexp: for objects with destructor,
221 conditional expression to precede dtor call
222 */
223 struct_t* Sstruct; // SCstruct
224
225 template_t* Stemplate; // SCtemplate
226
227 version (SCPP) {
228 struct // SCnamespace
229 {
230 Symbol* Snameroot; // the Symbol table for the namespace
231 list_t Susing; // other namespaces from using-directives
232 }
233 struct
234 {
235 Symbol* Smemalias; // SCalias: pointer to Symbol to use instead
236 // (generated by using-declarations and
237 // namespace-alias-definitions)
238 // SCmemalias: pointer to member of base class
239 // to use instead (using-declarations)
240 symlist_t Spath; // SCmemalias: path of classes to get to base
241 // class of which Salias is a member
242 }
243 }
244
245 version (TX86) {
246 Symbol* Simport; // SCextern: if dllimport Symbol, this is the
247 // Symbol it was imported from
248 }
249 ubyte Spreg; // SCfastpar: register parameter is passed in
250 }
251
252 version (SCPP_OR_MARS) {
253 Symbol* Sscope; // enclosing scope (could be struct tag,
254 // enclosing inline function for statics,
255 // or namespace)
256 //#define isclassmember(s) ((s)->Sscope && (s)->Sscope->Sclass == SCstruct)
257 }
258
259 version (SCPP) {
260 Symbol* Scover; // if there is a tag name and a regular name
261 // of the same identifier, Scover is the tag
262 // Scover can be SCstruct, SCenum, SCtemplate
263 // or an SCalias to them.
264 //#define isscover(s) ((s)->Sclass == SCstruct || (s)->Sclass == SCenum || (s)->Sclass == SCtemplate)
265 uint Ssequence; // sequence number (used for 2 level lookup)
266 // also used as 'parameter number' for SCTtemparg
267 } else version (MARS) {
268 const(char)* prettyIdent; // the symbol identifer as the user sees it
269 } else version (AUTONEST) {
270 ubyte Spush; // # of pushes followed by # of
271 ubyte Spop; // pops of scope level
272 }
273
274 version (ELFOBJ_OR_MACHOBJ) {
275 int obj_si; // Symbol index of coff or elf symbol
276 uint dwarf_off; // offset into .debug section
277 targ_size_t code_off; // rel. offset from start of block where var is initialized
278 targ_size_t last_off; // last offset using var
279 }
280
281 version (TARGET_OSX) {
282 targ_size_t Slocalgotoffset;
283 }
284
285 SC Sclass; // storage class (SCxxxx)
286 char Sfl; // flavor (FLxxxx)
287 SYMFLGS Sflags; // flag bits (SFLxxxx)
288 /// #define SFLmark 0x08 // temporary marker
289 /// #define SFLvalue 0x01 // Svalue contains const expression
290 /// #define SFLimplem 0x02 // if seen implementation of Symbol
291 // (function body for functions,
292 // initializer for variables)
293 /// #define SFLdouble 0x02 // SCregpar or SCparameter, where float
294 // is really passed as a double
295 /// #define SFLfree 0x04 // if we can symbol_free() a Symbol in
296 // a Symbol table[]
297 /// #define SFLexit 0x10 // tyfunc: function does not return
298 // (ex: exit,abort,_assert,longjmp)
299 /// #define SFLtrue 0x200 // value of Symbol != 0
300 /// #define SFLreplace SFLmark // variable gets replaced in inline expansion
301 /// #define SFLskipinit 0x10000 // SCfield, SCmember: initializer is skipped
302 /// #define SFLnodebug 0x20000 // don't generate debug info
303 /// #define SFLwasstatic 0x800000 // was an uninitialized static
304 /// #define SFLweak 0x1000000 // resolve to NULL if not found
305
306 // CPP
307 /// #define SFLnodtor 0x10 // set if destructor for Symbol is already called
308 /// #define SFLdtorexp 0x80 // Svalue has expression to tack onto dtor
309 /// #define SFLmutable 0x100000 // SCmember or SCfield is mutable
310 /// #define SFLdyninit 0x200000 // symbol has dynamic initializer
311 /// #define SFLtmp 0x400000 // symbol is a generated temporary
312 version (XXX) { ///TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS
313 ///#define SFLthunk 0x40000 // symbol is temporary for thunk
314 }
315
316 // Possible values for protection bits
317 /// #define SFLprivate 0x60
318 /// #define SFLprotected 0x40
319 /// #define SFLpublic 0x20
320 /// #define SFLnone 0x00
321 /// #define SFLpmask 0x60 // mask for the protection bits
322 version (VEC_VTBL_LIST) {
323 /// #define SFLvtbl 0x2000 // Symbol is a vtable or vbtable
324 }
325
326 // OPTIMIZER and CODGEN
327 /// #define GTregcand 0x100 // if Symbol is a register candidate
328 /// #define SFLdead 0x800 // this variable is dead
329
330 // OPTIMIZER only
331 /// #define SFLunambig 0x400 // only accessible by unambiguous reference,
332 // i.e. cannot be addressed via pointer
333 // (GTregcand is a subset of this)
334 // P.S. code generator turns off this
335 // flag if any reads are done from it.
336 // This is to eliminate stores to it
337 // that are never read.
338 /// #define SFLlivexit 0x1000 // live on exit from function
339 /// #define SFLnotbasiciv 0x4000 // not a basic induction variable
340 /// #define SFLnord SFLdouble // SCauto,SCregister,SCtmp: disallow redundant warnings
341
342 // CODGEN only
343 /// #define GTtried SFLmark // tried to place in register
344 /// #define GTbyte 0x8000 // variable is sometimes accessed as
345 /// #define SFLread 0x40000 // variable is actually read from
346 // (to eliminate dead stores)
347 /// #define SFLspill 0x80000 // only in register part of the time
348
349 vec_t Srange; // live range, if any
350 vec_t Slvreg; // when symbol is in register
351 targ_size_t Ssize; // tyfunc: size of function
352 targ_size_t Soffset; // variables: offset of Symbol in its storage class
353 version (TARGET_MAC) {
354 ///#define Smemoff Soffset
355 }
356
357 // CPP || OPTIMIZER
358 SYMIDX Ssymnum; // Symbol number (index into globsym.tab[])
359 // SCauto,SCparameter,SCtmp,SCregpar,SCregister
360 // CODGEN
361 version (TX86) {
362 short Sseg; // segment index
363 }
364 int Sweight; // usage count, the higher the number,
365 // the more worthwhile it is to put in
366 // a register
367 union
368 {
369 uint Sxtrnnum; // SCcomdef,SCextern,SCcomdat: external symbol # (starting from 1)
370 uint Stypidx; // SCstruct,SCunion,SCclass,SCenum,SCtypedef: debug info type index
371 struct
372 {
373 ubyte Sreglsw;
374 ubyte Sregmsw;
375 regm_t Sregm; // mask of registers
376 } // SCregister,SCregpar,SCpseudo: register number
377 }
378
379 version (TX86) {
380 regm_t Sregsaved; // mask of registers not affected by this func
381 }
382
383 version (SOURCE_4SYMS) {
384 Srcpos Ssrcpos; // file position for definition
385 }
386 // Target Additions
387 /// TARGET_structSYMBOL
388 version (TX86) {
389 char Sident[SYM_PREDEF_SZ]; // identifier string (dynamic array)
390 // (the size is for static Symbols)
391 } else {
392 long[0] Sident; // identifier string (dynamic array) as a str4
393 }
394
395 bool needThis() // true if symbol needs a 'this' pointer
396 {
397 assert(false);
398 }
399 }
400 +/