📄 s390.h
字号:
/* Definitions of target machine for GNU compiler, for IBM S/390 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Hartmut Penner (hpenner@de.ibm.com) and Ulrich Weigand (uweigand@de.ibm.com).This file is part of GCC.GCC is free software; you can redistribute it and/or modify it underthe terms of the GNU General Public License as published by the FreeSoftware Foundation; either version 2, or (at your option) any laterversion.GCC is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY orFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licensefor more details.You should have received a copy of the GNU General Public Licensealong with GCC; see the file COPYING. If not, write to the FreeSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA02111-1307, USA. */#ifndef _S390_H#define _S390_H/* Override the __fixdfdi etc. routines when building libgcc2. ??? This should be done in a cleaner way ... */#if defined (IN_LIBGCC2) && !defined (__s390x__)#include <config/s390/fixdfdi.h>#endif/* Which processor to generate code or schedule for. The cpu attribute defines a list that mirrors this list, so changes to s390.md must be made at the same time. */enum processor_type{ PROCESSOR_9672_G5, PROCESSOR_9672_G6, PROCESSOR_2064_Z900, PROCESSOR_2084_Z990, PROCESSOR_max};/* Optional architectural facilities supported by the processor. */enum processor_flags{ PF_IEEE_FLOAT = 1, PF_ZARCH = 2, PF_LONG_DISPLACEMENT = 4};extern enum processor_type s390_tune;extern enum processor_flags s390_tune_flags;extern const char *s390_tune_string;extern enum processor_type s390_arch;extern enum processor_flags s390_arch_flags;extern const char *s390_arch_string;extern const char *s390_warn_framesize_string;extern const char *s390_warn_dynamicstack_string;extern const char *s390_stack_size_string;extern const char *s390_stack_guard_string;#define TARGET_CPU_IEEE_FLOAT \ (s390_arch_flags & PF_IEEE_FLOAT)#define TARGET_CPU_ZARCH \ (s390_arch_flags & PF_ZARCH)#define TARGET_CPU_LONG_DISPLACEMENT \ (s390_arch_flags & PF_LONG_DISPLACEMENT)#define TARGET_LONG_DISPLACEMENT \ (TARGET_ZARCH && TARGET_CPU_LONG_DISPLACEMENT)/* Run-time target specification. *//* This will be overridden by OS headers. */#define TARGET_TPF 0/* Target CPU builtins. */#define TARGET_CPU_CPP_BUILTINS() \ do \ { \ builtin_assert ("cpu=s390"); \ builtin_assert ("machine=s390"); \ builtin_define ("__s390__"); \ if (TARGET_64BIT) \ builtin_define ("__s390x__"); \ } \ while (0)/* Optional target features. */extern int target_flags;#define MASK_HARD_FLOAT 0x01#define MASK_SMALL_EXEC 0x04#define MASK_DEBUG_ARG 0x08#define MASK_64BIT 0x10#define MASK_ZARCH 0x20#define MASK_MVCLE 0x40#define MASK_TPF_PROFILING 0x80#define MASK_NO_FUSED_MADD 0x100#define MASK_BACKCHAIN 0x200#define MASK_PACKED_STACK 0x400#define TARGET_HARD_FLOAT (target_flags & MASK_HARD_FLOAT)#define TARGET_SOFT_FLOAT (!(target_flags & MASK_HARD_FLOAT))#define TARGET_SMALL_EXEC (target_flags & MASK_SMALL_EXEC)#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)#define TARGET_64BIT (target_flags & MASK_64BIT)#define TARGET_ZARCH (target_flags & MASK_ZARCH)#define TARGET_MVCLE (target_flags & MASK_MVCLE)#define TARGET_TPF_PROFILING (target_flags & MASK_TPF_PROFILING)#define TARGET_NO_FUSED_MADD (target_flags & MASK_NO_FUSED_MADD)#define TARGET_FUSED_MADD (! TARGET_NO_FUSED_MADD)#define TARGET_BACKCHAIN (target_flags & MASK_BACKCHAIN)#define TARGET_PACKED_STACK (target_flags & MASK_PACKED_STACK)/* ??? Once this actually works, it could be made a runtime option. */#define TARGET_IBM_FLOAT 0#define TARGET_IEEE_FLOAT 1#ifdef DEFAULT_TARGET_64BIT#define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_FLOAT)#else#define TARGET_DEFAULT MASK_HARD_FLOAT#endif#define TARGET_SWITCHES \{ { "hard-float", 1, N_("Use hardware fp")}, \ { "soft-float", -1, N_("Don't use hardware fp")}, \ { "small-exec", 4, N_("Use bras for executable < 64k")}, \ { "no-small-exec", -4, N_("Don't use bras")}, \ { "debug", 8, N_("Additional debug prints")}, \ { "no-debug", -8, N_("Don't print additional debug prints")}, \ { "64", 16, N_("64 bit ABI")}, \ { "31", -16, N_("31 bit ABI")}, \ { "zarch", 32, N_("z/Architecture")}, \ { "esa", -32, N_("ESA/390 architecture")}, \ { "mvcle", 64, N_("mvcle use")}, \ { "no-mvcle", -64, N_("mvc&ex")}, \ { "tpf-trace", 128, N_("Enable tpf OS tracing code")}, \ { "no-tpf-trace", -128, N_("Disable tpf OS tracing code")}, \ { "no-fused-madd", 256, N_("Disable fused multiply/add instructions")},\ { "fused-madd", -256, N_("Enable fused multiply/add instructions")}, \ { "backchain", 512, N_("Maintain backchain pointer")}, \ { "no-backchain", -512, N_("Don't maintain backchain pointer")}, \ { "packed-stack", 1024, N_("Use packed stack layout")}, \ { "no-packed-stack", -1024, N_("Don't use packed stack layout")}, \ { "", TARGET_DEFAULT, 0 } }#define TARGET_OPTIONS \{ { "tune=", &s390_tune_string, \ N_("Schedule code for given CPU"), 0}, \ { "arch=", &s390_arch_string, \ N_("Generate code for given CPU"), 0}, \ { "warn-framesize=", &s390_warn_framesize_string, \ N_("Warn if a single function's framesize exceeds the given framesize"), \ 0}, \ { "warn-dynamicstack", &s390_warn_dynamicstack_string, \ N_("Warn if a function uses alloca or creates an array with dynamic size"),\ 0}, \ { "stack-size=", &s390_stack_size_string, \ N_("Emit extra code in the function prologue in order to trap if the stack"\ "size exceeds the given limit"), 0}, \ { "stack-guard=", &s390_stack_guard_string, \ N_("Set the max. number of bytes which has to be left to stack size " \ "before a trap instruction is triggered"), 0}, \}/* Support for configure-time defaults. */#define OPTION_DEFAULT_SPECS \ { "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" }, \ { "arch", "%{!march=*:-march=%(VALUE)}" }, \ { "tune", "%{!mtune=*:-mtune=%(VALUE)}" }/* Defaulting rules. */#ifdef DEFAULT_TARGET_64BIT#define DRIVER_SELF_SPECS \ "%{!m31:%{!m64:-m64}}", \ "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \ "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}"#else#define DRIVER_SELF_SPECS \ "%{!m31:%{!m64:-m31}}", \ "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \ "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}"#endif/* Target version string. Overridden by the OS header. */#ifdef DEFAULT_TARGET_64BIT#define TARGET_VERSION fprintf (stderr, " (zSeries)");#else#define TARGET_VERSION fprintf (stderr, " (S/390)");#endif/* Hooks to override options. */#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) optimization_options(LEVEL, SIZE)#define OVERRIDE_OPTIONS override_options ()/* Frame pointer is not used for debugging. */#define CAN_DEBUG_WITHOUT_FP/* In libgcc2, determine target settings as compile-time constants. */#ifdef IN_LIBGCC2#undef TARGET_64BIT#ifdef __s390x__#define TARGET_64BIT 1#else#define TARGET_64BIT 0#endif#endif/* Target machine storage layout. *//* Everything is big-endian. */#define BITS_BIG_ENDIAN 1#define BYTES_BIG_ENDIAN 1#define WORDS_BIG_ENDIAN 1/* Width of a word, in units (bytes). */#define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)#ifndef IN_LIBGCC2#define MIN_UNITS_PER_WORD 4#endif#define MAX_BITS_PER_WORD 64/* Function arguments and return values are promoted to word size. */#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \if (INTEGRAL_MODE_P (MODE) && \ GET_MODE_SIZE (MODE) < UNITS_PER_WORD) { \ (MODE) = Pmode; \ }/* Allocation boundary (in *bits*) for storing arguments in argument list. */#define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32)/* Boundary (in *bits*) on which stack pointer should be aligned. */#define STACK_BOUNDARY 64/* Allocation boundary (in *bits*) for the code of a function. */#define FUNCTION_BOUNDARY 32/* There is no point aligning anything to a rounder boundary than this. */#define BIGGEST_ALIGNMENT 64/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY 32/* Alignment on even addresses for LARL instruction. */#define CONSTANT_ALIGNMENT(EXP, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)#define DATA_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)/* Alignment is not required by the hardware. */#define STRICT_ALIGNMENT 0/* Mode of stack savearea. FUNCTION is VOIDmode because calling convention maintains SP. BLOCK needs Pmode for SP. NONLOCAL needs twice Pmode to maintain both backchain and SP. */#define STACK_SAVEAREA_MODE(LEVEL) \ (LEVEL == SAVE_FUNCTION ? VOIDmode \ : LEVEL == SAVE_NONLOCAL ? (TARGET_64BIT ? OImode : TImode) : Pmode)/* Define target floating point format. */#define TARGET_FLOAT_FORMAT \ (TARGET_IEEE_FLOAT? IEEE_FLOAT_FORMAT : IBM_FLOAT_FORMAT)/* Type layout. *//* Sizes in bits of the source language data types. */#define SHORT_TYPE_SIZE 16#define INT_TYPE_SIZE 32#define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)#define LONG_LONG_TYPE_SIZE 64#define FLOAT_TYPE_SIZE 32#define DOUBLE_TYPE_SIZE 64#define LONG_DOUBLE_TYPE_SIZE 64 /* ??? Should support extended format. *//* We use "unsigned char" as default. */#define DEFAULT_SIGNED_CHAR 0/* Register usage. *//* We have 16 general purpose registers (registers 0-15), and 16 floating point registers (registers 16-31). (On non-IEEE machines, we have only 4 fp registers.) Amongst the general purpose registers, some are used for specific purposes: GPR 11: Hard frame pointer (if needed) GPR 12: Global offset table pointer (if needed) GPR 13: Literal pool base register GPR 14: Return address register GPR 15: Stack pointer Registers 32-35 are 'fake' hard registers that do not correspond to actual hardware: Reg 32: Argument pointer Reg 33: Condition code Reg 34: Frame pointer Reg 35: Return address pointer Registers 36 and 37 are mapped to access registers 0 and 1, used to implement thread-local storage. */#define FIRST_PSEUDO_REGISTER 38/* Standard register usage. */#define GENERAL_REGNO_P(N) ((int)(N) >= 0 && (N) < 16)#define ADDR_REGNO_P(N) ((N) >= 1 && (N) < 16)#define FP_REGNO_P(N) ((N) >= 16 && (N) < (TARGET_IEEE_FLOAT? 32 : 20))#define CC_REGNO_P(N) ((N) == 33)#define FRAME_REGNO_P(N) ((N) == 32 || (N) == 34 || (N) == 35)#define ACCESS_REGNO_P(N) ((N) == 36 || (N) == 37)#define GENERAL_REG_P(X) (REG_P (X) && GENERAL_REGNO_P (REGNO (X)))#define ADDR_REG_P(X) (REG_P (X) && ADDR_REGNO_P (REGNO (X)))#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))#define FRAME_REG_P(X) (REG_P (X) && FRAME_REGNO_P (REGNO (X)))#define ACCESS_REG_P(X) (REG_P (X) && ACCESS_REGNO_P (REGNO (X)))#define SIBCALL_REGNUM 1#define BASE_REGNUM 13#define RETURN_REGNUM 14#define CC_REGNUM 33#define TP_REGNUM 36/* Set up fixed registers and calling convention: GPRs 0-5 are always call-clobbered, GPRs 6-15 are always call-saved. GPR 12 is fixed if used as GOT pointer. GPR 13 is always fixed (as literal pool pointer). GPR 14 is always fixed on S/390 machines (as return address). GPR 15 is always fixed (as stack pointer). The 'fake' hard registers are call-clobbered and fixed. The access registers are call-saved and fixed. On 31-bit, FPRs 18-19 are call-clobbered; on 64-bit, FPRs 24-31 are call-clobbered. The remaining FPRs are call-saved. */#define FIXED_REGISTERS \{ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 1, 1, 1, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 1, 1, 1, 1, \ 1, 1 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -