| 1 | /* Definitions of various defaults for how to do assembler output |
| 2 | (most of which are designed to be appropriate for GAS or for |
| 3 | some BSD assembler). |
| 4 | |
| 5 | Written by Ron Guilmette (rfg@ncd.com) |
| 6 | |
| 7 | Copyright (C) 1992 Free Software Foundation, Inc. |
| 8 | |
| 9 | This file is part of GNU CC. |
| 10 | |
| 11 | GNU CC is free software; you can redistribute it and/or modify |
| 12 | it under the terms of the GNU General Public License as published by |
| 13 | the Free Software Foundation; either version 2, or (at your option) |
| 14 | any later version. |
| 15 | |
| 16 | GNU CC is distributed in the hope that it will be useful, |
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | GNU General Public License for more details. |
| 20 | |
| 21 | You should have received a copy of the GNU General Public License |
| 22 | along with GNU CC; see the file COPYING. If not, write to |
| 23 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 24 | |
| 25 | /* Store in OUTPUT a string (made with alloca) containing |
| 26 | an assembler-name for a local static variable or function named NAME. |
| 27 | LABELNO is an integer which is different for each call. */ |
| 28 | |
| 29 | #ifndef ASM_FORMAT_PRIVATE_NAME |
| 30 | #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ |
| 31 | do { \ |
| 32 | int len = strlen (NAME); \ |
| 33 | char *temp = (char *) alloca (len + 3); \ |
| 34 | temp[0] = 'L'; \ |
| 35 | strcpy (&temp[1], (NAME)); \ |
| 36 | temp[len + 1] = '.'; \ |
| 37 | temp[len + 2] = 0; \ |
| 38 | (OUTPUT) = (char *) alloca (strlen (NAME) + 11); \ |
| 39 | ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \ |
| 40 | } while (0) |
| 41 | #endif |
| 42 | |
| 43 | #ifndef ASM_STABD_OP |
| 44 | #define ASM_STABD_OP ".stabd" |
| 45 | #endif |
| 46 | |
| 47 | /* This is how to output an element of a case-vector that is absolute. |
| 48 | Some targets don't use this, but we have to define it anyway. */ |
| 49 | |
| 50 | #ifndef ASM_OUTPUT_ADDR_VEC_ELT |
| 51 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ |
| 52 | do { fprintf (FILE, "\t%s\t", ASM_LONG); \ |
| 53 | ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE)); \ |
| 54 | fputc ('\n', FILE); \ |
| 55 | } while (0) |
| 56 | #endif |
| 57 | |
| 58 | /* This is how to output an element of a case-vector that is relative. |
| 59 | Some targets don't use this, but we have to define it anyway. */ |
| 60 | |
| 61 | #ifndef ASM_OUTPUT_ADDR_DIFF_ELT |
| 62 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ |
| 63 | do { fprintf (FILE, "\t%s\t", ASM_SHORT); \ |
| 64 | ASM_GENERATE_INTERNAL_LABEL (FILE, "L", (VALUE)); \ |
| 65 | fputc ('-', FILE); \ |
| 66 | ASM_GENERATE_INTERNAL_LABEL (FILE, "L", (REL)); \ |
| 67 | fputc ('\n', FILE); \ |
| 68 | } while (0) |
| 69 | #endif |
| 70 | |
| 71 | /* choose a reasonable default for ASM_OUTPUT_ASCII. */ |
| 72 | |
| 73 | #ifndef ASM_OUTPUT_ASCII |
| 74 | #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \ |
| 75 | do { \ |
| 76 | FILE *_hide_asm_out_file = (MYFILE); \ |
| 77 | unsigned char *_hide_p = (unsigned char *) (MYSTRING); \ |
| 78 | int _hide_thissize = (MYLENGTH); \ |
| 79 | { \ |
| 80 | FILE *asm_out_file = _hide_asm_out_file; \ |
| 81 | unsigned char *p = _hide_p; \ |
| 82 | int thissize = _hide_thissize; \ |
| 83 | int i; \ |
| 84 | fprintf (asm_out_file, "\t.ascii \""); \ |
| 85 | \ |
| 86 | for (i = 0; i < thissize; i++) \ |
| 87 | { \ |
| 88 | register int c = p[i]; \ |
| 89 | if (c == '\"' || c == '\\') \ |
| 90 | putc ('\\', asm_out_file); \ |
| 91 | if (c >= ' ' && c < 0177) \ |
| 92 | putc (c, asm_out_file); \ |
| 93 | else \ |
| 94 | { \ |
| 95 | fprintf (asm_out_file, "\\%o", c); \ |
| 96 | /* After an octal-escape, if a digit follows, \ |
| 97 | terminate one string constant and start another. \ |
| 98 | The Vax assembler fails to stop reading the escape \ |
| 99 | after three digits, so this is the only way we \ |
| 100 | can get it to parse the data properly. */ \ |
| 101 | if (i < thissize - 1 \ |
| 102 | && p[i + 1] >= '0' && p[i + 1] <= '9') \ |
| 103 | fprintf (asm_out_file, "\"\n\t.ascii \""); \ |
| 104 | } \ |
| 105 | } \ |
| 106 | fprintf (asm_out_file, "\"\n"); \ |
| 107 | } \ |
| 108 | } \ |
| 109 | while (0) |
| 110 | #endif |
| 111 | |
| 112 | #ifndef ASM_IDENTIFY_GCC |
| 113 | /* Default the definition, only if ASM_IDENTIFY_GCC is not set, |
| 114 | because if it is set, we might not want ASM_IDENTIFY_LANGUAGE |
| 115 | outputting labels, if we do want it to, then it must be defined |
| 116 | in the tm.h file. */ |
| 117 | #ifndef ASM_IDENTIFY_LANGUAGE |
| 118 | #define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE); |
| 119 | #endif |
| 120 | #endif |