diff options
Diffstat (limited to 'gcc/config/h8300/h8300.h')
-rw-r--r-- | gcc/config/h8300/h8300.h | 153 |
1 files changed, 78 insertions, 75 deletions
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 1ef8f78bea4..db6a9ffa98a 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -66,6 +66,16 @@ extern const char * const *h8_reg_names; #define LIB_SPEC "%{mrelax:-relax} %{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" +#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \ + do \ + { \ + /* Basic block reordering is only beneficial on targets with cache \ + and/or variable-cycle branches where (cycle count taken != \ + cycle count not taken). */ \ + flag_reorder_blocks = 0; \ + } \ + while (0) + /* Print subsidiary information on the compiler version in use. */ #define TARGET_VERSION fprintf (stderr, " (Hitachi H8/300)"); @@ -74,39 +84,51 @@ extern const char * const *h8_reg_names; extern int target_flags; +/* Masks for the -m switches. */ +#define MASK_H8300S 0x00000001 +#define MASK_MAC 0x00000002 +#define MASK_INT32 0x00000008 +#define MASK_ADDRESSES 0x00000040 +#define MASK_QUICKCALL 0x00000080 +#define MASK_SLOWBYTE 0x00000100 +#define MASK_RELAX 0x00000400 +#define MASK_RTL_DUMP 0x00000800 +#define MASK_H8300H 0x00001000 +#define MASK_ALIGN_300 0x00002000 + /* Macros used in the machine description to test the flags. */ /* Make int's 32 bits. */ -#define TARGET_INT32 (target_flags & 8) +#define TARGET_INT32 (target_flags & MASK_INT32) /* Dump recorded insn lengths into the output file. This helps debug the md file. */ -#define TARGET_ADDRESSES (target_flags & 64) +#define TARGET_ADDRESSES (target_flags & MASK_ADDRESSES) /* Pass the first few arguments in registers. */ -#define TARGET_QUICKCALL (target_flags & 128) +#define TARGET_QUICKCALL (target_flags & MASK_QUICKCALL) /* Pretend byte accesses are slow. */ -#define TARGET_SLOWBYTE (target_flags & 256) +#define TARGET_SLOWBYTE (target_flags & MASK_SLOWBYTE) /* Dump each assembler insn's rtl into the output file. This is for debugging the compiler only. */ -#define TARGET_RTL_DUMP (target_flags & 2048) +#define TARGET_RTL_DUMP (target_flags & MASK_RTL_DUMP) /* Select between the H8/300 and H8/300H CPUs. */ #define TARGET_H8300 (! TARGET_H8300H && ! TARGET_H8300S) -#define TARGET_H8300H (target_flags & 4096) -#define TARGET_H8300S (target_flags & 1) +#define TARGET_H8300H (target_flags & MASK_H8300H) +#define TARGET_H8300S (target_flags & MASK_H8300S) /* mac register and relevant instructions are available. */ -#define TARGET_MAC (target_flags & 2) +#define TARGET_MAC (target_flags & MASK_MAC) /* Align all values on the H8/300H the same way as the H8/300. Specifically, 32 bit and larger values are aligned on 16 bit boundaries. - This is all the hardware requires, but the default is 32 bits for the 300H. + This is all the hardware requires, but the default is 32 bits for the H8/300H. ??? Now watch someone add hardware floating point requiring 32 bit alignment. */ -#define TARGET_ALIGN_300 (target_flags & 8192) +#define TARGET_ALIGN_300 (target_flags & MASK_ALIGN_300) /* Macro to define tables used to set the flags. This is a list in braces of pairs in braces, @@ -114,25 +136,25 @@ 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. */ -#define TARGET_SWITCHES \ - { {"s", 1, N_("Generate H8/S code")}, \ - {"no-s", -1, N_("Do not generate H8/S code")}, \ - {"s2600", 2, N_("Generate H8/S2600 code")}, \ - {"no-s2600", -2, N_("Do not generate H8/S2600 code")}, \ - {"int32", 8, N_("Make integers 32 bits wide")}, \ - {"addresses", 64, NULL}, \ - {"quickcall", 128, \ - N_("Use registers for argument passing")}, \ - {"no-quickcall", -128, \ - N_("Do not use registers for argument passing")}, \ - {"slowbyte", 256, \ - N_("Consider access to byte sized memory slow")}, \ - {"relax", 1024, N_("Enable linker relaxing")}, \ - {"rtl-dump", 2048, NULL}, \ - {"h", 4096, N_("Generate H8/300H code")}, \ - {"no-h", -4096, N_("Do not generate H8/300H code")}, \ - {"align-300", 8192, N_("Use H8/300 alignment rules")}, \ - { "", TARGET_DEFAULT, NULL}} +#define TARGET_SWITCHES \ +{ {"s", MASK_H8300S, N_("Generate H8S code")}, \ + {"no-s", -MASK_H8300S, N_("Do not generate H8S code")}, \ + {"s2600", MASK_MAC, N_("Generate H8S/2600 code")}, \ + {"no-s2600", -MASK_MAC, N_("Do not generate H8S/2600 code")}, \ + {"int32", MASK_INT32, N_("Make integers 32 bits wide")}, \ + {"addresses", MASK_ADDRESSES, NULL}, \ + {"quickcall", MASK_QUICKCALL, \ + N_("Use registers for argument passing")}, \ + {"no-quickcall", -MASK_QUICKCALL, \ + N_("Do not use registers for argument passing")}, \ + {"slowbyte", MASK_SLOWBYTE, \ + N_("Consider access to byte sized memory slow")}, \ + {"relax", MASK_RELAX, N_("Enable linker relaxing")}, \ + {"rtl-dump", MASK_RTL_DUMP, NULL}, \ + {"h", MASK_H8300H, N_("Generate H8/300H code")}, \ + {"no-h", -MASK_H8300H, N_("Do not generate H8/300H code")}, \ + {"align-300", MASK_ALIGN_300, N_("Use H8/300 alignment rules")}, \ + { "", TARGET_DEFAULT, NULL}} #ifdef IN_LIBGCC2 #undef TARGET_H8300H @@ -163,7 +185,7 @@ extern int target_flags; /* Default target_flags if no switches specified. */ #ifndef TARGET_DEFAULT -#define TARGET_DEFAULT (128) /* quickcall */ +#define TARGET_DEFAULT (MASK_QUICKCALL) #endif /* Show we can debug even without a frame pointer. */ @@ -224,11 +246,11 @@ extern int target_flags; structure layouts. */ #define EMPTY_FIELD_BOUNDARY 16 -/* A bitfield declared as `int' forces `int' alignment for the struct. */ +/* A bit-field declared as `int' forces `int' alignment for the struct. */ #define PCC_BITFIELD_TYPE_MATTERS 0 /* No data type wants to be aligned rounder than this. - 32 bit values are aligned as such on the H8/300H and H8/S for speed. */ + 32 bit values are aligned as such on the H8/300H and H8S for speed. */ #define BIGGEST_ALIGNMENT \ (((TARGET_H8300H || TARGET_H8300S) && ! TARGET_ALIGN_300) ? 32 : 16) @@ -379,7 +401,7 @@ enum reg_class { NO_REGS, GENERAL_REGS, MAC_REGS, ALL_REGS, LIM_REG_CLASSES }; -#define N_REG_CLASSES (int) LIM_REG_CLASSES +#define N_REG_CLASSES ((int) LIM_REG_CLASSES) /* Give names of register classes as strings for dump file. */ @@ -392,8 +414,8 @@ enum reg_class { #define REG_CLASS_CONTENTS \ { {0}, /* No regs */ \ - {0x6ff}, /* GENERAL_REGS */ \ - {0x100}, /* MAC_REGS */ \ + {0x6ff}, /* GENERAL_REGS */ \ + {0x100}, /* MAC_REGS */ \ {0x7ff}, /* ALL_REGS */ \ } @@ -553,16 +575,13 @@ enum reg_class { All other eliminations are valid. */ #define CAN_ELIMINATE(FROM, TO) \ - ((((FROM) == ARG_POINTER_REGNUM || (FROM) == RETURN_ADDRESS_POINTER_REGNUM) \ - && (TO) == STACK_POINTER_REGNUM) \ - ? ! frame_pointer_needed \ - : 1) + ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1) /* Define the offset between two registers, one to be eliminated, and the other its replacement, at the start of a routine. */ -#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ - OFFSET = initial_offset (FROM, TO) +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ + ((OFFSET) = h8300_initial_elimination_offset ((FROM), (TO))) /* Define how to find the value returned by a function. VALTYPE is the data type of the value (as a tree). @@ -686,14 +705,14 @@ struct cum_arg H8/300 vvvv context - 1 0000 7900xxxx mov.w #0x1234,r3 - 2 0004 5A00xxxx jmp @0x1234 + 1 0000 7900xxxx mov.w #0x1234,r3 + 2 0004 5A00xxxx jmp @0x1234 ^^^^ function H8/300H vvvvvvvv context - 2 0000 7A00xxxxxxxx mov.l #0x12345678,er3 - 3 0006 5Axxxxxx jmp @0x123456 + 2 0000 7A00xxxxxxxx mov.l #0x12345678,er3 + 3 0006 5Axxxxxx jmp @0x123456 ^^^^^^ function */ @@ -822,26 +841,23 @@ struct cum_arg ? !h8300_shift_needs_scratch_p (INTVAL (OP), SImode) \ : 0) -/* Nonzero if X is a constant address suitable as an 8-bit absolute on - the H8/300H, which is a special case of the 'R' operand. */ +/* Nonzero if X is a constant address suitable as an 8-bit absolute, + which is a special case of the 'R' operand. */ -#define EIGHTBIT_CONSTANT_ADDRESS_P(X) \ - (GET_CODE (X) == CONST_INT && TARGET_H8300H \ - && 0xffff00 <= INTVAL (X) && INTVAL (X) <= 0xffffff) +#define EIGHTBIT_CONSTANT_ADDRESS_P(X) \ + h8300_eightbit_constant_address_p (X) /* Nonzero if X is a constant address suitable as an 16-bit absolute - on the H8/300H. */ + on H8/300H and H8S. */ -#define TINY_CONSTANT_ADDRESS_P(X) \ - (GET_CODE (X) == CONST_INT && TARGET_H8300H \ - && ((0xff8000 <= INTVAL (X) && INTVAL (X) <= 0xffffff) \ - || (0x000000 <= INTVAL (X) && INTVAL (X) <= 0x007fff))) +#define TINY_CONSTANT_ADDRESS_P(X) \ + h8300_tiny_constant_address_p (X) /* 'U' if valid for a bset destination; i.e. a register, register indirect, or the eightbit memory region (a SYMBOL_REF with an SYMBOL_REF_FLAG set). - On the H8/S 'U' can also be a 16bit or 32bit absolute. */ + On the H8S 'U' can also be a 16bit or 32bit absolute. */ #define OK_FOR_U(OP) \ ((GET_CODE (OP) == REG && REG_OK_FOR_BASE_P (OP)) \ || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \ @@ -961,7 +977,7 @@ struct cum_arg #define Pmode (TARGET_H8300H || TARGET_H8300S ? SImode : HImode) /* ANSI C types. - We use longs for the 300H because ints can be 16 or 32. + We use longs for the H8/300H and the H8S because ints can be 16 or 32. GCC requires SIZE_TYPE to be the same size as pointers. */ #define SIZE_TYPE (TARGET_H8300 ? "unsigned int" : "long unsigned int") #define PTRDIFF_TYPE (TARGET_H8300 ? "int" : "long int") @@ -1098,7 +1114,7 @@ struct cum_arg { {"er0", 0}, {"er1", 1}, {"er2", 2}, {"er3", 3}, {"er4", 4}, \ {"er5", 5}, {"er6", 6}, {"er7", 7}, {"r7", 7} } -#define SDB_DEBUGGING_INFO +#define SDB_DEBUGGING_INFO 1 #define SDB_DELIM "\n" /* Support -gstabs. */ @@ -1133,20 +1149,13 @@ struct cum_arg #define USER_LABEL_PREFIX "_" -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - - N.B.: The h8300.md branch_true and branch_false patterns also know - how to generate internal labels. */ - -#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM) - /* This is how to store into the string LABEL the symbol_ref name of an internal numbered label where PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ + This is suitable for output with `assemble_name'. + N.B.: The h8300.md branch_true and branch_false patterns also know + how to generate internal labels. */ #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ sprintf (LABEL, "*.%s%d", PREFIX, NUM) @@ -1212,13 +1221,7 @@ struct cum_arg assemble_name ((FILE), (NAME)), \ fprintf ((FILE), ",%d\n", (SIZE))) -/* Store in OUTPUT a string (made with alloca) containing - an assembler-name for a local static variable named NAME. - LABELNO is an integer which is different for each call. */ - -#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ -( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ - sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO))) +#define ASM_PN_FORMAT "%s___%lu" /* Print an instruction operand X on file FILE. Look in h8300.c for details. */ |