Annotation of GNUtools/cc/config/i386/next.h, revision 1.1.1.1

1.1       root        1: /* Target definitions for GNU compiler for Intel x86 CPU running NeXTSTEP
                      2:    Copyright (C) 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: #include "i386/gas.h"
                     21: #include "nextstep.h"
                     22: 
                     23: #define MACHO_PIC 1
                     24: 
                     25: #ifndef MACHOPIC_PURE
                     26: #define MACHOPIC_PURE          (flag_pic == 2)
                     27: #define MACHOPIC_INDIRECT      (flag_pic)
                     28: #define MACHOPIC_JUST_INDIRECT (flag_pic == 1)
                     29: #endif
                     30: 
                     31: #define DEFAULT_TARGET_ARCH "i386"
                     32: 
                     33: /* By default, target has a 80387, with IEEE FP.  */
                     34: 
                     35: #undef TARGET_DEFAULT
                     36: #define TARGET_DEFAULT  (1|0100)
                     37: 
                     38: #undef SUBTARGET_SWITCHES 
                     39: #define SUBTARGET_SWITCHES \
                     40:   { "unaligned-text",     0400 }, \
                     41:   { "no-unaligned-text", -0400 },
                     42: 
                     43: #define TARGET_NO_LOOP_ALIGNMENT (target_flags & 0400)
                     44: 
                     45: /* The NeXT configuration aligns everything at 4 byte boundary.
                     46:    Even though this is not optimal with respect to cache lines, this
                     47:    saves us sigificant space, which is a precious ressource on a
                     48:    NeXTSTEP machine. */
                     49: 
                     50: #undef ASM_OUTPUT_ALIGN_CODE
                     51: #define ASM_OUTPUT_ALIGN_CODE(FILE)                    \
                     52:    if (!TARGET_NO_LOOP_ALIGNMENT)                      \
                     53:      fprintf ((FILE), "\t.align 2,0x90\n")
                     54: 
                     55: /* Align start of loop at 4-byte boundary.  */
                     56: 
                     57: #undef ASM_OUTPUT_LOOP_ALIGN
                     58: #define ASM_OUTPUT_LOOP_ALIGN(FILE) \
                     59:    if (!TARGET_NO_LOOP_ALIGNMENT)                      \
                     60:      fprintf ((FILE), "\t.align 2,0x90\n");  /* Use log of 4 as arg.  */
                     61: 
                     62: #undef ASM_OUTPUT_ALIGN
                     63: #undef ASM_OUTPUT_ALIGN
                     64: #define ASM_OUTPUT_ALIGN(FILE,LOG)     \
                     65:  do { if ((LOG) != 0)                  \
                     66:       if (in_text_section ())          \
                     67:        fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \
                     68:       else \
                     69:        fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \
                     70:     } while (0)
                     71:        
                     72: 
                     73: #undef FUNCTION_BOUNDARY
                     74: #define FUNCTION_BOUNDARY 32
                     75: 
                     76: #define TARGET_ARCHITECTURE \
                     77:   { { "i386", 2 },   /* Treat i386 like i486.  */              \
                     78:     { "i486", 2 },   /* Turn on -m486.  */                     \
                     79:     { "i486SX", 2 }, /* Turn on -m486.  */                     \
                     80:  /* { "i586", 4 },   */ /* Turn on -m486.  */                  \
                     81:  /* { "i586SX", 4 }, */ /* Turn on -m586.  */                   \
                     82:  }
                     83: 
                     84: /* Implicit library calls should use memcpy, not bcopy, etc.  */
                     85: 
                     86: #define TARGET_MEM_FUNCTIONS
                     87: 
                     88: /* Machines that use the AT&T assembler syntax
                     89:    also return floating point values in an FP register.
                     90:    Define how to find the value returned by a function.
                     91:    VALTYPE is the data type of the value (as a tree).
                     92:    If the precise function being called is known, FUNC is its FUNCTION_DECL;
                     93:    otherwise, FUNC is 0.  */
                     94: 
                     95: #undef VALUE_REGNO
                     96: #define VALUE_REGNO(MODE) \
                     97:   ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode    \
                     98:    ? FIRST_FLOAT_REG : 0)
                     99: 
                    100: /* 1 if N is a possible register number for a function value. */
                    101: 
                    102: #undef FUNCTION_VALUE_REGNO_P
                    103: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N)== FIRST_FLOAT_REG)
                    104: 
                    105: #ifdef REAL_VALUE_TO_TARGET_LONG_DOUBLE
                    106: #undef ASM_OUTPUT_LONG_DOUBLE
                    107: #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                             \
                    108:   do {                                                                 \
                    109:     long hex[3];                                                       \
                    110:     REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, hex);                     \
                    111:     if (sizeof (int) == sizeof (long))                                 \
                    112:       fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n\t.long 0x%x\n",     \
                    113:                hex[0], hex[1], hex[2]);                                \
                    114:     else                                                               \
                    115:       fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n\t.long 0x%lx\n",  \
                    116:                hex[0], hex[1], hex[2]);                                \
                    117:   } while (0)
                    118: #endif
                    119: 
                    120: #ifdef REAL_VALUE_TO_TARGET_DOUBLE
                    121: #undef ASM_OUTPUT_DOUBLE
                    122: #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                  \
                    123:   do {                                                                 \
                    124:     long hex[2];                                                       \
                    125:     REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex);                          \
                    126:     if (sizeof (int) == sizeof (long))                                 \
                    127:       fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]);  \
                    128:     else                                                               \
                    129:       fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", hex[0], hex[1]);        \
                    130:   } while (0)
                    131: #endif
                    132: 
                    133: /* This is how to output an assembler line defining a `float' constant.  */
                    134: 
                    135: #ifdef REAL_VALUE_TO_TARGET_SINGLE
                    136: #undef ASM_OUTPUT_FLOAT
                    137: #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                   \
                    138:   do {                                                                 \
                    139:     long hex;                                                          \
                    140:     REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex);                          \
                    141:     if (sizeof (int) == sizeof (long))                                 \
                    142:       fprintf (FILE, "\t.long 0x%x\n", hex);                           \
                    143:     else                                                               \
                    144:       fprintf (FILE, "\t.long 0x%lx\n", hex);                          \
                    145:   } while (0)
                    146: #endif
                    147: 
                    148: /* A C statement or statements which output an assembler instruction
                    149:    opcode to the stdio stream STREAM.  The macro-operand PTR is a
                    150:    variable of type `char *' which points to the opcode name in its
                    151:    "internal" form--the form that is written in the machine description.
                    152: 
                    153:    GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
                    154:    So use `repe' instead.  */
                    155: 
                    156: #undef ASM_OUTPUT_OPCODE
                    157: #define ASM_OUTPUT_OPCODE(STREAM, PTR) \
                    158: {                                                      \
                    159:   if ((PTR)[0] == 'r'                                  \
                    160:       && (PTR)[1] == 'e'                               \
                    161:       && (PTR)[2] == 'p')                              \
                    162:     {                                                  \
                    163:       if ((PTR)[3] == 'z')                             \
                    164:        {                                               \
                    165:          fprintf (STREAM, "repe");                     \
                    166:          (PTR) += 4;                                   \
                    167:        }                                               \
                    168:       else if ((PTR)[3] == 'n' && (PTR)[4] == 'z')     \
                    169:        {                                               \
                    170:          fprintf (STREAM, "repne");                    \
                    171:          (PTR) += 5;                                   \
                    172:        }                                               \
                    173:     }                                                  \
                    174: }
                    175: 
                    176: /* Define macro used to output shift-double opcodes when the shift
                    177:    count is in %cl.  Some assemblers require %cl as an argument;
                    178:    some don't.
                    179: 
                    180:    GAS requires the %cl argument, so override unx386.h. */
                    181: 
                    182: #undef AS3_SHIFT_DOUBLE
                    183: #define AS3_SHIFT_DOUBLE(a,b,c,d) AS3 (a,b,c,d)
                    184: 
                    185: /* Print opcodes the way that GAS expects them. */
                    186: #define GAS_MNEMONICS 1
                    187: 
                    188: /* Names to predefine in the preprocessor for this target machine.  */
                    189: 
                    190: #undef CPP_PREDEFINES
                    191: #define CPP_PREDEFINES "-Di386 -DNeXT -Dunix -D__MACH__ -D__LITTLE_ENDIAN__ -D__ARCHITECTURE__=\"i386\" "
                    192: 
                    193: /* This accounts for the return pc and saved fp on the i386. */
                    194: 
                    195: #define OBJC_FORWARDING_STACK_OFFSET 8
                    196: #define OBJC_FORWARDING_MIN_OFFSET 8
                    197: 
                    198: /* We do not want a dot in internal labels.  */
                    199: 
                    200: #undef LPREFIX
                    201: #define LPREFIX "L"
                    202: 
                    203: #undef ASM_GENERATE_INTERNAL_LABEL
                    204: #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
                    205:     sprintf ((BUF), "*%s%d", (PREFIX), (NUMBER))
                    206: 
                    207: #undef ASM_OUTPUT_INTERNAL_LABEL
                    208: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)     \
                    209:   fprintf (FILE, "%s%d:\n", PREFIX, NUM)
                    210: 
                    211: /* Output to assembler file text saying following lines
                    212:    may contain character constants, extra white space, comments, etc.  */
                    213: 
                    214: #undef ASM_APP_ON
                    215: #define ASM_APP_ON "#APP\n"
                    216: 
                    217: /* Output to assembler file text saying following lines
                    218:    no longer contain unusual constructs.  */
                    219: 
                    220: #undef ASM_APP_OFF
                    221: #define ASM_APP_OFF "#NO_APP\n"
                    222: 
                    223: #undef ASM_OUTPUT_REG_PUSH
                    224: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
                    225:   fprintf (FILE, "\tpushl %se%s\n", "%", reg_names[REGNO])
                    226: 
                    227: #undef ASM_OUTPUT_REG_POP
                    228: #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
                    229:   fprintf (FILE, "\tpopl %se%s\n", "%", reg_names[REGNO])
                    230: 
                    231: /* This is being overridden because the default i386 configuration
                    232:    generates calls to "_mcount".  NeXT system libraries all use
                    233:    "mcount".  */
                    234: 
                    235: #undef FUNCTION_PROFILER
                    236: #define FUNCTION_PROFILER(FILE, LABELNO)                               \
                    237: {                                                                      \
                    238:   if (flag_pic)                                                                \
                    239:     {                                                                  \
                    240:       fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",             \
                    241:                LPREFIX, (LABELNO));                                    \
                    242:       fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");                   \
                    243:     }                                                                  \
                    244:   else                                                                 \
                    245:     {                                                                  \
                    246:       fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO));     \
                    247:       fprintf (FILE, "\tcall mcount\n");                               \
                    248:     }                                                                  \
                    249: }
                    250: 
                    251: /* BEGIN Calling Convention CHANGES */
                    252: 
                    253: /* These changes violate the Intel/Unix ABI.  Specifically, they
                    254:    change the way that space for a block return value is passed to a
                    255:    function.  The ABI says that the pointer is passed on the stack.
                    256:    We change to pass the pointer in %ebx.  This makes the NeXT
                    257:    Objective-C forwarding mechanism possible to implement on an i386.  */
                    258: 
                    259: /* Do NOT pass address of structure values on the stack.  */
                    260: 
                    261: #undef STRUCT_VALUE_INCOMING
                    262: #undef STRUCT_VALUE
                    263: 
                    264: /* Pass them in %ebx.  */
                    265: 
                    266: #undef STRUCT_VALUE_REGNUM
                    267: #define STRUCT_VALUE_REGNUM 3
                    268: 
                    269: /* Because we are passing the pointer in a register, we don't need to
                    270:    rely on the callee to pop it.  */
                    271: 
                    272: #undef RETURN_POPS_ARGS
                    273: #define RETURN_POPS_ARGS(FUNTYPE,SIZE)                                 \
                    274:   (TREE_CODE (FUNTYPE) == IDENTIFIER_NODE                      \
                    275:    ? 0                                                         \
                    276:    : (TARGET_RTD                                               \
                    277:       && (TYPE_ARG_TYPES (FUNTYPE) == 0                                \
                    278:           || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE)))        \
                    279:               == void_type_node))) ? (SIZE) : 0)
                    280: 
                    281: /* END Calling Convention CHANGES */
                    282: 
                    283: /* Turn on floating point precision control as default */
                    284: 
                    285: /* #define DEFAULT_FPPC 1 */
                    286: 
                    287: #undef ASM_OUTPUT_ADDR_DIFF_ELT
                    288: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
                    289:   fprintf (FILE, "\t.long %s%d-%s%d\n",LPREFIX, VALUE,LPREFIX, REL)
                    290: 
                    291: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.