OSDN Git Service

* config/i386/i386.c (ix86_expand_setcc): Don't use method 0
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / dgux.c
1 /* Subroutines for GNU compiler for Intel 80x86 running DG/ux
2    Copyright (C) 1993, 1995, 1997, 1999, 2000 Free Software Foundation, Inc.
3    Currently maintained by (gcc@dg-rtp.dg.com)
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC 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 GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #include <time.h>
23 #include "i386/i386.c"
24
25 struct lang_independent_option
26 {
27   char *string;
28   int *variable;
29   int on_value;
30   char *description;
31 };
32
33 static int
34 output_option (file, sep, type, name, indent, pos, max)
35      FILE *file;
36      char *sep;
37      char *type;
38      char *name;
39      char *indent;
40      int pos;
41      int max;
42 {
43   if (strlen (sep) + strlen (type) + strlen (name) + pos > max)
44     {
45       fprintf (file, indent);
46       return fprintf (file, "%s%s", type, name);
47     }
48   return pos + fprintf (file, "%s%s%s", sep, type, name);
49 }
50
51 static struct { 
52   char *name; 
53   int value; 
54   const char * description;
55 } m_options[] = TARGET_SWITCHES;
56
57 static void
58 output_options (file, f_options, f_len, W_options, W_len,
59                 pos, max, sep, indent, term)
60      FILE *file;
61      struct lang_independent_option *f_options;
62      struct lang_independent_option *W_options;
63      int f_len, W_len;
64      int pos;
65      int max;
66      int sep;
67      char *indent;
68      char *term;
69 {
70   register int j;
71
72   if (optimize)
73     pos = output_option (file, sep, "-O", "", indent, pos, max);
74   if (write_symbols != NO_DEBUG)
75     pos = output_option (file, sep, "-g", "", indent, pos, max);
76 /*  if (flag_traditional)
77     pos = output_option (file, sep, "-traditional", "", indent, pos, max);*/
78   if (profile_flag)
79     pos = output_option (file, sep, "-p", "", indent, pos, max);
80   if (profile_block_flag)
81     pos = output_option (file, sep, "-a", "", indent, pos, max);
82
83   for (j = 0; j < f_len; j++)
84     if (*f_options[j].variable == f_options[j].on_value)
85       pos = output_option (file, sep, "-f", f_options[j].string,
86                            indent, pos, max);
87
88   for (j = 0; j < W_len; j++)
89     if (*W_options[j].variable == W_options[j].on_value)
90       pos = output_option (file, sep, "-W", W_options[j].string,
91                            indent, pos, max);
92
93   for (j = 0; j < ARRAY_SIZE (m_options); j++)
94     if (m_options[j].name[0] != '\0'
95         && m_options[j].value > 0
96         && ((m_options[j].value & target_flags)
97             == m_options[j].value))
98       pos = output_option (file, sep, "-m", m_options[j].name,
99                            indent, pos, max);
100
101   if (ix86_cpu_string)
102     pos = output_option (file, sep, "-mcpu=", ix86_cpu_string, 
103                          indent, pos, max);
104   if (ix86_arch_string)
105     pos = output_option (file, sep, "-march=", ix86_arch_string, 
106                          indent, pos, max);
107   fprintf (file, term);
108 }
109
110 /* Output to FILE the start of the assembler file.  */
111
112 void
113 output_file_start (file, f_options, f_len, W_options, W_len)
114      FILE *file;
115      struct lang_independent_option *f_options;
116      struct lang_independent_option *W_options;
117      int f_len, W_len;
118 {
119   register int pos;
120
121   output_file_directive (file, main_input_filename);
122   fprintf (file, "\t.version\t\"01.01\"\n");                    \
123   /* Switch to the data section so that the coffsem symbol
124      isn't in the text section.  */
125   data_section ();
126
127   pos = fprintf (file, "\n// cc1 (%s) arguments:", VERSION_STRING);
128   output_options (file, f_options, f_len, W_options, W_len,
129                   pos, 75, " ", "\n// ", "\n\n");
130
131 #ifdef TARGET_IDENTIFY_REVISION
132   if (TARGET_IDENTIFY_REVISION)
133     {
134       char indent[256];
135
136       time_t now = time ((time_t *)0);
137       sprintf (indent, "]\"\n%s\"@(#)%s [", IDENT_ASM_OP, main_input_filename);
138       fprintf (file, indent+3);
139       pos = fprintf (file, "gcc %s, %.24s,", VERSION_STRING, ctime (&now));
140       output_options (file, f_options, f_len, W_options, W_len,
141                       pos, 150 - strlen (indent), " ", indent, "]\"\n\n");
142     }
143 #endif /* TARGET_IDENTIFY_REVISION */
144 }
145
146 #ifndef CROSS_COMPILE
147 #if defined (_abort_aux) 
148 /* Debugging aid to be registered via `atexit'.  See the definition
149    of abort in dgux.h.  */
150 void
151 abort_aux ()
152 {
153   extern int insn_;
154   extern char * file_;
155   extern int line_;
156   static int done;
157   rtx line_note;
158
159   if (done++)
160     return;
161   if (file_ || line_)
162     {
163       if (write_symbols != NO_DEBUG)
164         {
165           for (line_note = (rtx) insn_ ; line_note != 0 ; line_note = PREV_INSN (line_note))
166             if (GET_CODE (line_note) == NOTE && NOTE_LINE_NUMBER (line_note) > 0)
167               break;
168           if (line_note != 0)
169             {
170               error_with_file_and_line (NOTE_SOURCE_FILE (line_note),
171                                         NOTE_LINE_NUMBER (line_note),
172                                         "Internal gcc abort from %s:%d",
173                                         file_ ? file_ : "<nofile>", line_);
174               if (insn_ && file_ && strcmp (file_, "toplev.c"))
175                 {
176                   error_with_file_and_line (NOTE_SOURCE_FILE (line_note),
177                                             NOTE_LINE_NUMBER (line_note),
178                                             "The local variable `insn' has the value:", 0);
179                   debug_rtx ((rtx) insn_);
180                 }
181             }
182         }
183       if (write_symbols == NO_DEBUG || line_note == 0)
184         {
185           error ("Internal gcc abort from %s:%d",
186                  file_ ? file_ : "<nofile>", line_);
187           if (insn_ && file_ && strcmp (file_, "toplev.c"))
188             {
189               error ("The local variable `insn' has the value:", 0);
190               debug_rtx ((rtx) insn_);
191             }
192         }
193     }
194 }
195 #endif
196 #endif
197
198