|
|
1.1 root 1: /* Definitions for Sun assembler syntax for the Intel 80386.
2: Copyright (C) 1988 Free Software Foundation, Inc.
3:
4: This file is part of GNU CC.
5:
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)
9: any later version.
10:
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.
15:
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
1.1.1.3 ! root 18: the Free Software Foundation, 59 Temple Place - Suite 330,
! 19: Boston, MA 02111-1307, USA. */
1.1 root 20:
21:
22: /* Include common aspects of all 386 Unix assemblers. */
23: #include "i386/unix.h"
24:
25: #define TARGET_VERSION fprintf (stderr, " (80386, Sun syntax)");
26:
27: /* Define the syntax of instructions and addresses. */
28:
29: /* Prefix for internally generated assembler labels. */
30: #define LPREFIX ".L"
31:
32: /* Define the syntax of pseudo-ops, labels and comments. */
33:
34: /* Assembler pseudos to introduce constants of various size. */
35:
36: #define ASM_BYTE_OP "\t.byte"
37: #define ASM_SHORT "\t.value"
38: #define ASM_LONG "\t.long"
39: #define ASM_DOUBLE "\t.double"
40:
41: /* How to output an ASCII string constant. */
42:
43: #define ASM_OUTPUT_ASCII(FILE, p, size) \
1.1.1.2 root 44: do \
1.1 root 45: { int i = 0; \
46: while (i < (size)) \
1.1.1.2 root 47: { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n"); \
1.1 root 48: fprintf ((FILE), "%s ", ASM_BYTE_OP); } \
1.1.1.2 root 49: else fprintf ((FILE), ","); \
1.1 root 50: fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;} \
1.1.1.2 root 51: fprintf ((FILE), "\n"); \
52: } while (0)
1.1 root 53:
54: /* Output at beginning of assembler file. */
55: /* The .file command should always begin the output. */
56:
57: #undef ASM_FILE_START
58: #define ASM_FILE_START(FILE) \
59: do { \
60: extern char *version_string, *language_string; \
61: { \
62: int len = strlen (dump_base_name); \
63: char *na = dump_base_name + len; \
64: char shorter[15]; \
65: /* NA gets DUMP_BASE_NAME sans directory names. */\
66: while (na > dump_base_name) \
67: { \
68: if (na[-1] == '/') \
69: break; \
70: na--; \
71: } \
72: strncpy (shorter, na, 14); \
73: shorter[14] = 0; \
1.1.1.2 root 74: fprintf (FILE, "\t.file\t"); \
75: output_quoted_string (FILE, shorter); \
76: fprintf (FILE, "\n"); \
1.1 root 77: } \
78: fprintf (FILE, "\t.version\t\"%s %s\"\n", \
79: language_string, version_string); \
80: if (optimize) ASM_FILE_START_1 (FILE); \
81: } while (0)
82:
83: #define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n")
84:
85: /* This is how to output an assembler line
86: that says to advance the location counter
87: to a multiple of 2**LOG bytes. */
88:
89: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
90: if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
91:
92: /* This is how to output an assembler line
93: that says to advance the location counter by SIZE bytes. */
94:
95: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
96: fprintf ((FILE), "\t.set\t.,.+%u\n", (SIZE))
97:
98: /* Output before read-only data. */
99:
100: #undef TEXT_SECTION_ASM_OP
101: #define TEXT_SECTION_ASM_OP ".text"
102:
103: /* Output before writable data. */
104:
105: #undef DATA_SECTION_ASM_OP
106: #define DATA_SECTION_ASM_OP ".data"
107:
108: /* Define the syntax of labels and symbol definitions/declarations. */
109:
110: /* This says how to output an assembler line
111: to define a global common symbol. */
112:
113: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
114: ( fputs (".comm ", (FILE)), \
115: assemble_name ((FILE), (NAME)), \
116: fprintf ((FILE), ",%u\n", (ROUNDED)))
117:
118: /* This says how to output an assembler line
119: to define a local common symbol. */
120:
121: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
122: ( fputs (".lcomm ", (FILE)), \
123: assemble_name ((FILE), (NAME)), \
124: fprintf ((FILE), ",%u\n", (ROUNDED)))
125:
126: /* This is how to store into the string BUF
127: the symbol_ref name of an internal numbered label where
128: PREFIX is the class of label and NUM is the number within the class.
129: This is suitable for output with `assemble_name'. */
130:
131: #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
132: sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER))
133:
134: /* This is how to output a reference to a user-level label named NAME. */
135:
136: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
137: fprintf (FILE, "%s", NAME)
138:
139: /* This is how to output an internal numbered label where
140: PREFIX is the class of label and NUM is the number within the class. */
141:
142: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
143: fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.