unix.h revision 90075
1/* Definitions for Unix assembler syntax for the Intel 80386.
2   Copyright (C) 1988, 1994, 1999, 2000, 2001 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 DEFAULT_ASSEMBLER_DIALECT 0
26
27/* Define macro used to output shift-double opcodes when the shift
28   count is in %cl.  Some assemblers require %cl as an argument;
29   some don't.  This macro controls what to do: by default, don't
30   print %cl.  */
31#define SHIFT_DOUBLE_OMITS_COUNT 1
32
33/* Define the syntax of pseudo-ops, labels and comments.  */
34
35/* String containing the assembler's comment-starter.  */
36
37#define ASM_COMMENT_START "/"
38
39/* Output to assembler file text saying following lines
40   may contain character constants, extra white space, comments, etc.  */
41
42#define ASM_APP_ON "/APP\n"
43
44/* Output to assembler file text saying following lines
45   no longer contain unusual constructs.  */
46
47#define ASM_APP_OFF "/NO_APP\n"
48
49/* Output before read-only data.  */
50
51#define TEXT_SECTION_ASM_OP "\t.text"
52
53/* Output before writable (initialized) data.  */
54
55#define DATA_SECTION_ASM_OP "\t.data"
56
57/* Output before writable (uninitialized) data.  */
58
59#define BSS_SECTION_ASM_OP "\t.bss"
60
61/* This is how to output a command to make the user-level label named NAME
62   defined for reference from other files.  */
63
64#define ASM_GLOBALIZE_LABEL(FILE,NAME)	\
65  (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
66
67/* By default, target has a 80387, uses IEEE compatible arithmetic,
68   and returns float values in the 387.  */
69
70#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
71
72/* Floating-point return values come in the FP register.  */
73
74#define VALUE_REGNO(MODE) \
75  (GET_MODE_CLASS (MODE) == MODE_FLOAT				\
76   && TARGET_FLOAT_RETURNS_IN_80387 ? FIRST_FLOAT_REG		\
77   : (MODE) == TImode || VECTOR_MODE_P (MODE) ? FIRST_SSE_REG	\
78   : 0)
79
80/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
81   Used for C++ multiple inheritance.  */
82#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION)	    \
83do {									    \
84  tree parm;								    \
85  rtx xops[3];								    \
86									    \
87  if (ix86_regparm > 0)							    \
88    parm = TYPE_ARG_TYPES (TREE_TYPE (function));			    \
89  else									    \
90    parm = NULL_TREE;							    \
91  for (; parm; parm = TREE_CHAIN (parm))				    \
92    if (TREE_VALUE (parm) == void_type_node)				    \
93      break;								    \
94									    \
95  xops[0] = GEN_INT (DELTA);						    \
96  if (parm)								    \
97    xops[1] = gen_rtx_REG (SImode, 0);					    \
98  else if (aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))))	    \
99    xops[1] = gen_rtx_MEM (SImode, plus_constant (stack_pointer_rtx, 8));   \
100  else									    \
101    xops[1] = gen_rtx_MEM (SImode, plus_constant (stack_pointer_rtx, 4));   \
102  output_asm_insn ("add{l} {%0, %1|%1, %0}", xops);			    \
103									    \
104  if (flag_pic && !TARGET_64BIT)					    \
105    {									    \
106      xops[0] = pic_offset_table_rtx;					    \
107      xops[1] = gen_label_rtx ();					    \
108      xops[2] = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");        \
109									    \
110      if (ix86_regparm > 2)						    \
111	abort ();							    \
112      output_asm_insn ("push{l}\t%0", xops);				    \
113      output_asm_insn ("call\t%P1", xops);				    \
114      ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", CODE_LABEL_NUMBER (xops[1]));   \
115      output_asm_insn ("pop{l}\t%0", xops);				    \
116      output_asm_insn ("add{l}\t{%2+[.-%P1], %0|%0, OFFSET FLAT: %2+[.-%P1]}", xops); \
117      xops[0] = gen_rtx_MEM (SImode, XEXP (DECL_RTL (FUNCTION), 0));	    \
118      output_asm_insn ("mov{l}\t{%0@GOT(%%ebx), %%ecx|%%ecx, %0@GOT[%%ebx]}",\
119	               xops);						    \
120      asm_fprintf (FILE, "\tpop{l\t%%ebx|\t%%ebx}\n");			    \
121      asm_fprintf (FILE, "\tjmp\t{*%%ecx|%%ecx}\n");			    \
122    }									    \
123  else if (flag_pic && TARGET_64BIT)					    \
124    {									    \
125      fprintf (FILE, "\tjmp *");					    \
126      assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0));	    \
127      fprintf (FILE, "@GOTPCREL(%%rip)\n");				    \
128    }									    \
129  else									    \
130    {									    \
131      fprintf (FILE, "\tjmp ");						    \
132      assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0));	    \
133      fprintf (FILE, "\n");						    \
134    }									    \
135} while (0)
136