📄 pyr.h
字号:
/* Definitions of target machine parameters for GNU compiler, for Pyramid 90x, 9000, and MIServer Series. Copyright (C) 1989, 1995, 1996, 1997 Free Software Foundation, Inc.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. *//* * If you're going to change this, and you haven't already, * you should get and read * ``OSx Operating System Porting Guide'', * publication number 4100-0066-A * Revision A * Pyramid Technology Corporation. * * or whatever the most recent version is. In any case, page and * section number references given herein refer to this document. * * The instruction table for gdb lists the available insns and * the valid addressing modes. * * Any other information on the Pyramid architecture is proprietary * and hard to get. (Pyramid cc -S and adb are also useful.) * *//*** Run-time compilation parameters selecting different hardware subsets. ***//* Names to predefine in the preprocessor for this target machine. */#define CPP_PREDEFINES "-Dpyr -Dunix -Asystem(unix) -Acpu(pyr) -Amachine(pyr)"/* Print subsidiary information on the compiler version in use. */#define TARGET_VERSION fprintf (stderr, " (pyr)");extern int target_flags;/* Nonzero if compiling code that Unix assembler can assemble. */#define TARGET_UNIX_ASM (target_flags & 1)/* Implement stdarg in the same fashion used on all other machines. */#define TARGET_GNU_STDARG (target_flags & 2)/* Compile using RETD to pop off the args. This will not work unless you use prototypes at least for all functions that can take varying numbers of args. This contravenes the Pyramid calling convention, so we don't do it yet. */#define TARGET_RETD (target_flags & 4)/* Macros used in the machine description to test the flags. *//* Macro to define tables used to set the flags. This is a list in braces of pairs in braces, each pair being { "NAME", VALUE } where VALUE is the bits to set or minus the bits to clear. An empty string NAME is used to identify the default VALUE. -mgnu will be useful if we ever have GAS on a pyramid. */#define TARGET_SWITCHES \ { {"unix", 1}, \ {"gnu", -1}, \ {"gnu-stdarg", 2}, \ {"nognu-stdarg", -2}, \ {"retd", 4}, \ {"no-retd", -4}, \ { "", TARGET_DEFAULT}}/* Default target_flags if no switches specified. (equivalent to "-munix -mindex -mgnu-stdarg") */#ifndef TARGET_DEFAULT#define TARGET_DEFAULT (1 + 2)#endif/* Make GCC agree with types.h. */#ifdef SIZE_TYPE#undef SIZE_TYPE#endif#define SIZE_TYPE "unsigned int"/* Assembler does not permit $ in labels */#define NO_DOLLAR_IN_LABEL/* Maybe it doesn't permit dot either. */#define NO_DOT_IN_LABEL/* Never allow $ in identifiers */#define DOLLARS_IN_IDENTIFIERS 0/*** Target machine storage layout ***//* Define this to non-zero if most significant bit is lowest numbered in instructions that operate on numbered bit-fields. This is not true on the pyramid. */#define BITS_BIG_ENDIAN 0/* Define this to non-zero if most significant byte of a word is the lowest numbered. */#define BYTES_BIG_ENDIAN 1/* Define this to non-zero if most significant word of a multiword number is the lowest numbered. */#define WORDS_BIG_ENDIAN 1/* Number of bits in an addressable storage unit */#define BITS_PER_UNIT 8/* Width in bits of a "word", which is the contents of a machine register. Note that this is not necessarily the width of data type `int'; if using 16-bit ints on a 68000, this would still be 32. But on a machine with 16-bit registers, this would be 16. */#define BITS_PER_WORD 32/* Width of a word, in units (bytes). */#define UNITS_PER_WORD 4/* Width in bits of a pointer. See also the macro `Pmode' defined below. */#define POINTER_SIZE 32/* Allocation boundary (in *bits*) for storing arguments in argument list. */#define PARM_BOUNDARY 32/* Boundary (in *bits*) on which stack pointer should be aligned. */#define STACK_BOUNDARY 32/* Allocation boundary (in *bits*) for the code of a function. */#define FUNCTION_BOUNDARY 32/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY 32/* Every structure's size must be a multiple of this. */#define STRUCTURE_SIZE_BOUNDARY 32/* No data type wants to be aligned rounder than this. */#define BIGGEST_ALIGNMENT 32/* Specified types of bitfields affect alignment of those fields and of the structure as a whole. */#define PCC_BITFIELD_TYPE_MATTERS 1/* Make strings word-aligned so strcpy from constants will be faster. Pyramid documentation says the best alignment is to align on the size of a cache line, which is 32 bytes. Newer pyrs have single insns that do strcmp() and strcpy(), so this may not actually win anything. */#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ (TREE_CODE (EXP) == STRING_CST \ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))/* Make arrays of chars word-aligned for the same reasons. */#define DATA_ALIGNMENT(TYPE, ALIGN) \ (TREE_CODE (TYPE) == ARRAY_TYPE \ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))/* Set this nonzero if move instructions will actually fail to work when given unaligned data. */#define STRICT_ALIGNMENT 1/*** Standard register usage. ***//* Number of actual hardware registers. The hardware registers are assigned numbers for the compiler from 0 to just below FIRST_PSEUDO_REGISTER. All registers that the compiler knows about must be given numbers, even those that are not normally considered general registers. *//* Nota Bene: Pyramids have 64 addressable 32-bit registers, arranged as four groups of sixteen registers each. Pyramid names the groups global, parameter, local, and temporary. The sixteen global registers are fairly conventional; the last four are overloaded with a PSW, frame pointer, stack pointer, and pc. The non-dedicated global registers used to be reserved for Pyramid operating systems, and still have cryptic and undocumented uses for certain library calls. We do not use global registers gr0 through gr11. The parameter, local, and temporary registers provide register windowing. Each procedure call has its own set of these 48 registers, which constitute its call frame. (These frames are not allocated on the conventional stack, but contiguously on a separate stack called the control stack.) Register windowing is a facility whereby the temporary registers of frame n become the parameter registers of frame n+1, viz.: 0 15 0 15 0 15 +------------+------------+------------+frame n+1 | | | | +------------+------------+------------+ Parameter Local Temporary ^ | These 16 regs are the same. v 0 15 0 15 0 15 +------------+------------+------------+frame n | | | | +------------+------------+------------+ Parameter Local Temporary New frames are automatically allocated on the control stack by the call instruction and de-allocated by the return insns "ret" and "retd". The control-stack grows contiguously upward from a well-known address in memory; programs are free to allocate a variable sized, conventional frame on the data stack, which grows downwards in memory from just below the control stack. Temporary registers are used for parameter passing, and are not preserved across calls. TR0 through TR11 correspond to gcc's ``input'' registers; PR0 through TR11 the ``output'' registers. The call insn stores the PC and PSW in PR14 and PR15 of the frame it creates; the return insns restore these into the PC and PSW. The same is true for interrupts; TR14 and TR15 of the current frame are reserved and should never be used, since an interrupt may occur at any time and clobber them. An interesting quirk is the ability to take the address of a variable in a windowed register. This done by adding the memory address of the base of the current window frame, to the offset within the frame of the desired register. The resulting address can be treated just like any other pointer; if a quantity is stored into that address, the appropriate register also changes. GCC does not, and according to RMS will not, support this feature, even though some programs rely on this (mis)feature. */#define PYR_GREG(n) (n)#define PYR_PREG(n) (16+(n))#define PYR_LREG(n) (32+(n))#define PYR_TREG(n) (48+(n))/* Define this macro if the target machine has "register windows". This C expression returns the register number as seen by the called function corresponding to register number OUT as seen by the calling function. Return OUT if register number OUT is not an outbound register. */#define INCOMING_REGNO(OUT) \ (((OUT) < 48 || (OUT) > 63) ? (OUT) : (OUT) - 32)/* Define this macro if the target machine has "register windows". This C expression returns the register number as seen by the calling function corresponding to register number IN as seen by the called function. Return IN if register number IN is not an inbound register. */#define OUTGOING_REGNO(IN) \ (((IN) < 15 || (IN) > 31) ? (IN) : (IN) + 32)#define FIRST_PSEUDO_REGISTER 64/* 1 for registers that have pervasive standard uses and are not available for the register allocator. On the pyramid, these are LOGPSW, SP, and PC. */#define FIXED_REGISTERS \ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}/* 1 for registers not available across function calls. These must include the FIXED_REGISTERS and also any registers that can be used without being saved. The latter must include the registers where values are returned and the register where structure-value addresses are passed. Aside from that, you can include as many other registers as you like. */#define CALL_USED_REGISTERS \ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}/* #define DEFAULT_CALLER_SAVES *//* Return number of consecutive hard regs needed starting at reg REGNO to hold something of mode MODE. This is ordinarily the length in words of a value of mode MODE but can be less for certain modes in special long registers. On the pyramid, all registers are one word long. */#define HARD_REGNO_NREGS(REGNO, MODE) \ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. On the pyramid, all registers can hold all modes. *//* -->FIXME: this is not the case for 64-bit quantities in tr11/12 through --> TR14/15. This should be fixed, but to do it correctly, we also --> need to fix MODES_TIEABLE_P. Yuk. We ignore this, since GCC should --> do the "right" thing due to FIXED_REGISTERS. */#define HARD_REGNO_MODE_OK(REGNO, MODE) 1/* Value is 1 if it is a good idea to tie two pseudo registers when one has mode MODE1 and one has mode MODE2. If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, for any hard reg, then this must be 0 for correct output. */#define MODES_TIEABLE_P(MODE1, MODE2) 1/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. *//* Pyramid pc is overloaded on global register 15. */#define PC_REGNUM PYR_GREG(15)/* Register to use for pushing function arguments. --> on Pyramids, the data stack pointer. */#define STACK_POINTER_REGNUM PYR_GREG(14)/* Base register for access to local variables of the function. Pyramid uses CFP (GR13) as both frame pointer and argument pointer. */#define FRAME_POINTER_REGNUM 13 /* pyr cpp fails on PYR_GREG(13) *//* Value should be nonzero if functions must have frame pointers. Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. This is computed in `reload', in reload1.c. Setting this to 1 can't break anything. Since the Pyramid has register windows, I don't know if defining this to be zero can win anything. It could changed later, if it wins. */#define FRAME_POINTER_REQUIRED 1/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM 13 /* PYR_GREG(13) *//* Register in which static-chain is passed to a function. *//* If needed, Pyramid says to use temporary register 12. */#define STATIC_CHAIN_REGNUM PYR_TREG(12)/* If register windows are used, STATIC_CHAIN_INCOMING_REGNUM is the register number as seen by the called function, while STATIC_CHAIN_REGNUM is the register number as seen by the calling function. */#define STATIC_CHAIN_INCOMING_REGNUM PYR_PREG(12)/* Register in which address to store a structure value is passed to a function. On a Pyramid, this is temporary register 0 (TR0). */#define STRUCT_VALUE_REGNUM PYR_TREG(0)#define STRUCT_VALUE_INCOMING_REGNUM PYR_PREG(0)/* Define the classes of registers for register constraints in the machine description. Also define ranges of constants. One of the classes must always be named ALL_REGS and include all hard regs. If there is more than one class, another class must be named NO_REGS and contain no registers. The name GENERAL_REGS must be the name of a class (or an alias for another name such as ALL_REGS). This is the class of registers that is allowed by "g" or "r" in a register constraint.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -