1 /* Definitions for Sun assembler syntax for the Intel 80386.
2 Copyright (C) 1988, 1996, 2000 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 /* Include common aspects of all 386 Unix assemblers. */
23 #include "i386/unix.h"
25 #define TARGET_VERSION fprintf (stderr, " (80386, Sun syntax)");
27 /* Define the syntax of instructions and addresses. */
29 /* Prefix for internally generated assembler labels. */
32 /* Define the syntax of pseudo-ops, labels and comments. */
34 /* Assembler pseudos to introduce constants of various size. */
36 #define ASM_BYTE_OP "\t.byte\t"
37 #define ASM_SHORT "\t.value\t"
38 #define ASM_LONG "\t.long\t"
40 /* How to output an ASCII string constant. */
42 #define ASM_OUTPUT_ASCII(FILE, p, size) \
46 { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n"); \
47 fprintf ((FILE), "%s", ASM_BYTE_OP); } \
48 else fprintf ((FILE), ","); \
49 fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;} \
50 fprintf ((FILE), "\n"); \
53 /* Output at beginning of assembler file. */
54 /* The .file command should always begin the output. */
57 #define ASM_FILE_START(FILE) \
60 int len = strlen (main_input_filename); \
61 char *na = main_input_filename + len; \
63 /* NA gets MAIN_INPUT_FILENAME sans directory names. */\
64 while (na > main_input_filename) \
70 strncpy (shorter, na, 14); \
72 fprintf (FILE, "\t.file\t"); \
73 output_quoted_string (FILE, shorter); \
74 fprintf (FILE, "\n"); \
76 fprintf (FILE, "\t.version\t\"%s %s\"\n", \
77 language_string, version_string); \
78 if (optimize) ASM_FILE_START_1 (FILE); \
81 #define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n")
83 /* This is how to output an assembler line
84 that says to advance the location counter
85 to a multiple of 2**LOG bytes. */
87 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
88 if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
90 /* This is how to output an assembler line
91 that says to advance the location counter by SIZE bytes. */
93 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
94 fprintf ((FILE), "\t.set\t.,.+%u\n", (SIZE))
96 /* Output before read-only data. */
98 #undef TEXT_SECTION_ASM_OP
99 #define TEXT_SECTION_ASM_OP "\t.text"
101 /* Output before writable data. */
103 #undef DATA_SECTION_ASM_OP
104 #define DATA_SECTION_ASM_OP "\t.data"
106 /* Define the syntax of labels and symbol definitions/declarations. */
108 /* This says how to output an assembler line
109 to define a global common symbol. */
111 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
112 ( fputs (".comm ", (FILE)), \
113 assemble_name ((FILE), (NAME)), \
114 fprintf ((FILE), ",%u\n", (ROUNDED)))
116 /* This says how to output an assembler line
117 to define a local common symbol. */
119 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
120 ( fputs (".lcomm ", (FILE)), \
121 assemble_name ((FILE), (NAME)), \
122 fprintf ((FILE), ",%u\n", (ROUNDED)))
124 /* This is how to store into the string BUF
125 the symbol_ref name of an internal numbered label where
126 PREFIX is the class of label and NUM is the number within the class.
127 This is suitable for output with `assemble_name'. */
129 #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
130 sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER))
132 /* The prefix to add to user-visible assembler symbols. */
134 #define USER_LABEL_PREFIX ""
136 /* This is how to output an internal numbered label where
137 PREFIX is the class of label and NUM is the number within the class. */
139 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
140 fprintf (FILE, ".%s%d:\n", PREFIX, NUM)