att.h revision 90075
1172106Srwatson/* Definitions for AT&T assembler syntax for the Intel 80386.
2172106Srwatson   Copyright (C) 1988, 1996, 2000 Free Software Foundation, Inc.
3172106Srwatson
4172106SrwatsonThis file is part of GNU CC.
5172106Srwatson
6172106SrwatsonGNU CC is free software; you can redistribute it and/or modify
7172106Srwatsonit under the terms of the GNU General Public License as published by
8172106Srwatsonthe Free Software Foundation; either version 2, or (at your option)
9172106Srwatsonany later version.
10172106Srwatson
11172106SrwatsonGNU CC is distributed in the hope that it will be useful,
12172106Srwatsonbut WITHOUT ANY WARRANTY; without even the implied warranty of
13172106SrwatsonMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14172106SrwatsonGNU General Public License for more details.
15172106Srwatson
16172106SrwatsonYou should have received a copy of the GNU General Public License
17172106Srwatsonalong with GNU CC; see the file COPYING.  If not, write to
18172106Srwatsonthe Free Software Foundation, 59 Temple Place - Suite 330,
19172106SrwatsonBoston, MA 02111-1307, USA.  */
20172106Srwatson
21172106Srwatson/* Include common aspects of all 386 Unix assemblers.  */
22172106Srwatson#include "i386/unix.h"
23172106Srwatson
24172106Srwatson#define TARGET_VERSION fprintf (stderr, " (80386, ATT syntax)");
25172106Srwatson
26172106Srwatson/* Define the syntax of instructions and addresses.  */
27172106Srwatson
28172106Srwatson/* Prefix for internally generated assembler labels.  */
29172106Srwatson#define LPREFIX ".L"
30172106Srwatson
31172106Srwatson/* Assembler pseudos to introduce constants of various size.  */
32172106Srwatson
33172106Srwatson#define ASM_SHORT "\t.value\t"
34172106Srwatson#define ASM_LONG "\t.long\t"
35172106Srwatson#define ASM_QUAD "\t.quad\t"  /* Should not be used for 32bit compilation.  */
36172106Srwatson
37172106Srwatson/* How to output an ASCII string constant.  */
38172106Srwatson
39172106Srwatson#define ASM_OUTPUT_ASCII(FILE, PTR, SIZE)			\
40172106Srwatsondo								\
41172106Srwatson{ size_t i = 0, limit = (SIZE); 				\
42172106Srwatson  while (i < limit)						\
43172106Srwatson    { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n");	\
44172106Srwatson		       fputs ("\t.byte\t", (FILE)); }		\
45172106Srwatson      else fprintf ((FILE), ",");				\
46172106Srwatson	fprintf ((FILE), "0x%x", ((PTR)[i++] & 0377)) ;}	\
47172106Srwatson      fprintf ((FILE), "\n");					\
48172106Srwatson} while (0)
49172106Srwatson
50172106Srwatson/* Output at beginning of assembler file.  */
51172106Srwatson/* The .file command should always begin the output.  */
52172106Srwatson#undef ASM_FILE_START
53172106Srwatson#define ASM_FILE_START(FILE)						\
54172106Srwatson  do {									\
55172106Srwatson	output_file_directive (FILE, main_input_filename);		\
56172106Srwatson	if (ix86_asm_dialect == ASM_INTEL)				\
57172106Srwatson	  fputs ("\t.intel_syntax\n", FILE);				\
58172106Srwatson  } while (0)
59172106Srwatson
60172106Srwatson/* Do use .optim by default on this machine.  */
61172106Srwatson#undef ASM_FILE_START_1
62172106Srwatson#define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n")
63172106Srwatson
64172106Srwatson/* This is how to output an assembler line
65172106Srwatson   that says to advance the location counter
66172106Srwatson   to a multiple of 2**LOG bytes.  */
67172106Srwatson
68172106Srwatson#define ASM_OUTPUT_ALIGN(FILE,LOG)	\
69172106Srwatson    if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
70172106Srwatson
71172106Srwatson/* This is how to output an assembler line
72172106Srwatson   that says to advance the location counter by SIZE bytes.  */
73172106Srwatson
74172106Srwatson#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
75172106Srwatson  fprintf ((FILE), "\t.set .,.+%u\n", (SIZE))
76172106Srwatson
77172106Srwatson/* Can't use ASM_OUTPUT_SKIP in text section; it doesn't leave 0s.  */
78172106Srwatson
79172106Srwatson#define ASM_NO_SKIP_IN_TEXT 1
80172106Srwatson
81172106Srwatson/* Define the syntax of labels and symbol definitions/declarations.  */
82172106Srwatson
83172106Srwatson/* The prefix to add for compiler private assembler symbols.  */
84172106Srwatson#undef LOCAL_LABEL_PREFIX
85172106Srwatson#define LOCAL_LABEL_PREFIX "."
86172106Srwatson
87172106Srwatson/* This is how to store into the string BUF
88172106Srwatson   the symbol_ref name of an internal numbered label where
89172106Srwatson   PREFIX is the class of label and NUM is the number within the class.
90172106Srwatson   This is suitable for output with `assemble_name'.  */
91172106Srwatson
92172106Srwatson#undef ASM_GENERATE_INTERNAL_LABEL
93172106Srwatson#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)	\
94172106Srwatson  sprintf ((BUF), "%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUMBER))
95172106Srwatson
96172106Srwatson/* This is how to output an internal numbered label where
97172106Srwatson   PREFIX is the class of label and NUM is the number within the class.  */
98172106Srwatson
99172106Srwatson#undef ASM_OUTPUT_INTERNAL_LABEL
100172106Srwatson#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)	\
101172106Srwatson  fprintf (FILE, "%s%s%d:\n", LOCAL_LABEL_PREFIX, PREFIX, NUM)
102172106Srwatson
103172106Srwatson/* The prefix to add to user-visible assembler symbols.  */
104172106Srwatson
105172106Srwatson#undef USER_LABEL_PREFIX
106172106Srwatson#define USER_LABEL_PREFIX ""
107172106Srwatson