OSDN Git Service

Instructions and patches for building GNAT with EGCS.
[pf3gnuchains/gcc-fork.git] / gcc / README.gnat
1 The following patches are needed in order to build GNAT with EGCS.
2
3 These patches were tested with egcs-980308 and gnat-3.10p on a mips-sgi-irix6.3
4 system.  The gnat build succeeded as per the instructions in the gnat
5 README.BUILD file for building one library, except that CFLAGS="-O -g" and
6 GNATLIBCFLAGS="-O -g" were substituted for the recommended "-O2" so that the
7 build could be debugged.  There was no attempt to run the resulting build
8 against any testsuite or validation suite.
9
10 --
11
12 Developers Notes:
13
14 Every use of sizetype in the Ada front end should be checked to see if perhaps
15 it should be using bitsizetype instead.  The change to maybe_pad_type is just
16 a hack to work around this problem, and may not be desirable in the long term.
17
18 There are many places in the Ada front end where it calls operand_equal_p to
19 see if two type sizes are the same.  operand_equal_p fails if the two
20 arguments have different TYPE_MODEs.  sizetype and bitsizetype can have
21 different TYPE_MODEs.  Thus this code can fail if one type size is based
22 on sizetype, and the other is based on bitsizetype.  The change to
23 maybe_pad_type fixes one very critical place where this happens.  There may
24 be others.
25
26 --
27
28 Mon Mar 16 11:00:25 1998  Jim Wilson  <wilson@cygnus.com>
29
30         * a-gtran3.c (maybe_pad_type): Convert both size and orig_size to
31         sizetype if they have differing modes.
32         * a-misc.c (gnat_tree_code_type): Change from string to char array.
33         (init_lex): Delete realloc calls for tree_code_* globals.  Adjust
34         bcopy call for gnat_tree_code_type change.
35         * a-tree.def: Adjust for tree_code_* type changes.
36
37 diff -pr gnat-3.10p-src/src/ada/a-gtran3.c egcs-980308/gcc/ada/a-gtran3.c
38 *** gnat-3.10p-src/src/ada/a-gtran3.c   Wed Aug 13 21:02:17 1997
39 --- egcs-980308/gcc/ada/a-gtran3.c      Sat Mar 14 18:33:51 1998
40 *************** maybe_pad_type (type, size, align, gnat_
41 *** 3330,3335 ****
42 --- 3330,3342 ----
43        changed.  Then return if we aren't doing anything.  */
44   
45     if (size != 0
46 +       && TYPE_MODE (TREE_TYPE (size)) != TYPE_MODE (TREE_TYPE (orig_size)))
47 +     {
48 +       size = convert (sizetype, size);
49 +       orig_size = convert (sizetype, orig_size);
50 +     }
51
52 +   if (size != 0
53         && (operand_equal_p (size, orig_size, 0)
54           || (TREE_CODE (orig_size) == INTEGER_CST
55               && tree_int_cst_lt (size, orig_size)))
56 diff -pr gnat-3.10p-src/src/ada/a-misc.c egcs-980308/gcc/ada/a-misc.c
57 *** gnat-3.10p-src/src/ada/a-misc.c     Wed Aug 13 21:02:18 1997
58 --- egcs-980308/gcc/ada/a-misc.c        Tue Mar 10 18:39:13 1998
59 *************** extern char *main_input_filename;
60 *** 70,77 ****
61   
62   #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
63   
64 ! char *gnat_tree_code_type[] = {
65 !   "x",
66   #include "a-tree.def"
67   };
68   #undef DEFTREECODE
69 --- 70,77 ----
70   
71   #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
72   
73 ! char gnat_tree_code_type[] = {
74 !   'x',
75   #include "a-tree.def"
76   };
77   #undef DEFTREECODE
78 *************** init_lex ()
79 *** 607,626 ****
80   {
81     lang_expand_expr = gnat_expand_expr;
82   
83 -   tree_code_type
84 -     = (char **) realloc (tree_code_type,
85 -                        sizeof (char *) * LAST_GNAT_TREE_CODE);
86 -   tree_code_length
87 -     = (int *) realloc (tree_code_length,
88 -                      sizeof (int) * LAST_GNAT_TREE_CODE);
89 -   tree_code_name
90 -     = (char **) realloc (tree_code_name,
91 -                        sizeof (char *) * LAST_GNAT_TREE_CODE);
92
93     bcopy ((char *) gnat_tree_code_type,
94          (char *) (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE),
95 !        ((LAST_GNAT_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
96 !         * sizeof (char *)));
97   
98     bcopy ((char *)gnat_tree_code_length,
99          (char *) (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
100 --- 607,615 ----
101   {
102     lang_expand_expr = gnat_expand_expr;
103   
104     bcopy ((char *) gnat_tree_code_type,
105          (char *) (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE),
106 !        LAST_GNAT_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE);
107   
108     bcopy ((char *)gnat_tree_code_length,
109          (char *) (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
110 diff -pr gnat-3.10p-src/src/ada/a-tree.def egcs-980308/gcc/ada/a-tree.def
111 *** gnat-3.10p-src/src/ada/a-tree.def   Wed Aug 13 21:02:20 1997
112 --- egcs-980308/gcc/ada/a-tree.def      Tue Mar 10 18:39:54 1998
113 ***************
114 *** 31,69 ****
115      The only field used if TREE_COMPLEXITY, which contains the GNAT node
116      number.  */
117   
118 ! DEFTREECODE (TRANSFORM_EXPR, "transform_expr", "e", 0)
119   
120   /* Perform an unchecked conversion between the input and the output. 
121      if TREE_ADDRESSABLE is set, it means this is in an LHS; in that case,
122      we can only use techniques, such as pointer punning, that leave the
123      expression a "name".  */
124   
125 ! DEFTREECODE (UNCHECKED_CONVERT_EXPR, "unchecked_convert_expr", "1", 1)
126   
127   /* A type that is an unconstrained array itself.  This node is never passed
128      to GCC. TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE
129      is the type of a record containing the template and data.  */
130   
131 ! DEFTREECODE (UNCONSTRAINED_ARRAY_TYPE, "unconstrained_array_type", "t", 0)
132   
133   /* A reference to an unconstrained array.  This node only exists as an
134      intermediate node during the translation of a GNAT tree to a GCC tree;
135      it is never passed to GCC.  The only field used is operand 0, which
136      is the fat pointer object.  */
137   
138 ! DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref", "r", 1)
139   
140   /* An expression that returns an RTL suitable for its type.  Operand 0
141      is an expression to be evaluated for side effects only.  */
142   
143 ! DEFTREECODE (NULL_EXPR, "null_expr", "e", 1)
144   
145   /* An expression that emits a USE for its single operand.  */
146   
147 ! DEFTREECODE (USE_EXPR, "use_expr", "e", 1)
148   
149   /* An expression that is treated as a conversion while generating code, but is
150      used to prevent infinite recursion when conversions of biased types are
151      involved.  */
152   
153 ! DEFTREECODE (GNAT_NOP_EXPR, "gnat_nop_expr", "1", 1)
154 --- 31,69 ----
155      The only field used if TREE_COMPLEXITY, which contains the GNAT node
156      number.  */
157   
158 ! DEFTREECODE (TRANSFORM_EXPR, "transform_expr", 'e', 0)
159   
160   /* Perform an unchecked conversion between the input and the output. 
161      if TREE_ADDRESSABLE is set, it means this is in an LHS; in that case,
162      we can only use techniques, such as pointer punning, that leave the
163      expression a "name".  */
164   
165 ! DEFTREECODE (UNCHECKED_CONVERT_EXPR, "unchecked_convert_expr", '1', 1)
166   
167   /* A type that is an unconstrained array itself.  This node is never passed
168      to GCC. TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE
169      is the type of a record containing the template and data.  */
170   
171 ! DEFTREECODE (UNCONSTRAINED_ARRAY_TYPE, "unconstrained_array_type", 't', 0)
172   
173   /* A reference to an unconstrained array.  This node only exists as an
174      intermediate node during the translation of a GNAT tree to a GCC tree;
175      it is never passed to GCC.  The only field used is operand 0, which
176      is the fat pointer object.  */
177   
178 ! DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref", 'r', 1)
179   
180   /* An expression that returns an RTL suitable for its type.  Operand 0
181      is an expression to be evaluated for side effects only.  */
182   
183 ! DEFTREECODE (NULL_EXPR, "null_expr", 'e', 1)
184   
185   /* An expression that emits a USE for its single operand.  */
186   
187 ! DEFTREECODE (USE_EXPR, "use_expr", 'e', 1)
188   
189   /* An expression that is treated as a conversion while generating code, but is
190      used to prevent infinite recursion when conversions of biased types are
191      involved.  */
192   
193 ! DEFTREECODE (GNAT_NOP_EXPR, "gnat_nop_expr", '1', 1)