Implicitly add all "in" instance variables to each constructor's arg list
[delight/core.git] / dt.h
blob0d41fb55e51fce9da15f67afe24d3916b3b1dfcd
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_DT_H
20 #define DMD_DT_H
22 #include "symbol.h"
23 #include "d-gcc-tree.h"
25 enum DT {
26 DT_azeros,
27 DT_common,
28 DT_nbytes,
29 DT_abytes,
30 DT_word,
31 DT_xoff,
32 DT_1byte,
33 DT_tree,
34 DT_container
37 struct Type;
39 struct dt_t {
40 enum DT dt;
41 struct dt_t * DTnext;
42 union {
43 integer_t DTint;
44 integer_t DTazeros;
45 integer_t DTonebyte;
46 struct dt_t * DTvalues;
48 union {
49 Symbol * DTsym;
50 tree DTtree;
51 void * DTpointer;
52 Type * DTtype;
56 enum TypeType;
58 extern dt_t** dtval(dt_t** pdt, DT t, integer_t i, void * p);
59 extern dt_t** dtcat(dt_t** pdt, dt_t * d);
61 inline dt_t**
62 dtnbytes(dt_t** pdt, size_t count, char * pbytes) {
63 return dtval(pdt, DT_nbytes, count, pbytes); }
65 inline dt_t**
66 dtabytes(dt_t** pdt, TypeType, int, size_t count, char * pbytes) {
67 return dtval(pdt, DT_abytes, count, pbytes); }
69 inline dt_t**
70 dtnzeros(dt_t** pdt, target_size_t count) {
71 return dtval(pdt, DT_azeros, count, 0); }
73 inline dt_t**
74 dtdword(dt_t** pdt, target_size_t val) {
75 return dtval(pdt, DT_word, val, 0); }
77 inline dt_t**
78 dtxoff(dt_t** pdt, Symbol * sym, target_size_t offset, TypeType) {
79 return dtval(pdt, DT_xoff, offset, sym); }
81 inline dt_t**
82 dttree(dt_t** pdt, tree t) {
83 return dtval(pdt, DT_tree, 0, t); }
85 inline void
86 dt_optimize(dt_t *) { }
87 // %% should be integer_t?, but when used in todt.c, it's assigned to an unsigned
88 target_size_t dt_size(dt_t * dt);
90 // Added for GCC to get correct byte ordering / size
91 extern dt_t** dtnbits(dt_t** pdt, size_t count, char * pbytes, unsigned unit_size);
92 extern dt_t** dtnwords(dt_t** pdt, size_t word_count, void * pwords, unsigned word_size);
93 extern dt_t** dtawords(dt_t** pdt, size_t word_count, void * pwords, unsigned word_size);
94 extern dt_t** dti32(dt_t** pdt, unsigned val, int pad_to_word);
96 // Added for GCC to match types for SRA pass
97 extern dt_t** dtcontainer(dt_t** pdt, Type * type, dt_t* values);
99 #endif