|
|
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 1, 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: #define TARGET_VERSION fprintf (stderr, " (80386, Sun syntax)"); ! 22: ! 23: /* Define the syntax of instructions and addresses. */ ! 24: ! 25: /* Define some concatenation macros to concatenate an opcode ! 26: and one, two or three operands. In other assembler syntaxes ! 27: they may alter the order of ther operands. */ ! 28: ! 29: #ifdef __STDC__ ! 30: #define AS2(a,b,c) #a " " #b "," #c ! 31: #define AS3(a,b,c,d) #a " " #b "," #c "," #d ! 32: #define AS1(a,b) #a " " #b ! 33: #else ! 34: #define AS1(a,b) "a b" ! 35: #define AS2(a,b,c) "a b,c" ! 36: #define AS3(a,b,c,d) "a b,c,d" ! 37: #endif ! 38: ! 39: /* Output the size-letter for an opcode. ! 40: CODE is the letter used in an operand spec (L, B, W, S or Q). ! 41: CH is the corresponding lower case letter ! 42: (except if CODE is L then CH is `l'). */ ! 43: #define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE)) ! 44: ! 45: /* Opcode suffix for fullword insn. */ ! 46: #define L_SIZE "l" ! 47: ! 48: /* Prefix for register names in this syntax. */ ! 49: #define RP "%" ! 50: ! 51: /* Prefix for immediate operands in this syntax. */ ! 52: #define IP "$" ! 53: ! 54: /* Prefix for internally generated assembler labels. */ ! 55: #define LPREFIX ".L" ! 56: ! 57: /* Output the prefix for an immediate operand, or for an offset operand. */ ! 58: #define PRINT_IMMED_PREFIX(FILE) fputs ("$", (FILE)) ! 59: #define PRINT_OFFSET_PREFIX(FILE) fputs ("$", (FILE)) ! 60: ! 61: /* Indirect call instructions should use `*'. */ ! 62: #define USE_STAR 1 ! 63: ! 64: /* Prefix for a memory-operand X. */ ! 65: #define PRINT_PTR(X, FILE) ! 66: ! 67: /* Delimiters that surround base reg and index reg. */ ! 68: #define ADDR_BEG(FILE) putc('(', (FILE)) ! 69: #define ADDR_END(FILE) putc(')', (FILE)) ! 70: ! 71: /* Print an index register (whose rtx is IREG). */ ! 72: #define PRINT_IREG(FILE,IREG) \ ! 73: do \ ! 74: { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); } \ ! 75: while (0) ! 76: ! 77: /* Print an index scale factor SCALE. */ ! 78: #define PRINT_SCALE(FILE,SCALE) \ ! 79: if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE)) ! 80: ! 81: /* Print a base/index combination. ! 82: BREG is the base reg rtx, IREG is the index reg rtx, ! 83: and SCALE is the index scale factor (an integer). */ ! 84: ! 85: #define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \ ! 86: { ADDR_BEG (FILE); \ ! 87: if (BREG) PRINT_REG ((BREG), 0, (FILE)); \ ! 88: if ((IREG) != 0) \ ! 89: { PRINT_IREG ((FILE), (IREG)); \ ! 90: PRINT_SCALE ((FILE), (SCALE)); } \ ! 91: ADDR_END (FILE); } ! 92: ! 93: /* Define the syntax of pseudo-ops, labels and comments. */ ! 94: ! 95: /* Assembler pseudos to introduce constants of various size. */ ! 96: ! 97: #define ASM_BYTE "\t.byte\t" ! 98: #define ASM_SHORT "\t.value\t" ! 99: #define ASM_LONG "\t.long\t" ! 100: #define ASM_DOUBLE "\t.double\t" ! 101: ! 102: /* String containing the assembler's comment-starter. */ ! 103: ! 104: #define COMMENT_BEGIN "/" ! 105: ! 106: /* Output at beginning of assembler file. */ ! 107: /* The .file command should always begin the output. */ ! 108: ! 109: #undef ASM_FILE_START ! 110: #define ASM_FILE_START(FILE) \ ! 111: do { \ ! 112: extern char *version_string, *language_string; \ ! 113: { \ ! 114: int len = strlen (dump_base_name); \ ! 115: char *na = dump_base_name + len; \ ! 116: char shorter[15]; \ ! 117: /* NA gets DUMP_BASE_NAME sans directory names. */\ ! 118: while (na > dump_base_name) \ ! 119: { \ ! 120: if (na[-1] == '/') \ ! 121: break; \ ! 122: na--; \ ! 123: } \ ! 124: strncpy (shorter, na, 14); \ ! 125: shorter[14] = 0; \ ! 126: fprintf (FILE, "\t.file\t\"%s\"\n", shorter); \ ! 127: } \ ! 128: fprintf (FILE, "\t.version\t\"%s %s\"\n", \ ! 129: language_string, version_string); \ ! 130: if (optimize) ASM_FILE_START_1 (FILE); \ ! 131: } while (0) ! 132: ! 133: #define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n") ! 134: ! 135: /* Output to assembler file text saying following lines ! 136: may contain character constants, extra white space, comments, etc. */ ! 137: ! 138: #define ASM_APP_ON "/APP\n" ! 139: ! 140: /* Output to assembler file text saying following lines ! 141: no longer contain unusual constructs. */ ! 142: ! 143: #define ASM_APP_OFF "/NO_APP\n" ! 144: ! 145: /* This is how to output an assembler line ! 146: that says to advance the location counter ! 147: to a multiple of 2**LOG bytes. */ ! 148: ! 149: #define ASM_OUTPUT_ALIGN(FILE,LOG) \ ! 150: if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) ! 151: ! 152: /* This is how to output an assembler line ! 153: that says to advance the location counter by SIZE bytes. */ ! 154: ! 155: #define ASM_OUTPUT_SKIP(FILE,SIZE) \ ! 156: fprintf ((FILE), "\t.set\t.,.+%d\n", (SIZE)) ! 157: ! 158: /* Output before read-only data. */ ! 159: ! 160: #define TEXT_SECTION_ASM_OP "\t.text" ! 161: ! 162: /* Output before writable data. */ ! 163: ! 164: #define DATA_SECTION_ASM_OP "\t.data" ! 165: ! 166: /* Define the syntax of labels and symbol definitions/declarations. */ ! 167: ! 168: /* This says how to output an assembler line ! 169: to define a global common symbol. */ ! 170: ! 171: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ ! 172: ( fputs ("\t.comm\t", (FILE)), \ ! 173: assemble_name ((FILE), (NAME)), \ ! 174: fprintf ((FILE), ",%d\n", (SIZE))) ! 175: ! 176: /* This says how to output an assembler line ! 177: to define a local common symbol. */ ! 178: ! 179: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ ! 180: (data_section (), \ ! 181: ASM_OUTPUT_LABEL ((FILE), (NAME)), \ ! 182: fprintf ((FILE), "\t.set\t.,.+%d\n", (SIZE))) ! 183: ! 184: /* This is how to store into the string BUF ! 185: the symbol_ref name of an internal numbered label where ! 186: PREFIX is the class of label and NUM is the number within the class. ! 187: This is suitable for output with `assemble_name'. */ ! 188: ! 189: #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ ! 190: sprintf ((BUF), ".%s%d", (PREFIX), (NUMBER)) ! 191: ! 192: /* This is how to output a reference to a user-level label named NAME. */ ! 193: ! 194: #define ASM_OUTPUT_LABELREF(FILE,NAME) \ ! 195: fprintf (FILE, "%s", NAME) ! 196: ! 197: /* This is how to output an internal numbered label where ! 198: PREFIX is the class of label and NUM is the number within the class. */ ! 199: ! 200: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ ! 201: fprintf (FILE, ".%s%d:\n", PREFIX, NUM) ! 202: ! 203: /* This is how to output a command to make the user-level label named NAME ! 204: defined for reference from other files. */ ! 205: ! 206: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ ! 207: (fputs ("\t.globl\t", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE)) ! 208: ! 209: /* How to output an ASCII string constant. */ ! 210: ! 211: #define ASM_OUTPUT_ASCII(FILE, p, size) \ ! 212: { int i=0; \ ! 213: while (i < size) \ ! 214: { if (i%10 == 0) { if (i!=0) fprintf (FILE, "\n"); \ ! 215: fprintf (FILE, ASM_BYTE); } \ ! 216: else fprintf (FILE, ","); \ ! 217: fprintf (FILE, "0x%x",(p[i++] & 0377)) ;} \ ! 218: fprintf (FILE, "\n"); }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.