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