|
|
1.1 ! root 1: /* Definitions for AT&T 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, ATT 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 " ! 98: #define ASM_SHORT "\t.value " ! 99: #define ASM_LONG "\t.long " ! 100: #define ASM_DOUBLE "\t.double " ! 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 { sdbout_filename ((FILE), main_input_filename); \ ! 112: if (optimize) ASM_FILE_START_1 (FILE); \ ! 113: } while (0) ! 114: ! 115: #define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n") ! 116: ! 117: /* Output to assembler file text saying following lines ! 118: may contain character constants, extra white space, comments, etc. */ ! 119: ! 120: #define ASM_APP_ON "/APP\n" ! 121: ! 122: /* Output to assembler file text saying following lines ! 123: no longer contain unusual constructs. */ ! 124: ! 125: #define ASM_APP_OFF "/NO_APP\n" ! 126: ! 127: /* This is how to output an assembler line ! 128: that says to advance the location counter ! 129: to a multiple of 2**LOG bytes. */ ! 130: ! 131: #define ASM_OUTPUT_ALIGN(FILE,LOG) \ ! 132: if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) ! 133: ! 134: /* This is how to output an assembler line ! 135: that says to advance the location counter by SIZE bytes. */ ! 136: ! 137: #define ASM_OUTPUT_SKIP(FILE,SIZE) \ ! 138: fprintf ((FILE), "\t.set .,.+%d\n", (SIZE)) ! 139: ! 140: /* Output before read-only data. */ ! 141: ! 142: #define TEXT_SECTION_ASM_OP ".text" ! 143: ! 144: /* Output before writable data. */ ! 145: ! 146: #define DATA_SECTION_ASM_OP ".data" ! 147: ! 148: /* Define the syntax of labels and symbol definitions/declarations. */ ! 149: ! 150: /* This says how to output an assembler line ! 151: to define a global common symbol. */ ! 152: ! 153: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ ! 154: ( fputs (".comm ", (FILE)), \ ! 155: assemble_name ((FILE), (NAME)), \ ! 156: fprintf ((FILE), ",%d\n", (SIZE))) ! 157: ! 158: /* This says how to output an assembler line ! 159: to define a local common symbol. */ ! 160: ! 161: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ ! 162: (data_section (), \ ! 163: ASM_OUTPUT_LABEL ((FILE), (NAME)), \ ! 164: fprintf ((FILE), "\t.set .,.+%d\n", (SIZE))) ! 165: ! 166: /* This is how to store into the string BUF ! 167: the symbol_ref name of an internal numbered label where ! 168: PREFIX is the class of label and NUM is the number within the class. ! 169: This is suitable for output with `assemble_name'. */ ! 170: ! 171: #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ ! 172: sprintf ((BUF), ".%s%d", (PREFIX), (NUMBER)) ! 173: ! 174: /* This is how to output a reference to a user-level label named NAME. */ ! 175: ! 176: #define ASM_OUTPUT_LABELREF(FILE,NAME) \ ! 177: fprintf (FILE, "%s", NAME) ! 178: ! 179: /* This is how to output an internal numbered label where ! 180: PREFIX is the class of label and NUM is the number within the class. */ ! 181: ! 182: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ ! 183: fprintf (FILE, ".%s%d:\n", PREFIX, NUM) ! 184: ! 185: /* This is how to output a command to make the user-level label named NAME ! 186: defined for reference from other files. */ ! 187: ! 188: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ ! 189: (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE)) ! 190: ! 191: /* How to output an ASCII string constant. */ ! 192: ! 193: #define ASM_OUTPUT_ASCII(FILE, p, size) \ ! 194: { int i=0; \ ! 195: while (i < size) \ ! 196: { if (i%10 == 0) { if (i!=0) fprintf (FILE, "\n"); \ ! 197: fprintf (FILE, ASM_BYTE); } \ ! 198: else fprintf (FILE, ","); \ ! 199: fprintf (FILE, "0x%x",(p[i++] & 0377)) ;} \ ! 200: fprintf (FILE, "\n"); }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.