Annotation of gcc/config/i386v4.h, revision 1.1.1.2

1.1       root        1: /* Target definitions for GNU compiler for Intel 80386 running System V.4
                      2:    Copyright (C) 1991 Free Software Foundation, Inc.
                      3: 
                      4:    Written by Ron Guilmette ([email protected]).
                      5: 
                      6: This file is part of GNU CC.
                      7: 
                      8: GNU CC is free software; you can redistribute it and/or modify
                      9: it under the terms of the GNU General Public License as published by
                     10: the Free Software Foundation; either version 2, or (at your option)
                     11: any later version.
                     12: 
                     13: GNU CC is distributed in the hope that it will be useful,
                     14: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     16: GNU General Public License for more details.
                     17: 
                     18: You should have received a copy of the GNU General Public License
                     19: along with GNU CC; see the file COPYING.  If not, write to
                     20: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                     21: 
                     22: #include "i386.h"      /* Base i386 target machine definitions */
                     23: #include "att386.h"    /* Use the i386 AT&T assembler syntax */
                     24: #include "svr4.h"      /* Definitions common to all SVR4 targets */
1.1.1.2 ! root       25: #include "real.h"
1.1       root       26: 
                     27: #undef TARGET_VERSION
                     28: #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
                     29: 
                     30: /* By default, target has a 80387.  */
                     31: 
                     32: #define TARGET_DEFAULT 1
                     33: 
                     34: /* Machines that use the AT&T assembler syntax
                     35:    also return floating point values in an FP register.  */
                     36: /* Define how to find the value returned by a function.
                     37:    VALTYPE is the data type of the value (as a tree).
                     38:    If the precise function being called is known, FUNC is its FUNCTION_DECL;
                     39:    otherwise, FUNC is 0.  */
                     40: 
                     41: #define VALUE_REGNO(MODE) \
                     42:   (((MODE) == SFmode || (MODE) == DFmode) ? FIRST_FLOAT_REG : 0)
                     43: 
                     44: /* 1 if N is a possible register number for a function value. */
                     45: 
                     46: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N)== FIRST_FLOAT_REG)
                     47: 
                     48: /* The svr4 ABI for the i386 says that records and unions are returned
                     49:    in memory.  */
                     50: 
                     51: #undef RETURN_IN_MEMORY
                     52: #define RETURN_IN_MEMORY(TYPE) \
                     53:   (TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE)
                     54: 
                     55: /* Define which macros to predefine.  __svr4__ is our extension.  */
                     56: /* This used to define X86, but [email protected] says that
                     57:    is supposed to be defined optionally by user programs--not by default.  */
                     58: #define CPP_PREDEFINES \
                     59:   "-Di386 -Dunix -D__svr4__ -Asystem(unix) -Acpu(i386) -Amachine(i386)"
                     60: 
1.1.1.2 ! root       61: /* If the host and target formats match, output the floats as hex.  */
        !            62: #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
        !            63: #if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
        !            64: /* This is how to output assembly code to define a `float' constant.
        !            65:    We always have to use a .long pseudo-op to do this because the native
        !            66:    SVR4 ELF assembler is buggy and it generates incorrect values when we
        !            67:    try to use the .float pseudo-op instead.  */
        !            68: 
        !            69: #undef ASM_OUTPUT_FLOAT
        !            70: #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                   \
        !            71: do { long value;                                                       \
        !            72:      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);                     \
        !            73:      fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value);                   \
        !            74:    } while (0)
        !            75: 
        !            76: /* This is how to output assembly code to define a `double' constant.
        !            77:    We always have to use a pair of .long pseudo-ops to do this because
        !            78:    the native SVR4 ELF assembler is buggy and it generates incorrect
        !            79:    values when we try to use the the .double pseudo-op instead.  */
        !            80: 
        !            81: #undef ASM_OUTPUT_DOUBLE
        !            82: #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                  \
        !            83: do { long value[2];                                                    \
        !            84:      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);                     \
        !            85:      fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]);                        \
        !            86:      fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]);                        \
        !            87:    } while (0)
        !            88: #endif /* word order matches */
        !            89: #endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
        !            90: 
1.1       root       91: /* Output at beginning of assembler file.  */
                     92: /* The .file command should always begin the output.  */
                     93: 
                     94: #undef ASM_FILE_START
                     95: #define ASM_FILE_START(FILE)                                           \
                     96:   do {                                                                 \
                     97:        output_file_directive (FILE, main_input_filename);              \
                     98:        fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
                     99:   } while (0)
                    100: 
                    101: /* Define the register numbers to be used in Dwarf debugging information.
                    102:    The SVR4 reference port C compiler uses the following register numbers
                    103:    in its Dwarf output code:
                    104: 
1.1.1.2 ! root      105:        0 for %eax (gnu regno = 0)
        !           106:        1 for %ecx (gnu regno = 2)
        !           107:        2 for %edx (gnu regno = 1)
        !           108:        3 for %ebx (gnu regno = 3)
        !           109:        4 for %esp (gnu regno = 7)
        !           110:        5 for %ebp (gnu regno = 6)
        !           111:        6 for %esi (gnu regno = 4)
        !           112:        7 for %edi (gnu regno = 5)
        !           113: 
        !           114:    The following three DWARF register numbers are never generated by
        !           115:    the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
        !           116:    believes these numbers have these meanings.
        !           117: 
        !           118:        8  for %eip    (no gnu equivalent)
        !           119:        9  for %eflags (no gnu equivalent)
        !           120:        10 for %trapno (no gnu equivalent)
        !           121: 
        !           122:    It is not at all clear how we should number the FP stack registers
        !           123:    for the x86 architecture.  If the version of SDB on x86/svr4 were
        !           124:    a bit less brain dead with respect to floating-point then we would
        !           125:    have a precedent to follow with respect to DWARF register numbers
        !           126:    for x86 FP registers, but the SDB on x86/svr4 is so completely
        !           127:    broken with respect to FP registers that it is hardly worth thinking
        !           128:    of it as something to strive for compatability with.
        !           129: 
        !           130:    The verison of x86/svr4 SDB I have at the moment does (partially)
        !           131:    seem to believe that DWARF register number 11 is associated with
        !           132:    the x86 register %st(0), but that's about all.  Higher DWARF
        !           133:    register numbers don't seem to be associated with anything in
        !           134:    particular, and even for DWARF regno 11, SDB only seems to under-
        !           135:    stand that it should say that a variable lives in %st(0) (when
        !           136:    asked via an `=' command) if we said it was in DWARF regno 11,
        !           137:    but SDB still prints garbage when asked for the value of the
        !           138:    variable in question (via a `/' command).
        !           139: 
        !           140:    (Also note that the labels SDB prints for various FP stack regs
        !           141:    when doing an `x' command are all wrong.)
        !           142: 
        !           143:    Note that these problems generally don't affect the native SVR4
        !           144:    C compiler because it doesn't allow the use of -O with -g and
        !           145:    because when it is *not* optimizing, it allocates a memory
        !           146:    location for each floating-point variable, and the memory
        !           147:    location is what gets described in the DWARF AT_location
        !           148:    attribute for the variable in question.
        !           149: 
        !           150:    Regardless of the severe mental illness of the x86/svr4 SDB, we
        !           151:    do something sensible here and we use the following DWARF
        !           152:    register numbers.  Note that these are all stack-top-relative
        !           153:    numbers.
        !           154: 
        !           155:        11 for %st(0) (gnu regno = 8)
        !           156:        12 for %st(1) (gnu regno = 9)
        !           157:        13 for %st(2) (gnu regno = 10)
        !           158:        14 for %st(3) (gnu regno = 11)
        !           159:        15 for %st(4) (gnu regno = 12)
        !           160:        16 for %st(5) (gnu regno = 13)
        !           161:        17 for %st(6) (gnu regno = 14)
        !           162:        18 for %st(7) (gnu regno = 15)
1.1       root      163: */
                    164: 
                    165: #undef DBX_REGISTER_NUMBER
                    166: #define DBX_REGISTER_NUMBER(n) \
                    167: ((n) == 0 ? 0 \
                    168:  : (n) == 1 ? 2 \
                    169:  : (n) == 2 ? 1 \
                    170:  : (n) == 3 ? 3 \
                    171:  : (n) == 4 ? 6 \
                    172:  : (n) == 5 ? 7 \
                    173:  : (n) == 6 ? 5 \
                    174:  : (n) == 7 ? 4 \
1.1.1.2 ! root      175:  : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
1.1       root      176:  : (abort (), 0))
                    177: 
                    178: /* The routine used to output sequences of byte values.  We use a special
                    179:    version of this for most svr4 targets because doing so makes the
                    180:    generated assembly code more compact (and thus faster to assemble)
                    181:    as well as more readable.  Note that if we find subparts of the
                    182:    character sequence which end with NUL (and which are shorter than
                    183:    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
                    184: 
                    185: #undef ASM_OUTPUT_ASCII
                    186: #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                            \
                    187:   do                                                                   \
                    188:     {                                                                  \
                    189:       register unsigned char *_ascii_bytes = (unsigned char *) (STR);  \
                    190:       register unsigned char *limit = _ascii_bytes + (LENGTH);         \
                    191:       register unsigned bytes_in_chunk = 0;                            \
                    192:       for (; _ascii_bytes < limit; _ascii_bytes++)                     \
                    193:         {                                                              \
                    194:          register unsigned char *p;                                    \
                    195:          if (bytes_in_chunk >= 64)                                     \
                    196:            {                                                           \
                    197:              fputc ('\n', (FILE));                                     \
                    198:              bytes_in_chunk = 0;                                       \
                    199:            }                                                           \
                    200:          for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
                    201:            continue;                                                   \
                    202:          if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)          \
                    203:            {                                                           \
                    204:              if (bytes_in_chunk > 0)                                   \
                    205:                {                                                       \
                    206:                  fputc ('\n', (FILE));                                 \
                    207:                  bytes_in_chunk = 0;                                   \
                    208:                }                                                       \
                    209:              ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
                    210:              _ascii_bytes = p;                                         \
                    211:            }                                                           \
                    212:          else                                                          \
                    213:            {                                                           \
                    214:              if (bytes_in_chunk == 0)                                  \
                    215:                fprintf ((FILE), "\t.byte\t");                          \
                    216:              else                                                      \
                    217:                fputc (',', (FILE));                                    \
                    218:              fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
                    219:              bytes_in_chunk += 5;                                      \
                    220:            }                                                           \
                    221:        }                                                               \
                    222:       if (bytes_in_chunk > 0)                                          \
                    223:         fprintf ((FILE), "\n");                                                \
                    224:     }                                                                  \
                    225:   while (0)
                    226: 
                    227: /* This is how to output an element of a case-vector that is relative.
                    228:    This is only used for PIC code.  See comments by the `casesi' insn in
                    229:    i386.md for an explanation of the expression this outputs. */
                    230: 
                    231: #undef ASM_OUTPUT_ADDR_DIFF_ELT
                    232: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
                    233:   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
                    234: 
                    235: /* Indicate that jump tables go in the text section.  This is
                    236:    necessary when compiling PIC code.  */
                    237: 
                    238: #define JUMP_TABLES_IN_TEXT_SECTION
                    239: 
                    240: /* Biggest alignment that any structure field can require on this
                    241:    machine, in bits.  If packing is in effect, this can be smaller than
                    242:    normal.  */
                    243: 
                    244: #define BIGGEST_FIELD_ALIGNMENT \
                    245:   (maximum_field_alignment ? maximum_field_alignment : 32)
                    246: 
                    247: extern int maximum_field_alignment;
                    248: 
                    249: /* If bit field type is int, don't let it cross an int,
                    250:    and give entire struct the alignment of an int.  */
                    251: /* Required on the 386 since it doesn't have bitfield insns.  */
                    252: /* If packing is in effect, then the type doesn't matter.  */
                    253: 
                    254: #undef PCC_BITFIELD_TYPE_MATTERS
                    255: #define PCC_BITFIELD_TYPE_MATTERS (maximum_field_alignment == 0)
                    256: 
                    257: /* Code to handle #pragma directives.  The interface is a bit messy,
                    258:    but there's no simpler way to do this while still using yylex.  */
                    259: #define HANDLE_PRAGMA(FILE)                                    \
                    260:   do {                                                         \
                    261:     while (c == ' ' || c == '\t')                              \
                    262:       c = getc (FILE);                                         \
                    263:     if (c == '\n' || c == EOF)                                 \
                    264:       {                                                                \
                    265:        handle_pragma_token (0, 0);                             \
                    266:        return c;                                               \
                    267:       }                                                                \
                    268:     ungetc (c, FILE);                                          \
                    269:     switch (yylex ())                                          \
                    270:       {                                                                \
                    271:       case IDENTIFIER:                                         \
                    272:       case TYPENAME:                                           \
                    273:       case STRING:                                             \
                    274:       case CONSTANT:                                           \
                    275:        handle_pragma_token (token_buffer, yylval.ttype);       \
                    276:        break;                                                  \
                    277:       default:                                                 \
                    278:        handle_pragma_token (token_buffer, 0);                  \
                    279:       }                                                                \
                    280:     if (nextchar >= 0)                                         \
                    281:       c = nextchar, nextchar = -1;                             \
                    282:     else                                                       \
                    283:       c = getc (FILE);                                         \
                    284:   } while (1)

unix.superglobalmegacorp.com

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