--- gcc/config/pyr.h 2018/04/24 17:51:31 1.1.1.1 +++ gcc/config/pyr.h 2018/04/24 17:53:50 1.1.1.2 @@ -52,13 +52,8 @@ extern int target_flags; /* Nonzero if compiling code that Unix assembler can assemble. */ #define TARGET_UNIX_ASM (target_flags & 1) -/* Use the indexed addressing modes (were once not known to work). - Leaving this in means we can disable them and so find out what - they win us. */ -#define TARGET_INDEX (target_flags & 2) - /* Implement stdarg in the same fashion used on all other machines. */ -#define TARGET_GNU_STDARG (target_flags & 4) +#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 @@ -66,7 +61,7 @@ extern int target_flags; This contravenes the Pyramid calling convention, so we don't do it yet. */ -#define TARGET_RETD (target_flags & 8) +#define TARGET_RETD (target_flags & 4) /* Macros used in the machine description to test the flags. */ @@ -76,19 +71,15 @@ extern int target_flags; 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. - -mindex was used to enable indexing when I didn't understand - how pyramid's indexing modes worked. */ + -mgnu will be useful if we ever have GAS on a pyramid. */ #define TARGET_SWITCHES \ { {"unix", 1}, \ {"gnu", -1}, \ - {"index", 2}, \ - {"noindex", -2}, \ - {"gnu-stdarg", 4}, \ - {"nognu-stdarg", -4}, \ - {"retd", 8}, \ - {"no-retd", -8}, \ + {"gnu-stdarg", 2}, \ + {"nognu-stdarg", -2}, \ + {"retd", 4}, \ + {"no-retd", -4}, \ { "", TARGET_DEFAULT}} /* Default target_flags if no switches specified. @@ -96,7 +87,7 @@ extern int target_flags; (equivalent to "-munix -mindex -mgnu-stdarg") */ #ifndef TARGET_DEFAULT -#define TARGET_DEFAULT (1 + 2 + 4) +#define TARGET_DEFAULT (1 + 2) #endif /* Never allow $ in identifiers */ @@ -105,16 +96,17 @@ extern int target_flags; /*** Target machine storage layout ***/ -/* Define this if most significant bit is lowest numbered - in instructions that operate on numbered bit-fields. +/* 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 if most significant byte of a word is the lowest numbered. */ +/* Define this to non-zero if most significant byte of a word is + the lowest numbered. */ #define BYTES_BIG_ENDIAN 1 -/* Define this if most significant word of a multiword number is the lowest - numbered. */ +/* 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 */ @@ -145,19 +137,21 @@ extern int target_flags; /* 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 +#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)) @@ -168,9 +162,9 @@ extern int target_flags; && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) -/* Define this if move instructions will actually fail to work +/* Set this nonzero if move instructions will actually fail to work when given unaligned data. */ -#define STRICT_ALIGNMENT +#define STRICT_ALIGNMENT 1 /*** Standard register usage. ***/ @@ -252,8 +246,7 @@ frame n | | | /* 1 for registers that have pervasive standard uses and are not available for the register allocator. - On the pyramid, these are LOGPSW, CFP, SP, PC, and all the other - global regs. */ + 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, \ @@ -310,7 +303,7 @@ frame n | | | /* 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_GREG(13) */ +#define FRAME_POINTER_REGNUM 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 @@ -329,6 +322,12 @@ frame n | | | /* 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). */ @@ -547,7 +546,7 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_ #define CUMULATIVE_ARGS int -/* Define the number of registers that can hold paramters. +/* Define the number of registers that can hold parameters. This macro is used only in other macro definitions below. */ #define NPARM_REGS 12 @@ -694,6 +693,38 @@ extern void* pyr_function_arg (); #endif /* !FRAME_POINTER_REQUIRED */ +/* the trampoline stuff was taken from convex.h - S.P. */ + +/* A C statement to output, on the stream FILE, assembler code for a + block of data that contains the constant parts of a trampoline. This + code should not include a label - the label is taken care of + automatically. + We use TR12/PR12 for the static chain. + movew $,pr12 # I2R + jump $ # S2R + */ +#define TRAMPOLINE_TEMPLATE(FILE) \ +{ ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x2100001C)); \ + ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \ + ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x40000000)); \ + ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); } + +#define TRAMPOLINE_SIZE 16 +#define TRAMPOLINE_ALIGNMENT 32 + +/* Emit RTL insns to initialize the variable parts of a trampoline. + FNADDR is an RTX for the address of the function's pure code. + CXT is an RTX for the static chain value for the function. */ + +#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ +{ emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 4)), CXT); \ + emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 12)), FNADDR); \ + emit_call_insn (gen_call (gen_rtx (MEM, QImode, \ + gen_rtx (SYMBOL_REF, Pmode, \ + "__enable_execute_stack")), \ + const0_rtx)); \ +} + /* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */ #define FUNCTION_PROFILER(FILE, LABELNO) \ @@ -728,10 +759,15 @@ extern int current_function_calls_alloca + current_function_args_size != 0 \ || current_function_calls_alloca) \ -/* If the memory address ADDR is relative to the frame pointer, - correct it to be relative to the stack pointer instead. - This is for when we don't use a frame pointer. - ADDR should be a variable name. */ +/* Store in the variable DEPTH the initial difference between the + frame pointer reg contents and the stack pointer reg contents, + as of the start of the function body. This depends on the layout + of the fixed parts of the stack frame and on how registers are saved. + + On the Pyramid, FRAME_POINTER_REQUIRED is always 1, so the definition + of this macro doesn't matter. But it must be defined. */ + +#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0; /*** Addressing modes, and classification of registers for them. ***/ @@ -752,10 +788,11 @@ extern int current_function_calls_alloca /* All registers except gr0 OK as index or base registers. */ #define REGNO_OK_FOR_BASE_P(regno) \ -((0 < (regno) && (regno) < FIRST_PSEUDO_REGISTER) || reg_renumber[regno] > 0) +((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] < FIRST_PSEUDO_REGISTER) #define REGNO_OK_FOR_INDEX_P(regno) \ -((0 < (regno) && (regno) < FIRST_PSEUDO_REGISTER) || reg_renumber[regno] > 0) +((unsigned) (regno) - 1 < FIRST_PSEUDO_REGISTER - 1 \ + || (unsigned) reg_renumber[regno] - 1 < FIRST_PSEUDO_REGISTER - 1) /* Maximum number of registers that can appear in a valid memory address. */ @@ -787,7 +824,7 @@ extern int current_function_calls_alloca /* Nonzero if X is a hard reg that can be used as an index or if it is a pseudo reg. */ -#define REG_OK_FOR_INDEX_P(X) 1 +#define REG_OK_FOR_INDEX_P(X) (REGNO (X) > 0) /* Nonzero if X is a hard reg that can be used as a base reg or if it is a pseudo reg. */ #define REG_OK_FOR_BASE_P(X) 1 @@ -810,8 +847,7 @@ extern int current_function_calls_alloca except for CONSTANT_ADDRESS_P which is actually machine-independent. */ -/* Go to ADDR if X is indexable -- ie, neither indexed nor offset. - Note that X is indexable iff x is offset. */ +/* Go to ADDR if X is indexable -- i.e., neither indexed nor offset. */ #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \ { register rtx xfoob = (X); \ if ((CONSTANT_ADDRESS_P (xfoob)) \ @@ -876,7 +912,7 @@ extern int current_function_calls_alloca #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ { register rtx xone, xtwo, xfoo0, xfoo1; \ GO_IF_NONINDEXED_ADDRESS (X, ADDR); \ - if (TARGET_INDEX && GET_CODE (X) == PLUS) \ + if (GET_CODE (X) == PLUS) \ { \ /* Handle
[index] represented with index-sum outermost */\ xone = XEXP (X, 0); \ @@ -1003,6 +1039,10 @@ extern int current_function_calls_alloca return 4; \ case CONST_DOUBLE: \ return 6; + +/* A flag which says to swap the operands of certain insns + when they are output. */ +extern int swap_operands; /*** Condition Code Information ***/