unix.h revision 50397
1/* Definitions for Unix assembler syntax for the Intel 80386. 2 Copyright (C) 1988, 1994 Free Software Foundation, Inc. 3 4This file is part of GNU CC. 5 6GNU CC is free software; you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation; either version 2, or (at your option) 9any later version. 10 11GNU CC is distributed in the hope that it will be useful, 12but WITHOUT ANY WARRANTY; without even the implied warranty of 13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14GNU General Public License for more details. 15 16You should have received a copy of the GNU General Public License 17along with GNU CC; see the file COPYING. If not, write to 18the Free Software Foundation, 59 Temple Place - Suite 330, 19Boston, MA 02111-1307, USA. */ 20 21/* This file defines the aspects of assembler syntax 22 that are the same for all the i386 Unix systems 23 (though they may differ in non-Unix systems). */ 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/* Note that the other files fail to use these 30 in some of the places where they should. */ 31 32#if defined(__STDC__) || defined(ALMOST_STDC) 33#define AS2(a,b,c) #a " " #b "," #c 34#define AS2C(b,c) " " #b "," #c 35#define AS3(a,b,c,d) #a " " #b "," #c "," #d 36#define AS1(a,b) #a " " #b 37#else 38#define AS1(a,b) "a b" 39#define AS2(a,b,c) "a b,c" 40#define AS2C(b,c) " b,c" 41#define AS3(a,b,c,d) "a b,c,d" 42#endif 43 44/* Define macro used to output shift-double opcodes when the shift 45 count is in %cl. Some assemblers require %cl as an argument; 46 some don't. This macro controls what to do: by default, don't 47 print %cl. */ 48#define SHIFT_DOUBLE_OMITS_COUNT 1 49#define AS3_SHIFT_DOUBLE(a,b,c,d) \ 50 (SHIFT_DOUBLE_OMITS_COUNT ? AS2 (a,c,d) : AS3 (a,b,c,d)) 51 52/* Output the size-letter for an opcode. 53 CODE is the letter used in an operand spec (L, B, W, S or Q). 54 CH is the corresponding lower case letter 55 (except if CODE is `Q' then CH is `l', unless GAS_MNEMONICS). */ 56#define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE)) 57 58/* Opcode suffix for fullword insn. */ 59#define L_SIZE "l" 60 61/* Prefix for register names in this syntax. */ 62#define RP "%" 63 64/* Prefix for immediate operands in this syntax. */ 65#define IP "$" 66 67/* Indirect call instructions should use `*'. */ 68#define USE_STAR 1 69 70/* Prefix for a memory-operand X. */ 71#define PRINT_PTR(X, FILE) 72 73/* Delimiters that surround base reg and index reg. */ 74#define ADDR_BEG(FILE) putc('(', (FILE)) 75#define ADDR_END(FILE) putc(')', (FILE)) 76 77/* Print an index register (whose rtx is IREG). */ 78#define PRINT_IREG(FILE,IREG) \ 79 do \ 80 { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); } \ 81 while (0) 82 83/* Print an index scale factor SCALE. */ 84#define PRINT_SCALE(FILE,SCALE) \ 85 if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE)) 86 87/* Print a base/index combination. 88 BREG is the base reg rtx, IREG is the index reg rtx, 89 and SCALE is the index scale factor (an integer). */ 90 91#define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \ 92 { ADDR_BEG (FILE); \ 93 if (BREG) PRINT_REG ((BREG), 0, (FILE)); \ 94 if ((IREG) != 0) \ 95 { PRINT_IREG ((FILE), (IREG)); \ 96 PRINT_SCALE ((FILE), (SCALE)); } \ 97 ADDR_END (FILE); } 98 99/* Define the syntax of pseudo-ops, labels and comments. */ 100 101/* String containing the assembler's comment-starter. */ 102 103#define ASM_COMMENT_START "/" 104 105/* Output to assembler file text saying following lines 106 may contain character constants, extra white space, comments, etc. */ 107 108#define ASM_APP_ON "/APP\n" 109 110/* Output to assembler file text saying following lines 111 no longer contain unusual constructs. */ 112 113#define ASM_APP_OFF "/NO_APP\n" 114 115/* Output before read-only data. */ 116 117#define TEXT_SECTION_ASM_OP ".text" 118 119/* Output before writable (initialized) data. */ 120 121#define DATA_SECTION_ASM_OP ".data" 122 123/* Output before writable (uninitialized) data. */ 124 125#define BSS_SECTION_ASM_OP ".bss" 126 127/* This is how to output a command to make the user-level label named NAME 128 defined for reference from other files. */ 129 130#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ 131 (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE)) 132 133/* By default, target has a 80387, uses IEEE compatible arithmetic, 134 and returns float values in the 387, ie, 135 (TARGET_80387 | TARGET_IEEE_FP | TARGET_FLOAT_RETURNS_IN_80387) */ 136 137#define TARGET_DEFAULT 0301 138 139/* Floating-point return values come in the FP register. */ 140 141#define VALUE_REGNO(MODE) \ 142 (GET_MODE_CLASS (MODE) == MODE_FLOAT \ 143 && TARGET_FLOAT_RETURNS_IN_80387 ? FIRST_FLOAT_REG : 0) 144 145/* 1 if N is a possible register number for a function value. */ 146 147#define FUNCTION_VALUE_REGNO_P(N) \ 148 ((N) == 0 || ((N)== FIRST_FLOAT_REG && TARGET_FLOAT_RETURNS_IN_80387)) 149 150/* Output code to add DELTA to the first argument, and then jump to FUNCTION. 151 Used for C++ multiple inheritance. */ 152#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ 153do { \ 154 tree parm; \ 155 \ 156 if (i386_regparm > 0) \ 157 parm = TYPE_ARG_TYPES (TREE_TYPE (function)); \ 158 else \ 159 parm = NULL_TREE; \ 160 for (; parm; parm = TREE_CHAIN (parm)) \ 161 if (TREE_VALUE (parm) == void_type_node) \ 162 break; \ 163 fprintf (FILE, "\taddl $%d,%s\n", DELTA, \ 164 parm ? "%eax" \ 165 : aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? "8(%esp)" \ 166 : "4(%esp)"); \ 167 \ 168 if (flag_pic) \ 169 { \ 170 rtx xops[2]; \ 171 xops[0] = pic_offset_table_rtx; \ 172 xops[1] = (rtx) gen_label_rtx (); \ 173 \ 174 if (i386_regparm > 2) \ 175 abort (); \ 176 output_asm_insn ("push%L0 %0", xops); \ 177 output_asm_insn (AS1 (call,%P1), xops); \ 178 ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", CODE_LABEL_NUMBER (xops[1])); \ 179 output_asm_insn (AS1 (pop%L0,%0), xops); \ 180 output_asm_insn ("addl $_GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops); \ 181 fprintf (FILE, "\tmovl "); \ 182 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ 183 fprintf (FILE, "@GOT(%%ebx),%%ecx\n\tpopl %%ebx\n\tjmp *%%ecx\n"); \ 184 } \ 185 else \ 186 { \ 187 fprintf (FILE, "\tjmp "); \ 188 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ 189 fprintf (FILE, "\n"); \ 190 } \ 191} while (0) 192