Annotation of gcc/config/m68kv4.h, revision 1.1.1.3

1.1       root        1: /* Target definitions for GNU compiler for mc680x0 running System V.4
                      2:    Copyright (C) 1991 Free Software Foundation, Inc.
                      3: 
                      4:    Written by Ron Guilmette ([email protected]) and Fred Fish ([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: /* Use SGS_* macros to control compilation in m68k.md */
                     23: 
                     24: #define SGS_SWITCH_TABLES      /* Different switch table handling */
                     25: 
                     26: #include "m68ksgs.h"           /* The m68k/SVR4 assembler is SGS based */
                     27: #include "svr4.h"              /* Pick up the generic SVR4 macros */
                     28: 
                     29: /* See m68k.h.  7 means 68020 with 68881.  */
                     30: 
                     31: #ifndef TARGET_DEFAULT
                     32: #define        TARGET_DEFAULT (5 /*68020*/ + 2 /*68881*/)
                     33: #endif
                     34: 
                     35: /*  Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special
                     36:     g++ assembler names.  When this is defined, g++ uses embedded '.'
                     37:     characters and some m68k assemblers have problems with this.  The
                     38:     chances are much greater that any particular assembler will permit
                     39:     embedded '$' characters. */
                     40: 
                     41: #undef NO_DOLLAR_IN_LABEL
                     42: 
                     43: /* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine
                     44:    is to use the nonreentrant technique for returning structure and union
                     45:    values, as commonly implemented by the AT&T Portable C Compiler (PCC).
                     46:    When defined, the gcc option -fpcc-struct-return can be used to cause
                     47:    this form to be generated.  When undefined, the option does nothing.
                     48:    For m68k SVR4, the convention is to use a reentrant technique compatible
                     49:    with the gcc default, so override the definition of this macro in m68k.h */
                     50: 
                     51: #undef PCC_STATIC_STRUCT_RETURN
                     52: 
                     53: /* Provide a set of pre-definitions and pre-assertions appropriate for
                     54:    the m68k running svr4.  __svr4__ is our extension.  */
                     55: 
                     56: #define CPP_PREDEFINES \
                     57:   "-Dm68k -Dunix -D__svr4__ -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
                     58: 
                     59: /* Test to see if the target includes a 68881 by default, and use CPP_SPEC
                     60:    to control whether or not __HAVE_68881__ is defined by default or not.
                     61:    If a 68881 is the default, gcc will use inline 68881 instructions, by
                     62:    predefining __HAVE_68881__, unless -msoft-float is specified.
                     63:    If a 68881 is not the default, gcc will only define __HAVE_68881__ if
                     64:    -m68881 is specified. */
                     65: 
                     66: #if TARGET_DEFAULT & 2
                     67: #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
                     68: #else
                     69: #define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
                     70: #endif
                     71: 
                     72: /* Output assembler code to FILE to increment profiler label # LABELNO
                     73:    for profiling a function entry.  We override the definition in m68k.h
                     74:    and match the way the native m68k/SVR4 compiler does profiling, with the
                     75:    address of the profile counter in a1, not a0, and using bsr rather
                     76:    than jsr. */
                     77: 
                     78: #undef FUNCTION_PROFILER
                     79: #define FUNCTION_PROFILER(FILE, LABELNO)                               \
                     80:   asm_fprintf ((FILE), "\tlea.l\t(%LLP%d,%Rpc),%Ra1\n\tbsr\t_mcount\n", \
                     81:               (LABELNO))
                     82: 
                     83: /* Local common symbols are declared to the assembler with ".lcomm" rather
                     84:    than ".bss", so override the definition in svr4.h */
                     85: 
                     86: #undef BSS_ASM_OP
1.1.1.2   root       87: #define BSS_ASM_OP     ".lcomm"
1.1       root       88: 
                     89: /* Register in which address to store a structure value is passed to a
                     90:    function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0. */
                     91: 
                     92: #undef STRUCT_VALUE_REGNUM
                     93: #define STRUCT_VALUE_REGNUM 8
                     94: 
                     95: #define ASM_COMMENT_START "#"
                     96: 
                     97: #undef TYPE_OPERAND_FMT
                     98: #define TYPE_OPERAND_FMT      "@%s"
                     99: 
                    100: /* Define how the m68k registers should be numbered for Dwarf output.
                    101:    The numbering provided here should be compatible with the native
                    102:    SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7
                    103:    are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */
                    104: 
                    105: #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
                    106: 
                    107: /* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip".
                    108:    It is then overridden by m68ksgs.h to use ".space", and again by svr4.h
                    109:    to use ".zero".  The m68k/SVR4 assembler uses ".space", so repeat the
                    110:    definition from m68ksgs.h here.  Note that ASM_NO_SKIP_IN_TEXT is
                    111:    defined in m68ksgs.h, so we don't have to repeat it here. */
                    112: 
                    113: #undef ASM_OUTPUT_SKIP
                    114: #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
1.1.1.2   root      115:   fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE))
1.1       root      116: 
                    117: /* 1 if N is a possible register number for a function value.
                    118:    For m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
                    119:    pointer, or floating types, respectively. Reject fp0 if not using a
                    120:    68881 coprocessor. */
                    121: 
                    122: #undef FUNCTION_VALUE_REGNO_P
                    123: #define FUNCTION_VALUE_REGNO_P(N) \
                    124:   ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
                    125: 
                    126: /* Define how to generate (in the callee) the output value of a function
                    127:    and how to find (in the caller) the value returned by a function.  VALTYPE
                    128:    is the data type of the value (as a tree).  If the precise function being
                    129:    called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0.
                    130:    For m68k/SVR4 generate the result in d0, a0, or fp0 as appropriate. */
                    131:    
                    132: #undef FUNCTION_VALUE
                    133: #define FUNCTION_VALUE(VALTYPE, FUNC)                                  \
                    134:   (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881                    \
                    135:    ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16)                            \
                    136:    : (TREE_CODE (VALTYPE) == POINTER_TYPE                              \
                    137:       ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8)                          \
                    138:       : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
                    139: 
                    140: /* For compatibility with the large body of existing code which does not
                    141:    always properly declare external functions returning pointer types, the
                    142:    m68k/SVR4 convention is to copy the value returned for pointer functions
                    143:    from a0 to d0 in the function epilogue, so that callers that have
                    144:    neglected to properly declare the callee can still find the correct return
                    145:    value. */
                    146: 
                    147: extern int current_function_returns_pointer;
                    148: #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE)                            \
                    149: do {                                                                   \
                    150:   if ((current_function_returns_pointer) &&                            \
                    151:       ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode))       \
                    152:     asm_fprintf (FILE, "\tmov.l %Ra0,%Rd0\n");                         \
                    153: } while (0);
                    154: 
                    155: /* Define how to find the value returned by a library function assuming the
                    156:    value has mode MODE.
                    157:    For m68k/SVR4 look for integer values in d0, pointer values in d0
                    158:    (returned in both d0 and a0), and floating values in fp0. */
                    159: 
                    160: #undef LIBCALL_VALUE
                    161: #define LIBCALL_VALUE(MODE)                                            \
                    162:   (((MODE) == SFmode || (MODE) == DFmode) && TARGET_68881              \
                    163:    ? gen_rtx (REG, (MODE), 16)                                         \
                    164:    : gen_rtx (REG, (MODE), 0))
                    165: 
                    166: /* Boundary (in *bits*) on which stack pointer should be aligned.
                    167:    The m68k/SVR4 convention is to keep the stack pointer longword aligned. */
                    168:  
                    169: #undef STACK_BOUNDARY
                    170: #define STACK_BOUNDARY 32
                    171: 
                    172: /* Alignment of field after `int : 0' in a structure.
                    173:    For m68k/SVR4, this is the next longword boundary. */
                    174: 
                    175: #undef EMPTY_FIELD_BOUNDARY
                    176: #define EMPTY_FIELD_BOUNDARY 32
                    177: 
                    178: /* No data type wants to be aligned rounder than this.
                    179:    For m68k/SVR4, some types (doubles for example) are aligned on 8 byte
                    180:    boundaries */
                    181:        
                    182: #undef BIGGEST_ALIGNMENT
                    183: #define BIGGEST_ALIGNMENT 64
1.1.1.3 ! root      184: 
        !           185: /* SVR4 m68k assembler is bitching on the `comm i,1,1' which askes for 
        !           186:    1 byte alignment. Don't generate alignment for COMMON seems to be
        !           187:    safer until we the assembler is fixed. */
        !           188: #undef ASM_OUTPUT_ALIGNED_COMMON
        !           189: /* Same problem with this one.  */
        !           190: #undef ASM_OUTPUT_ALIGNED_LOCAL
        !           191: 
        !           192: /* The `string' directive on m68k svr4 does not handle string with
        !           193:    escape char (ie., `\') right. Use normal way to output ASCII bytes
        !           194:    seems to be safer. */
        !           195: #undef ASM_OUTPUT_ASCII
        !           196: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)                         \
        !           197: {                                                              \
        !           198:   register int sp = 0, lp = 0, ch;                             \
        !           199:   fprintf ((FILE), "\t%s ", BYTE_ASM_OP);                      \
        !           200:   do {                                                         \
        !           201:     ch = (PTR)[sp];                                            \
        !           202:     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')               \
        !           203:       {                                                                \
        !           204:        fprintf ((FILE), "'%c", ch);                            \
        !           205:       }                                                                \
        !           206:     else                                                       \
        !           207:       {                                                                \
        !           208:        fprintf ((FILE), "0x%x", ch);                           \
        !           209:       }                                                                \
        !           210:     if (++sp < (LEN))                                          \
        !           211:       {                                                                \
        !           212:        if ((sp % 10) == 0)                                     \
        !           213:          {                                                     \
        !           214:            fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP);           \
        !           215:          }                                                     \
        !           216:        else                                                    \
        !           217:          {                                                     \
        !           218:            putc (',', (FILE));                                 \
        !           219:          }                                                     \
        !           220:       }                                                                \
        !           221:   } while (sp < (LEN));                                                \
        !           222:   putc ('\n', (FILE));                                         \
        !           223: }
        !           224: 
        !           225: /* SVR4 m68k assembler is bitching on the syntax `2.b'.
        !           226:    So use the "LLDnnn-LLnnn" format.  Define LLDnnn after the table.  */
        !           227: 
        !           228: #undef ASM_OUTPUT_CASE_END
        !           229: #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE)                            \
        !           230: do {                                                                   \
        !           231:   if (switch_table_difference_label_flag)                              \
        !           232:     asm_fprintf ((FILE), "\t%s %LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\
        !           233:   switch_table_difference_label_flag = 0;                              \
        !           234: } while (0)
        !           235: 
        !           236: int switch_table_difference_label_flag;

unix.superglobalmegacorp.com

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