home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / config / pa / next.h < prev    next >
C/C++ Source or Header  |  1996-06-12  |  11KB  |  348 lines

  1. /* Target definitions for GNU compiler for hppa running NeXTSTEP
  2.    Copyright (C) 1989, 1990, 1991, 1992, 1993 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 2, 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. #define TARGET_DEFAULT (1+128+512)    /* 1.1, gas, stub calls */
  21.  
  22. #define TARGET_ARCHITECTURE \
  23.   { { "hppa", 1 },        /* same as snake.  */        \
  24.     { "hppa1.0", -1 },        /* nosnake.  */            \
  25.   }
  26.  
  27. /* must before the inclusion of pa/pa.h */
  28. #define NeXT_ASM
  29.  
  30. #define MACHO_PIC 1
  31.  
  32. #ifndef NEXT_SEMANTICS
  33. #define NEXT_SEMANTICS
  34. #endif
  35.  
  36. #include "pa/pa.h"
  37. #include "next/nextstep.h"
  38.  
  39.  
  40. #define DEFAULT_TARGET_ARCH "hppa"
  41.  
  42. #define HP_FP_ARG_DESCRIPTOR_REVERSED
  43.  
  44. #undef CPP_PREDEFINES
  45. #define CPP_PREDEFINES "-Dhppa -DNATURAL_ALIGNMENT -DNeXT -Dunix -D__MACH__ -D__BIG_ENDIAN__ -D__ARCHITECTURE__=\"hppa\" -D_PA_RISC1_1"
  46.  
  47. #undef ASM_FILE_START
  48. #define ASM_FILE_START
  49.  
  50. #undef ASM_FILE_END
  51. #undef ASM_OUTPUT_EXTERNAL_LIBCALL
  52. #undef ASM_OUTPUT_EXTERNAL
  53.  
  54. #undef FUNCTION_PROLOGUE
  55. #define FUNCTION_PROLOGUE
  56.  
  57. #undef FUNCTION_EPILOGUE
  58. #define FUNCTION_EPILOGUE
  59.  
  60. #undef GLOBAL_ASM_OP
  61. #define GLOBAL_ASM_OP ".globl"
  62.  
  63. #undef SIZE_TYPE
  64. #define SIZE_TYPE "long unsigned int"
  65.  
  66. #undef ASM_GLOBALIZE_LABEL
  67. #define ASM_GLOBALIZE_LABEL(FILE,NAME)    \
  68.   do { fprintf (FILE, "%s ", GLOBAL_ASM_OP);        \
  69.        assemble_name (FILE, NAME);            \
  70.        fputs ("\n", FILE);} while (0)
  71.  
  72. /* This is how to output an internal numbered label where
  73.    PREFIX is the class of label and NUM is the number within the class.  */
  74.  
  75. #undef ASM_OUTPUT_INTERNAL_LABEL
  76. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)    \
  77.   asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
  78.  
  79. /* This is how to store into the string LABEL
  80.    the symbol_ref name of an internal numbered label where
  81.    PREFIX is the class of label and NUM is the number within the class.
  82.    This is suitable for output with `assemble_name'.  */
  83.  
  84. #undef STRING_SECTION_NAME
  85. #define STRING_SECTION_NAME "ascii"
  86.  
  87. #undef ASM_GENERATE_INTERNAL_LABEL
  88. #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)    \
  89.   sprintf (LABEL, "*%s%d", PREFIX, NUM)
  90.  
  91. /* Enable simulation when cross-compiling */
  92.  
  93. #if !defined(HOST_WORDS_BIG_ENDIAN)
  94. #define REAL_ARITHMETIC
  95. #elif HOST_WORDS_BIG_ENDIAN == 0
  96. #define REAL_ARITHMETIC
  97. #endif
  98.  
  99. #undef ASM_OUTPUT_ALIGNED_COMMON
  100. #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNED)          \
  101. { const_section ();                            \
  102.   assemble_name ((FILE), (NAME));                    \
  103.   fputs ("\t.comm ", (FILE));                        \
  104.   fprintf ((FILE), "%d\n", MAX ((SIZE), ((ALIGNED) / BITS_PER_UNIT)));}
  105.  
  106. /* This is how to output an assembler line defining a `double' constant.  */
  107.  
  108. #undef ASM_OUTPUT_DOUBLE
  109. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                    \
  110.   do {                                    \
  111.     long hex[2];                            \
  112.     REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex);                \
  113.     fprintf(FILE, "\t;    .double %.20g\n", (VALUE));            \
  114.     fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]);    \
  115.   } while (0)
  116.  
  117. /* This is how to output an assembler line defining a `float' constant.  */
  118.  
  119. #undef ASM_OUTPUT_FLOAT
  120. #define ASM_OUTPUT_FLOAT(FILE,VALUE)            \
  121. do { long l;                        \
  122.      REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);        \
  123.      fprintf(FILE, "\t;    .single %.12e\n", (VALUE));    \
  124.      fprintf (FILE, "\t.long 0x%x\n", l);        \
  125.    } while (0)
  126.  
  127. #undef ASM_OUTPUT_SKIP
  128. #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
  129.   fprintf (FILE, "\t.space %u\n", (SIZE))
  130.  
  131. /* Output to assembler file text saying following lines
  132.    may contain character constants, extra white space, comments, etc.  */
  133.  
  134. #undef    ASM_APP_ON
  135. #define ASM_APP_ON "#APP\n"
  136.  
  137. /* Output to assembler file text saying following lines
  138.    no longer contain unusual constructs.  */
  139.  
  140. #undef    ASM_APP_OFF
  141. #define ASM_APP_OFF "#NO_APP\n"
  142.  
  143. /* This is how to output a reference to a user-level label named NAME.
  144.    `assemble_name' uses this.  */
  145.  
  146. #define ASM_GENERATE_LABELREF(BUFFER,NAME)    \
  147.   do { if (NAME[0] == '+' || NAME[0] == '-') sprintf (BUFFER, "\"%s\"", NAME);     \
  148.        else if (!strncmp (NAME, "_OBJC_", 6)) sprintf (BUFFER, "L%s", NAME);       \
  149.        else if (!strncmp (NAME, ".objc_class_name_", 17)            \
  150.         || !strncmp (NAME, "$$", 2)) strcpy (BUFFER, NAME);        \
  151.        else if (!strncmp (NAME, "mcount", 6)) sprintf (BUFFER, "%s", NAME);       \
  152.        else sprintf (BUFFER, "_%s", NAME); } while (0)
  153.  
  154. /* This is how to output the definition of a user-level label named NAME,
  155.    such as the label on a static function or variable NAME.  */
  156.  
  157. #undef ASM_OUTPUT_LABEL
  158. #define ASM_OUTPUT_LABEL(FILE, NAME)    \
  159.   do { assemble_name (FILE, NAME);     \
  160.        if (TARGET_GAS)            \
  161.      fputc (':', FILE);        \
  162.        fputc ('\n', FILE); } while (0)
  163.  
  164.  
  165. #undef ASM_OUTPUT_LABELREF
  166. #define ASM_OUTPUT_LABELREF(FILE,NAME)                \
  167.   do { char __buf[256]; ASM_GENERATE_LABELREF (__buf, NAME);     \
  168.        fprintf (FILE, "%s", __buf); } while (0)
  169.  
  170. /* Base register for access to local variables of the function.  */
  171. #undef FRAME_POINTER_REGNUM
  172. #define FRAME_POINTER_REGNUM 4
  173.  
  174. #undef ARG_POINTER_REGNUM
  175. #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM 
  176.  
  177. /* See comments in rtl.h */
  178. #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
  179.  
  180. /* Output before read-only data.  */
  181.  
  182. #undef TEXT_SECTION_ASM_OP
  183. #define TEXT_SECTION_ASM_OP ".text"
  184.  
  185. /* Output before writable data.  */
  186.  
  187. #undef DATA_SECTION_ASM_OP
  188. #define DATA_SECTION_ASM_OP ".data"
  189.  
  190. /* override how BSS is handled */
  191.  
  192. #undef BSS_SECTION_ASM_OP
  193.  
  194. /* This says how to output an assembler line
  195.    to define a global common symbol.  */
  196.  
  197. #undef ASM_OUTPUT_COMMON
  198. #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
  199. ( fputs (".comm ", (FILE)),            \
  200.   assemble_name ((FILE), (NAME)),        \
  201.   fprintf ((FILE), ",%u\n", (ROUNDED)))
  202.  
  203. /* This says how to output an assembler line
  204.    to define a local common symbol.  */
  205.  
  206. #undef ASM_OUTPUT_LOCAL
  207. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
  208. ( fputs (".lcomm ", (FILE)),            \
  209.   assemble_name ((FILE), (NAME)),        \
  210.   fprintf ((FILE), ",%u\n", (ROUNDED)))
  211.  
  212. #undef ASM_FORMAT_PRIVATE_NAME
  213. #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)    \
  214. ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
  215.   sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
  216.  
  217. #undef ENCODE_SECTION_INFO
  218.  
  219. #undef    ASM_DECLARE_FUNCTION_NAME
  220.  
  221. #undef TRAMPOLINE_TEMPLATE(FILE)
  222. #define TRAMPOLINE_TEMPLATE(FILE) \
  223. {                        \
  224.   fprintf (FILE, "\tldw 12(0,%%r22),%%r21\n");    \
  225.   fprintf (FILE, "\tbe 0(4,%%r21)\n");        \
  226.   fprintf (FILE, "\tldw 16(0,%%r22),%%r29\n");    \
  227.   fprintf (FILE, "\t.short 0\n");        \
  228.   fprintf (FILE, "\t.short 0\n");        \
  229. }
  230.  
  231. #undef ASM_OUTPUT_INT
  232. #define ASM_OUTPUT_INT(FILE,VALUE)  \
  233. { fprintf (FILE, "\t.long ");            \
  234.   if (function_label_operand (VALUE, VOIDmode)  \
  235.       && in_section != in_text)            \
  236.     fprintf (FILE, "P%%");            \
  237.   output_addr_const (FILE, (VALUE));        \
  238.   fprintf (FILE, "\n");}
  239.  
  240. #undef ASM_OUTPUT_SHORT
  241. #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
  242. ( fprintf (FILE, "\t.short "),            \
  243.   output_addr_const (FILE, (VALUE)),        \
  244.   fprintf (FILE, "\n"))
  245.  
  246. #undef ASM_OUTPUT_ADDR_VEC_ELT
  247. #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
  248.   fprintf (FILE, "\tb L%d\n\tnop\n", VALUE)
  249.  
  250. #define OUTPUT_COMPILER_STUB
  251.  
  252. /* this may not work for double values --  hard coded to 32 bit entities */
  253.  
  254. #define OBJC_FORWARDING_REG_OFFSET(ISREG, OFF, REGNO) \
  255.   do { OFF = (FP_REG_CLASS_P( REGNO_REG_CLASS(REGNO)) \
  256.               ? -2 * ((REGNO) - 44) - 4               \
  257.               :  4 * ((REGNO) - 26) - 4);             \
  258.        ISREG = 0; } while (0)
  259.  
  260. #undef FUNCTION_ARG
  261. #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)                      \
  262.   (4 >= ((CUM).words + FUNCTION_ARG_SIZE ((MODE), (TYPE)))        \
  263.    ? gen_rtx (REG, (MODE),                        \
  264.           (FUNCTION_ARG_SIZE ((MODE), (TYPE)) > 1            \
  265.            ? (((MODE) == DFmode)                    \
  266.           ? ((CUM).words ? 50 : 46)                 \
  267.           : ((CUM).words ? 23 : 25))                \
  268.            : (((MODE) == SFmode)                    \
  269.           ? (44 + 2 * (CUM).words)                    \
  270.           : (27 - (CUM).words - FUNCTION_ARG_SIZE ((MODE), (TYPE))))))\
  271.    : 0)
  272.  
  273. /*
  274.    After the magic in calls.c has moved an argument into some register,
  275.    this macro is expanded so the backend can choose to duplicate
  276.    or spill that load to somewhere else.  
  277.      The NeXTSTEP/PA backend uses this to spill arguments from float
  278.    registers into the general purpose regs.  
  279.  
  280.    NAME is the name of the function being called.
  281.    NREGS is the number of registers being loaded into.
  282.    REG_RTX is the rtx for the (first) register being loaded.
  283.    VALUE_RTX is the value being loaded.
  284.    MODE is the mode the value is loaded in.
  285.  
  286.    The USE_DUP_REG_ARG_LOAD macro allows emitting USE insns 
  287.    for possible registers changed.
  288. */
  289.  
  290. #define DUP_REG_ARG_LOAD(NAME, NREGS, REG_RTX, VALUE_RTX, MODE)         \
  291.   do { if ((MODE)==DFmode && REGNO(REG_RTX) >= 46) {            \
  292.            move_block_to_reg ((REGNO(REG_RTX)==46 ? 25 : 23),         \
  293.               validize_mem(VALUE_RTX), 2, MODE);        \
  294.        } else if ((MODE)==SFmode && REGNO(REG_RTX) >= 44) {        \
  295.            move_block_to_reg (26-((REGNO(REG_RTX)-44)/2),        \
  296.               validize_mem(VALUE_RTX), 1, MODE); }              \
  297.   } while (0)
  298.  
  299. /* Emit insn's to actually use the spilled regs so the loads
  300.    will not be handled wrong by the optimizer. */
  301. #define USE_DUP_REG_ARG_LOAD(NAME, NREGS, REG_RTX, MODE)     \
  302.   do { if (NREGS == 0) { if ((MODE)==DFmode && REGNO(REG_RTX) >= 46) {    \
  303.        use_regs ((REGNO(REG_RTX)==46 ? 25 : 23), 2);        \
  304.        } else if ((MODE)==SFmode) {                    \
  305.            emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, 26-((REGNO (REG_RTX)-44)/2)))); }              \
  306.   }} while (0)
  307.  
  308. #define PROFILE_LABEL_PREFIX    
  309.  
  310. #undef OVERRIDE_OPTIONS
  311.  
  312. #undef CONSTANT_ADDRESS_P
  313. #define CONSTANT_ADDRESS_P(X) \
  314.   ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF        \
  315.    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST        \
  316.    || GET_CODE (X) == HIGH)                         \
  317.    && (reload_in_progress || reload_completed                 \
  318.        || ! symbolic_expression_p (X) || machopic_operand_p (X)))
  319.  
  320. #define HI_SUM_TARGET_RTX     (gen_rtx (REG, SImode, 1))
  321. #define HI_SUM_TARGET_REGNO     1
  322.  
  323. #undef ASM_OUTPUT_ADDR_DIFF_ELT
  324. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)  \
  325.   fprintf (FILE, "\tb L%d\n\tnop\n", VALUE)
  326.  
  327. #undef PIC_OFFSET_TABLE_REGNUM
  328. #define PIC_OFFSET_TABLE_REGNUM 18
  329.  
  330. #undef OPTIMIZATION_OPTIONS
  331. #define OPTIMIZATION_OPTIONS(OPTIMIZE) \
  332. {                                  \
  333.   if (OPTIMIZE >= 1)                        \
  334.     {                                \
  335.       flag_cse_follow_jumps = 1;                \
  336.       flag_cse_skip_blocks = 1;                    \
  337.       flag_expensive_optimizations = 1;                \
  338.       flag_strength_reduce = 1;                    \
  339.       flag_rerun_cse_after_loop = 1;                \
  340.       flag_caller_saves = 1;                    \
  341.       flag_schedule_insns = 1;                    \
  342.       flag_schedule_insns_after_reload = 1;                   \
  343.     }                                \
  344.   if (OPTIMIZE >= 2)                         \
  345.     flag_omit_frame_pointer = 1;                \
  346. }
  347.  
  348.