📄 s390.h
字号:
/* Definitions of target machine for GNU compiler, for IBM S/390 Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Hartmut Penner (hpenner@de.ibm.com) and Ulrich Weigand (uweigand@de.ibm.com).This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-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 <s390/fixdfdi.h>#endif/* Run-time target specification. *//* 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 TARGET_HARD_FLOAT (target_flags & 1)#define TARGET_SOFT_FLOAT (!(target_flags & 1))#define TARGET_BACKCHAIN (target_flags & 2)#define TARGET_SMALL_EXEC (target_flags & 4)#define TARGET_DEBUG_ARG (target_flags & 8)#define TARGET_64BIT (target_flags & 16)#define TARGET_MVCLE (target_flags & 32)/* ??? 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 0x13#else#define TARGET_DEFAULT 0x3#endif#define TARGET_SWITCHES \{ { "hard-float", 1, N_("Use hardware fp")}, \ { "soft-float", -1, N_("Don't use hardware fp")}, \ { "backchain", 2, N_("Set backchain")}, \ { "no-backchain", -2, N_("Don't set backchain (faster, but debug harder")}, \ { "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 mode")}, \ { "31", -16, N_("31 bit mode")}, \ { "mvcle", 32, N_("mvcle use")}, \ { "no-mvcle", -32, N_("mvc&ex")}, \ { "", TARGET_DEFAULT, 0 } }/* 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_ARGS#define PROMOTE_FUNCTION_RETURN#define PROMOTE_FOR_CALL_ONLY#define PROMOTE_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 ? TImode : DImode) : 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 MAX_LONG_TYPE_SIZE 64#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-34 are 'fake' hard registers that do not correspond to actual hardware: Reg 32: Argument pointer Reg 33: Condition code Reg 34: Frame pointer */#define FIRST_PSEUDO_REGISTER 35/* 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)#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 BASE_REGISTER 13#define RETURN_REGNUM 14#define CC_REGNUM 33/* 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 (as return address). GPR 15 is always fixed (as stack pointer). The 'fake' hard registers are call-clobbered 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 }#define CALL_USED_REGISTERS \{ 1, 1, 1, 1, \ 1, 1, 0, 0, \ 0, 0, 0, 0, \ 0, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1 }#define CALL_REALLY_USED_REGISTERS \{ 1, 1, 1, 1, \ 1, 1, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1 }#define CONDITIONAL_REGISTER_USAGE \do \ { \ int i; \ \ if (flag_pic) \ { \ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ } \ if (TARGET_64BIT) \ { \ for (i = 24; i < 32; i++) \ call_used_regs[i] = call_really_used_regs[i] = 0; \ } \ else \ { \ for (i = 18; i < 20; i++) \ call_used_regs[i] = call_really_used_regs[i] = 0; \ } \ } while (0)/* Preferred register allocation order. */#define REG_ALLOC_ORDER \{ 1, 2, 3, 4, 5, 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, \ 16, 17, 18, 19, 20, 21, 22, 23, \ 24, 25, 26, 27, 28, 29, 30, 31, \ 15, 32, 33, 34 }/* Fitting values into registers. */ /* Integer modes <= word size fit into any GPR. Integer modes > word size fit into successive GPRs, starting with an even-numbered register. SImode and DImode fit into FPRs as well. Floating point modes <= word size fit into any FPR or GPR. Floating point modes > word size (i.e. DFmode on 32-bit) fit into any FPR, or an even-odd GPR pair. Complex floating point modes fit either into two FPRs, or into successive GPRs (again starting with an even number). Condition code modes fit only into the CC register. */#define HARD_REGNO_NREGS(REGNO, MODE) \ (FP_REGNO_P(REGNO)? \ (GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT ? 2 : 1) : \ GENERAL_REGNO_P(REGNO)? \ ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1) / UNITS_PER_WORD) : \ 1)#define HARD_REGNO_MODE_OK(REGNO, MODE) \ (FP_REGNO_P(REGNO)? \ ((MODE) == SImode || (MODE) == DImode || \ GET_MODE_CLASS(MODE) == MODE_FLOAT || \ GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT) : \ GENERAL_REGNO_P(REGNO)? \ (HARD_REGNO_NREGS(REGNO, MODE) == 1 || !((REGNO) & 1)) : \ CC_REGNO_P(REGNO)? \ GET_MODE_CLASS (MODE) == MODE_CC : \ FRAME_REGNO_P(REGNO)? \ (enum machine_mode) (MODE) == Pmode : \ 0)#define MODES_TIEABLE_P(MODE1, MODE2) \ (((MODE1) == SFmode || (MODE1) == DFmode) \ == ((MODE2) == SFmode || (MODE2) == DFmode))/* Maximum number of registers to represent a value of mode MODE in a register of class CLASS. */#define CLASS_MAX_NREGS(CLASS, MODE) \ ((CLASS) == FP_REGS ? \ (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT ? 2 : 1) : \ (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* If a 4-byte value is loaded into a FPR, it is placed into the *upper* half of the register, not the lower. Therefore, we cannot use SUBREGs to switch between modes in FP registers. */#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \ ? reg_classes_intersect_p (FP_REGS, CLASS) : 0)/* Register classes. */ /* We use the following register classes: GENERAL_REGS All general purpose registers ADDR_REGS All general purpose registers except %r0 (These registers can be used in address generation) FP_REGS All floating point registers GENERAL_FP_REGS Union of GENERAL_REGS and FP_REGS ADDR_FP_REGS Union of ADDR_REGS and FP_REGS NO_REGS No registers ALL_REGS All registers Note that the 'fake' frame pointer and argument pointer registers are included amongst the address registers here. The condition code register is only included in ALL_REGS. */enum reg_class{ NO_REGS, ADDR_REGS, GENERAL_REGS,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -