darwin.h revision 96263
190075Sobrien/* Target definitions for PowerPC running Darwin (Mac OS X). 290075Sobrien Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. 390075Sobrien Contributed by Apple Computer Inc. 490075Sobrien 590075SobrienThis file is part of GNU CC. 690075Sobrien 790075SobrienGNU CC is free software; you can redistribute it and/or modify 890075Sobrienit under the terms of the GNU General Public License as published by 990075Sobrienthe Free Software Foundation; either version 2, or (at your option) 1090075Sobrienany later version. 1190075Sobrien 1290075SobrienGNU CC is distributed in the hope that it will be useful, 1390075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1490075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1590075SobrienGNU General Public License for more details. 1690075Sobrien 1790075SobrienYou should have received a copy of the GNU General Public License 1890075Sobrienalong with GNU CC; see the file COPYING. If not, write to 1990075Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330, 2090075SobrienBoston, MA 02111-1307, USA. */ 2190075Sobrien 2290075Sobrien#undef TARGET_VERSION 2390075Sobrien#define TARGET_VERSION fprintf (stderr, " (Darwin/PowerPC)"); 2490075Sobrien 2590075Sobrien/* The "Darwin ABI" is mostly like AIX, but with some key differences. */ 2690075Sobrien 2790075Sobrien#define DEFAULT_ABI ABI_DARWIN 2890075Sobrien 2990075Sobrien/* The object file format is Mach-O. */ 3090075Sobrien 3190075Sobrien#define TARGET_OBJECT_FORMAT OBJECT_MACHO 3290075Sobrien 3390075Sobrien/* We're not ever going to do TOCs. */ 3490075Sobrien 3590075Sobrien#define TARGET_TOC 0 3690075Sobrien#define TARGET_NO_TOC 1 3790075Sobrien 3896263Sobrien/* Handle #pragma weak and #pragma pack. */ 3996263Sobrien#define HANDLE_SYSV_PRAGMA 4096263Sobrien 4190075Sobrien/* The Darwin ABI always includes AltiVec, can't be (validly) turned 4290075Sobrien off. */ 4390075Sobrien 4490075Sobrien#define SUBTARGET_OVERRIDE_OPTIONS \ 4590075Sobrien rs6000_altivec_abi = 1; 4690075Sobrien 4790075Sobrien#define CPP_PREDEFINES "-D__ppc__ -D__POWERPC__ -D__NATURAL_ALIGNMENT__ -D__MACH__ -D__BIG_ENDIAN__ -D__APPLE__" 4890075Sobrien 4990075Sobrien/* We want -fPIC by default, unless we're using -static to compile for 5090075Sobrien the kernel or some such. */ 5190075Sobrien 5290075Sobrien#define CC1_SPEC "%{!static:-fPIC}" 5390075Sobrien 5490075Sobrien/* Make both r2 and r3 available for allocation. */ 5590075Sobrien#define FIXED_R2 0 5690075Sobrien#define FIXED_R13 0 5790075Sobrien 5890075Sobrien/* Base register for access to local variables of the function. */ 5990075Sobrien 6090075Sobrien#undef FRAME_POINTER_REGNUM 6190075Sobrien#define FRAME_POINTER_REGNUM 30 6290075Sobrien 6396263Sobrien#undef RS6000_PIC_OFFSET_TABLE_REGNUM 6496263Sobrien#define RS6000_PIC_OFFSET_TABLE_REGNUM 31 6590075Sobrien 6690075Sobrien/* Pad the outgoing args area to 16 bytes instead of the usual 8. */ 6790075Sobrien 6890075Sobrien#undef STARTING_FRAME_OFFSET 6990075Sobrien#define STARTING_FRAME_OFFSET \ 7090075Sobrien (RS6000_ALIGN (current_function_outgoing_args_size, 16) \ 7190075Sobrien + RS6000_VARARGS_AREA \ 7290075Sobrien + RS6000_SAVE_AREA) 7390075Sobrien 7490075Sobrien#undef STACK_DYNAMIC_OFFSET 7590075Sobrien#define STACK_DYNAMIC_OFFSET(FUNDECL) \ 7690075Sobrien (RS6000_ALIGN (current_function_outgoing_args_size, 16) \ 7790075Sobrien + (STACK_POINTER_OFFSET)) 7890075Sobrien 7990075Sobrien/* Define cutoff for using external functions to save floating point. 8090075Sobrien Currently on Darwin, always use inline stores. */ 8190075Sobrien 8290075Sobrien#undef FP_SAVE_INLINE 8390075Sobrien#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64) 8490075Sobrien 8590075Sobrien/* Always use the "debug" register names, they're what the assembler 8690075Sobrien wants to see. */ 8790075Sobrien 8890075Sobrien#undef REGISTER_NAMES 8990075Sobrien#define REGISTER_NAMES DEBUG_REGISTER_NAMES 9090075Sobrien 9190075Sobrien/* This outputs NAME to FILE. */ 9290075Sobrien 9390075Sobrien#undef RS6000_OUTPUT_BASENAME 9490075Sobrien#define RS6000_OUTPUT_BASENAME(FILE, NAME) \ 9590075Sobrien assemble_name (FILE, NAME); 9690075Sobrien 9790075Sobrien/* Output before instructions. */ 9890075Sobrien/* This is how to output the definition of a user-level label named NAME, 9990075Sobrien such as the label on a static function or variable NAME. */ 10090075Sobrien 10190075Sobrien#define ASM_OUTPUT_LABEL(FILE,NAME) \ 10290075Sobrien do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) 10390075Sobrien 10490075Sobrien/* This is how to output a command to make the user-level label named NAME 10590075Sobrien defined for reference from other files. */ 10690075Sobrien 10790075Sobrien#undef ASM_GLOBALIZE_LABEL 10890075Sobrien#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ 10990075Sobrien do { fputs ("\t.globl ", FILE); \ 11090075Sobrien RS6000_OUTPUT_BASENAME (FILE, NAME); putc ('\n', FILE);} while (0) 11190075Sobrien 11290075Sobrien/* This is how to output an internal label prefix. rs6000.c uses this 11390075Sobrien when generating traceback tables. */ 11490075Sobrien/* Not really used for Darwin? */ 11590075Sobrien 11690075Sobrien#undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX 11790075Sobrien#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \ 11890075Sobrien fprintf (FILE, "%s", PREFIX) 11990075Sobrien 12090075Sobrien#undef TEXT_SECTION_ASM_OP 12190075Sobrien#define TEXT_SECTION_ASM_OP ".text" 12290075Sobrien 12390075Sobrien/* Output before writable data. */ 12490075Sobrien 12590075Sobrien#undef DATA_SECTION_ASM_OP 12690075Sobrien#define DATA_SECTION_ASM_OP ".data" 12790075Sobrien 12890075Sobrien/* This says how to output an assembler line to define a global common 12990075Sobrien symbol. */ 13090075Sobrien/* ? */ 13190075Sobrien#undef ASM_OUTPUT_ALIGNED_COMMON 13290075Sobrien#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ 13390075Sobrien do { fputs (".comm ", (FILE)); \ 13490075Sobrien RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \ 13590075Sobrien fprintf ((FILE), ",%d\n", (SIZE)); } while (0) 13690075Sobrien 13790075Sobrien#define ASM_OUTPUT_SKIP(FILE,SIZE) \ 13890075Sobrien fprintf (FILE, "\t.space %d\n", SIZE) 13990075Sobrien 14090075Sobrien/* Override the standard rs6000 definition. */ 14190075Sobrien 14290075Sobrien#undef ASM_COMMENT_START 14390075Sobrien#define ASM_COMMENT_START ";" 14490075Sobrien 14590075Sobrien/* FP save and restore routines. */ 14690075Sobrien#define SAVE_FP_PREFIX "._savef" 14790075Sobrien#define SAVE_FP_SUFFIX "" 14890075Sobrien#define RESTORE_FP_PREFIX "._restf" 14990075Sobrien#define RESTORE_FP_SUFFIX "" 15090075Sobrien 15190075Sobrien/* Generate insns to call the profiler. */ 15290075Sobrien 15390075Sobrien#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL) 15490075Sobrien 15590075Sobrien/* Function name to call to do profiling. */ 15690075Sobrien 15790075Sobrien#define RS6000_MCOUNT "*mcount" 15890075Sobrien 15990075Sobrien/* Default processor: a G4. */ 16090075Sobrien 16190075Sobrien#undef PROCESSOR_DEFAULT 16290075Sobrien#define PROCESSOR_DEFAULT PROCESSOR_PPC7400 16390075Sobrien 16490075Sobrien/* Default target flag settings. Despite the fact that STMW/LMW 16590075Sobrien serializes, it's still a big codesize win to use them. Use FSEL by 16690075Sobrien default as well. */ 16790075Sobrien 16890075Sobrien#undef TARGET_DEFAULT 16990075Sobrien#define TARGET_DEFAULT (MASK_POWERPC | MASK_MULTIPLE | MASK_NEW_MNEMONICS \ 17090075Sobrien | MASK_PPC_GFXOPT) 17190075Sobrien 17290075Sobrien/* Since Darwin doesn't do TOCs, stub this out. */ 17390075Sobrien 17490075Sobrien#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) 0 17590075Sobrien 17690075Sobrien/* Unlike most other PowerPC targets, chars are signed, for 17790075Sobrien consistency with other Darwin architectures. */ 17890075Sobrien 17990075Sobrien#undef DEFAULT_SIGNED_CHAR 18090075Sobrien#define DEFAULT_SIGNED_CHAR (1) 18190075Sobrien 18290075Sobrien/* Given an rtx X being reloaded into a reg required to be 18390075Sobrien in class CLASS, return the class of reg to actually use. 18490075Sobrien In general this is just CLASS; but on some machines 18590075Sobrien in some cases it is preferable to use a more restrictive class. 18690075Sobrien 18790075Sobrien On the RS/6000, we have to return NO_REGS when we want to reload a 18890075Sobrien floating-point CONST_DOUBLE to force it to be copied to memory. 18990075Sobrien 19090075Sobrien Don't allow R0 when loading the address of, or otherwise furtling with, 19190075Sobrien a SYMBOL_REF. */ 19290075Sobrien 19390075Sobrien#undef PREFERRED_RELOAD_CLASS 19490075Sobrien#define PREFERRED_RELOAD_CLASS(X,CLASS) \ 19590075Sobrien (((GET_CODE (X) == CONST_DOUBLE \ 19690075Sobrien && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \ 19790075Sobrien ? NO_REGS \ 19890075Sobrien : (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT \ 19990075Sobrien && (CLASS) == NON_SPECIAL_REGS) \ 20090075Sobrien ? GENERAL_REGS \ 20190075Sobrien : (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == HIGH) \ 20290075Sobrien ? BASE_REGS \ 20390075Sobrien : (CLASS))) 20490075Sobrien 20590075Sobrien/* Fix for emit_group_load (): force large constants to be pushed via regs. */ 20690075Sobrien#define ALWAYS_PUSH_CONSTS_USING_REGS_P 1 20790075Sobrien 20890075Sobrien/* Darwin word-aligns FP doubles but doubleword-aligns 64-bit ints. */ 20990075Sobrien#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ 21090075Sobrien (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \ 21190075Sobrien ? get_inner_array_type (FIELD) \ 21290075Sobrien : TREE_TYPE (FIELD)) == DFmode \ 21390075Sobrien ? MIN ((COMPUTED), 32) : (COMPUTED)) 21490075Sobrien 21590075Sobrien/* Darwin increases natural record alignment to doubleword if the first 21690075Sobrien field is an FP double while the FP fields remain word aligned. */ 21790075Sobrien#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ 21890075Sobrien ((TREE_CODE (STRUCT) == RECORD_TYPE \ 21990075Sobrien || TREE_CODE (STRUCT) == UNION_TYPE \ 22090075Sobrien || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ 22190075Sobrien && TYPE_FIELDS (STRUCT) != 0 \ 22290075Sobrien && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \ 22390075Sobrien ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \ 22496263Sobrien : (TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE) \ 22596263Sobrien ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \ 22690075Sobrien : MAX ((COMPUTED), (SPECIFIED))) 22796263Sobrien 22890075Sobrien/* XXX: Darwin supports neither .quad, or .llong, but it also doesn't 22990075Sobrien support 64 bit powerpc either, so this just keeps things happy. */ 23090075Sobrien#define DOUBLE_INT_ASM_OP "\t.quad\t" 23190075Sobrien 23290075Sobrien/* Get HOST_WIDE_INT and CONST_INT to be 32 bits, for compile time 23390075Sobrien space/speed. */ 23490075Sobrien#undef MAX_LONG_TYPE_SIZE 23590075Sobrien#define MAX_LONG_TYPE_SIZE 32 23696263Sobrien 23796263Sobrien/* For binary compatibility with 2.95; Darwin C APIs use bool from 23896263Sobrien stdbool.h, which was an int-sized enum in 2.95. */ 23996263Sobrien#define BOOL_TYPE_SIZE INT_TYPE_SIZE 240