Annotation of gcc/config/m68k/m68kv4.h, revision 1.1.1.4

1.1       root        1: /* Target definitions for GNU compiler for mc680x0 running System V.4
1.1.1.4 ! root        2:    Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
1.1       root        3: 
1.1.1.3   root        4:    Written by Ron Guilmette ([email protected]) and Fred Fish ([email protected]).
1.1       root        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
1.1.1.4 ! root       20: the Free Software Foundation, 59 Temple Place - Suite 330,
        !            21: Boston, MA 02111-1307, USA.  */
1.1       root       22: 
                     23: /* Use SGS_* macros to control compilation in m68k.md */
                     24: 
                     25: #define SGS_SWITCH_TABLES      /* Different switch table handling */
                     26: 
                     27: #include "m68k/sgs.h"          /* The m68k/SVR4 assembler is SGS based */
1.1.1.3   root       28: 
                     29: /* The SGS assembler requires a special definition of
                     30:    ASM_IDENTIFY_GCC.  We combine the m68k/sgs.h and the svr4.h
                     31:    definitions below.  */
                     32: #undef ASM_IDENTIFY_GCC
                     33: 
1.1       root       34: #include "svr4.h"              /* Pick up the generic SVR4 macros */
                     35: 
                     36: /* See m68k.h.  7 means 68020 with 68881.  */
                     37: 
                     38: #ifndef TARGET_DEFAULT
                     39: #define        TARGET_DEFAULT (5 /*68020*/ + 2 /*68881*/)
                     40: #endif
                     41: 
1.1.1.3   root       42: /* When using an SGS assembler, modify the name of the artificial label which
                     43:    identifies this file as having been compiled with gcc, and the macro that
                     44:    emits such a label in the assembly output, to use '%' rather than '.'  */
                     45: 
                     46: #undef ASM_IDENTIFY_GCC
                     47: #define ASM_IDENTIFY_GCC(FILE)                                         \
                     48: do                                                                     \
                     49:   {                                                                    \
                     50:     if (write_symbols != DBX_DEBUG)                                    \
                     51:       fputs ("gcc2_compiled%:\n", FILE);                               \
                     52:   }                                                                    \
                     53: while (0)
                     54: 
1.1       root       55: /*  Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special
                     56:     g++ assembler names.  When this is defined, g++ uses embedded '.'
                     57:     characters and some m68k assemblers have problems with this.  The
                     58:     chances are much greater that any particular assembler will permit
                     59:     embedded '$' characters. */
                     60: 
                     61: #undef NO_DOLLAR_IN_LABEL
                     62: 
                     63: /* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine
                     64:    is to use the nonreentrant technique for returning structure and union
                     65:    values, as commonly implemented by the AT&T Portable C Compiler (PCC).
                     66:    When defined, the gcc option -fpcc-struct-return can be used to cause
                     67:    this form to be generated.  When undefined, the option does nothing.
                     68:    For m68k SVR4, the convention is to use a reentrant technique compatible
                     69:    with the gcc default, so override the definition of this macro in m68k.h */
                     70: 
                     71: #undef PCC_STATIC_STRUCT_RETURN
                     72: 
                     73: /* Provide a set of pre-definitions and pre-assertions appropriate for
                     74:    the m68k running svr4.  __svr4__ is our extension.  */
                     75: 
                     76: #define CPP_PREDEFINES \
1.1.1.2   root       77:   "-Dm68k -Dunix -D__svr4__ -D__motorola__ \
                     78:  -Asystem(unix) -Asystem(svr4) -Acpu(m68k) -Amachine(m68k)"
1.1       root       79: 
                     80: /* Test to see if the target includes a 68881 by default, and use CPP_SPEC
                     81:    to control whether or not __HAVE_68881__ is defined by default or not.
                     82:    If a 68881 is the default, gcc will use inline 68881 instructions, by
                     83:    predefining __HAVE_68881__, unless -msoft-float is specified.
                     84:    If a 68881 is not the default, gcc will only define __HAVE_68881__ if
                     85:    -m68881 is specified. */
                     86: 
                     87: #if TARGET_DEFAULT & 2
                     88: #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
                     89: #else
                     90: #define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
                     91: #endif
                     92: 
                     93: /* Output assembler code to FILE to increment profiler label # LABELNO
                     94:    for profiling a function entry.  We override the definition in m68k.h
                     95:    and match the way the native m68k/SVR4 compiler does profiling, with the
                     96:    address of the profile counter in a1, not a0, and using bsr rather
                     97:    than jsr. */
                     98: 
                     99: #undef FUNCTION_PROFILER
                    100: #define FUNCTION_PROFILER(FILE, LABELNO)                               \
                    101:   asm_fprintf ((FILE), "\tlea.l\t(%LLP%d,%Rpc),%Ra1\n\tbsr\t_mcount\n", \
                    102:               (LABELNO))
                    103: 
                    104: /* Local common symbols are declared to the assembler with ".lcomm" rather
                    105:    than ".bss", so override the definition in svr4.h */
                    106: 
                    107: #undef BSS_ASM_OP
                    108: #define BSS_ASM_OP     ".lcomm"
                    109: 
                    110: /* Register in which address to store a structure value is passed to a
                    111:    function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0. */
                    112: 
                    113: #undef STRUCT_VALUE_REGNUM
                    114: #define STRUCT_VALUE_REGNUM 8
                    115: 
                    116: #define ASM_COMMENT_START "#"
                    117: 
                    118: #undef TYPE_OPERAND_FMT
                    119: #define TYPE_OPERAND_FMT      "@%s"
                    120: 
                    121: /* Define how the m68k registers should be numbered for Dwarf output.
                    122:    The numbering provided here should be compatible with the native
                    123:    SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7
                    124:    are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */
                    125: 
                    126: #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
                    127: 
                    128: /* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip".
                    129:    It is then overridden by m68k/sgs.h to use ".space", and again by svr4.h
                    130:    to use ".zero".  The m68k/SVR4 assembler uses ".space", so repeat the
                    131:    definition from m68k/sgs.h here.  Note that ASM_NO_SKIP_IN_TEXT is
                    132:    defined in m68k/sgs.h, so we don't have to repeat it here. */
                    133: 
                    134: #undef ASM_OUTPUT_SKIP
                    135: #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
                    136:   fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE))
                    137: 
                    138: /* 1 if N is a possible register number for a function value.
                    139:    For m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
                    140:    pointer, or floating types, respectively. Reject fp0 if not using a
                    141:    68881 coprocessor. */
                    142: 
                    143: #undef FUNCTION_VALUE_REGNO_P
                    144: #define FUNCTION_VALUE_REGNO_P(N) \
                    145:   ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
                    146: 
                    147: /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
                    148:    more than one register.  */
                    149: 
                    150: #undef NEEDS_UNTYPED_CALL
                    151: #define NEEDS_UNTYPED_CALL 1
                    152: 
                    153: /* Define how to generate (in the callee) the output value of a function
                    154:    and how to find (in the caller) the value returned by a function.  VALTYPE
                    155:    is the data type of the value (as a tree).  If the precise function being
                    156:    called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0.
                    157:    For m68k/SVR4 generate the result in d0, a0, or fp0 as appropriate. */
                    158:    
                    159: #undef FUNCTION_VALUE
                    160: #define FUNCTION_VALUE(VALTYPE, FUNC)                                  \
                    161:   (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881                    \
                    162:    ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16)                            \
1.1.1.4 ! root      163:    : (POINTER_TYPE_P (VALTYPE)                                         \
1.1       root      164:       ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8)                          \
                    165:       : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
                    166: 
                    167: /* For compatibility with the large body of existing code which does not
                    168:    always properly declare external functions returning pointer types, the
                    169:    m68k/SVR4 convention is to copy the value returned for pointer functions
                    170:    from a0 to d0 in the function epilogue, so that callers that have
                    171:    neglected to properly declare the callee can still find the correct return
                    172:    value. */
                    173: 
                    174: extern int current_function_returns_pointer;
                    175: #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE)                            \
                    176: do {                                                                   \
                    177:   if ((current_function_returns_pointer) &&                            \
                    178:       ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode))       \
                    179:     asm_fprintf (FILE, "\tmov.l %Ra0,%Rd0\n");                         \
                    180: } while (0);
                    181: 
                    182: /* Define how to find the value returned by a library function assuming the
                    183:    value has mode MODE.
                    184:    For m68k/SVR4 look for integer values in d0, pointer values in d0
                    185:    (returned in both d0 and a0), and floating values in fp0. */
                    186: 
                    187: #undef LIBCALL_VALUE
                    188: #define LIBCALL_VALUE(MODE)                                            \
                    189:   (((MODE) == SFmode || (MODE) == DFmode) && TARGET_68881              \
                    190:    ? gen_rtx (REG, (MODE), 16)                                         \
                    191:    : gen_rtx (REG, (MODE), 0))
                    192: 
                    193: /* Boundary (in *bits*) on which stack pointer should be aligned.
                    194:    The m68k/SVR4 convention is to keep the stack pointer longword aligned. */
                    195:  
                    196: #undef STACK_BOUNDARY
                    197: #define STACK_BOUNDARY 32
                    198: 
                    199: /* Alignment of field after `int : 0' in a structure.
                    200:    For m68k/SVR4, this is the next longword boundary. */
                    201: 
                    202: #undef EMPTY_FIELD_BOUNDARY
                    203: #define EMPTY_FIELD_BOUNDARY 32
                    204: 
                    205: /* No data type wants to be aligned rounder than this.
                    206:    For m68k/SVR4, some types (doubles for example) are aligned on 8 byte
                    207:    boundaries */
                    208:        
                    209: #undef BIGGEST_ALIGNMENT
                    210: #define BIGGEST_ALIGNMENT 64
                    211: 
1.1.1.4 ! root      212: /* SVR4 m68k assembler is bitching on the `comm i,1,1' which asks for 
1.1       root      213:    1 byte alignment. Don't generate alignment for COMMON seems to be
                    214:    safer until we the assembler is fixed. */
                    215: #undef ASM_OUTPUT_ALIGNED_COMMON
                    216: /* Same problem with this one.  */
                    217: #undef ASM_OUTPUT_ALIGNED_LOCAL
                    218: 
                    219: /* The `string' directive on m68k svr4 does not handle string with
                    220:    escape char (ie., `\') right. Use normal way to output ASCII bytes
                    221:    seems to be safer. */
                    222: #undef ASM_OUTPUT_ASCII
                    223: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)                         \
1.1.1.3   root      224: do {                                                           \
1.1       root      225:   register int sp = 0, lp = 0, ch;                             \
                    226:   fprintf ((FILE), "\t%s ", BYTE_ASM_OP);                      \
                    227:   do {                                                         \
                    228:     ch = (PTR)[sp];                                            \
                    229:     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')               \
                    230:       {                                                                \
                    231:        fprintf ((FILE), "'%c", ch);                            \
                    232:       }                                                                \
                    233:     else                                                       \
                    234:       {                                                                \
                    235:        fprintf ((FILE), "0x%x", ch);                           \
                    236:       }                                                                \
                    237:     if (++sp < (LEN))                                          \
                    238:       {                                                                \
                    239:        if ((sp % 10) == 0)                                     \
                    240:          {                                                     \
                    241:            fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP);           \
                    242:          }                                                     \
                    243:        else                                                    \
                    244:          {                                                     \
                    245:            putc (',', (FILE));                                 \
                    246:          }                                                     \
                    247:       }                                                                \
                    248:   } while (sp < (LEN));                                                \
                    249:   putc ('\n', (FILE));                                         \
1.1.1.3   root      250: } while (0)
1.1       root      251: 
                    252: /* SVR4 m68k assembler is bitching on the syntax `2.b'.
                    253:    So use the "LLDnnn-LLnnn" format.  Define LLDnnn after the table.  */
                    254: 
                    255: #undef ASM_OUTPUT_CASE_END
                    256: #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE)                            \
                    257: do {                                                                   \
                    258:   if (switch_table_difference_label_flag)                              \
                    259:     asm_fprintf ((FILE), "\t%s %LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\
                    260:   switch_table_difference_label_flag = 0;                              \
                    261: } while (0)
                    262: 
                    263: int switch_table_difference_label_flag;
                    264: 
                    265: #undef ASM_OUTPUT_COMMON
                    266: #undef ASM_OUTPUT_LOCAL
                    267: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
                    268: ( fputs (".comm ", (FILE)),                    \
                    269:   assemble_name ((FILE), (NAME)),              \
                    270:   fprintf ((FILE), ",%u\n", (SIZE)))
                    271: 
                    272: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
                    273: ( fputs (".lcomm ", (FILE)),                   \
                    274:   assemble_name ((FILE), (NAME)),              \
                    275:   fprintf ((FILE), ",%u\n", (SIZE)))
                    276: 
                    277: /* Override the definition in svr4.h. In m68k svr4, using swbeg is the 
                    278:    standard way to do switch table. */
                    279: #undef ASM_OUTPUT_BEFORE_CASE_LABEL
                    280: #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE)            \
                    281:   fprintf ((FILE), "\t%s &%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
                    282: 
                    283: /* In m68k svr4, a symbol_ref rtx can be a valid PIC operand if it is an
                    284:    operand of a function call. */
                    285: #undef LEGITIMATE_PIC_OPERAND_P
                    286: #define LEGITIMATE_PIC_OPERAND_P(X) \
1.1.1.4 ! root      287:   ((! symbolic_operand (X, VOIDmode) \
        !           288:     && ! (GET_CODE (X) == CONST_DOUBLE && CONST_DOUBLE_MEM (X) \
        !           289:          && GET_CODE (CONST_DOUBLE_MEM (X)) == MEM             \
        !           290:          && symbolic_operand (XEXP (CONST_DOUBLE_MEM (X), 0), VOIDmode))) \
        !           291:    || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
1.1       root      292: 
                    293: /* Turn off function cse if we are doing PIC. We always want function call
                    294:    to be done as `bsr foo@PLTPC', so it will force the assembler to create 
                    295:    the PLT entry for `foo'. Doing function cse will cause the address of `foo'
                    296:    to be loaded into a register, which is exactly what we want to avoid when
                    297:    we are doing PIC on svr4 m68k. */
                    298: #undef OVERRIDE_OPTIONS
                    299: #define OVERRIDE_OPTIONS               \
                    300: {                                      \
                    301:   if (flag_pic) flag_no_function_cse = 1; \
                    302:   if (! TARGET_68020 && flag_pic == 2) \
                    303:     error("-fPIC is not currently supported on the 68000 or 68010\n"); \
                    304: }

unix.superglobalmegacorp.com

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