the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* Which cpu to compile for.
+#ifndef GCC_H8300_H
+#define GCC_H8300_H
+
+/* Which CPU to compile for.
We use int for CPU_TYPE to avoid lots of casts. */
#if 0 /* defined in insn-attr.h, here for documentation */
enum attr_cpu { CPU_H8300, CPU_H8300H };
This is for debugging the compiler only. */
#define TARGET_RTL_DUMP (target_flags & 2048)
-/* Select between the h8/300 and h8/300h cpus. */
+/* 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)
-/* Align all values on the h8/300h the same way as the h8/300. Specifically,
+/* mac register and relevant instructions are available. */
+#define TARGET_MAC (target_flags & 2)
+
+/* 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 300H.
??? Now watch someone add hardware floating point requiring 32 bit
alignment. */
#define TARGET_ALIGN_300 (target_flags & 8192)
#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, \
/* Do things that must be done once at start up. */
-#define OVERRIDE_OPTIONS \
-do { \
- h8300_init_once (); \
-} while (0)
+#define OVERRIDE_OPTIONS \
+ do \
+ { \
+ h8300_init_once (); \
+ } \
+ while (0)
/* Default target_flags if no switches specified. */
Aside from that, you can include as many other registers as you
like.
- h8 destroys r0,r1,r2,r3. */
+ H8 destroys r0,r1,r2,r3. */
#define CALL_USED_REGISTERS \
{ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1 }
#define REG_ALLOC_ORDER \
{ 2, 3, 0, 1, 4, 5, 6, 8, 7, 9}
-#define CONDITIONAL_REGISTER_USAGE \
-{ \
- if (!TARGET_H8300S) \
- fixed_regs[8] = call_used_regs[8] = 1;\
+#define CONDITIONAL_REGISTER_USAGE \
+{ \
+ if (!TARGET_MAC) \
+ fixed_regs[8] = call_used_regs[8] = 1; \
}
/* Return number of consecutive hard regs needed starting at reg REGNO
#define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
#define CONST_OK_FOR_J(VALUE) ((unsigned HOST_WIDE_INT) (VALUE) < 256)
#define CONST_OK_FOR_K(VALUE) ((VALUE) == 1 || (VALUE) == 2)
-#define CONST_OK_FOR_L(VALUE) \
- (TARGET_H8300H || TARGET_H8300S \
- ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 4 \
+#define CONST_OK_FOR_L(VALUE) \
+ (TARGET_H8300H || TARGET_H8300S \
+ ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 4 \
: (VALUE) == 1 || (VALUE) == 2)
#define CONST_OK_FOR_M(VALUE) ((VALUE) == 3 || (VALUE) == 4)
-#define CONST_OK_FOR_N(VALUE) \
- (TARGET_H8300H || TARGET_H8300S \
- ? (VALUE) == -1 || (VALUE) == -2 || (VALUE) == -4 \
+#define CONST_OK_FOR_N(VALUE) \
+ (TARGET_H8300H || TARGET_H8300S \
+ ? (VALUE) == -1 || (VALUE) == -2 || (VALUE) == -4 \
: (VALUE) == -1 || (VALUE) == -2)
#define CONST_OK_FOR_O(VALUE) (ok_for_bclr (VALUE))
#define CONST_OK_FOR_P(VALUE) (small_power_of_two (VALUE))
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
- (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
- (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
- (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
- (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
- (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
- (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
- (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \
+#define CONST_OK_FOR_LETTER_P(VALUE, C) \
+ ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
+ (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
+ (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
+ (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
+ (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
+ (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
+ (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
+ (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \
0)
/* Similar, but for floating constants, and defining letters G and H.
`G' is a floating-point zero. */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
+#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
((C) == 'G' ? (VALUE) == CONST0_RTX (DFmode) \
: 0)
of mode MODE and data type TYPE.
(TYPE is null for libcalls where that information may not be available.) */
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM).nbytes += ((MODE) != BLKmode \
+#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
+ ((CUM).nbytes += ((MODE) != BLKmode \
? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \
: (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
else \
{ \
fprintf (FILE, "\tmov.l #0x12345678,er3\n"); \
- fprintf (FILE, "\tjmp @0x123456\n"); \
+ fprintf (FILE, "\tjmp @0x123456\n"); \
} \
} while (0)
/* 1 if X is an rtx for a constant that is a valid address. */
-#define CONSTANT_ADDRESS_P(X) \
+#define CONSTANT_ADDRESS_P(X) \
(GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
|| (GET_CODE (X) == CONST_INT \
/* We handle signed and unsigned offsets here. */ \
(a SYMBOL_REF with an SYMBOL_REF_FLAG set).
On the H8/S '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 \
- && REG_OK_FOR_BASE_P (XEXP (OP, 0))) \
- || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
- && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (OP, 0)))) \
- || ((GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == CONST \
- && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == SYMBOL_REF \
- && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT) \
- && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (XEXP (OP, 0), 0)))) \
+#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 \
+ && REG_OK_FOR_BASE_P (XEXP (OP, 0))) \
+ || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
+ && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (OP, 0)))) \
+ || ((GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == CONST \
+ && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \
+ && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == SYMBOL_REF \
+ && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT) \
+ && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (XEXP (OP, 0), 0)))) \
|| (GET_CODE (OP) == MEM \
- && EIGHTBIT_CONSTANT_ADDRESS_P (XEXP (OP, 0))))
-
-
+ && EIGHTBIT_CONSTANT_ADDRESS_P (XEXP (OP, 0))) \
+ || (GET_CODE (OP) == MEM && TARGET_H8300S \
+ && GET_CODE (XEXP (OP, 0)) == CONST_INT))
#define EXTRA_CONSTRAINT(OP, C) \
((C) == 'T' ? OK_FOR_T (OP) : \
switch on CODE. */
/* ??? Shifts need to have a *much* higher cost than this. */
-#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
- case MOD: \
- case DIV: \
- return 60; \
- case MULT: \
- return 20; \
- case ASHIFT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- case ROTATE: \
- case ROTATERT: \
- if (GET_MODE (RTX) == HImode) return 2; \
+#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
+ case MOD: \
+ case DIV: \
+ return 60; \
+ case MULT: \
+ return 20; \
+ case ASHIFT: \
+ case ASHIFTRT: \
+ case LSHIFTRT: \
+ case ROTATE: \
+ case ROTATERT: \
+ if (GET_MODE (RTX) == HImode) return 2; \
return 8;
/* Tell final.c how to eliminate redundant test instructions. */
#define IDENT_ASM_OP "\t.ident\n"
/* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H. */
-#define ASM_WORD_OP (TARGET_H8300 ? ".word" : ".long")
+#define ASM_WORD_OP (TARGET_H8300 ? "\t.word\t" : "\t.long\t")
/* We define a readonly data section solely to remove readonly data
from the instruction stream. This can improve relaxing in two significant
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
do { ctors_section(); \
- fprintf(FILE, "\t%s\t_%s\n", ASM_WORD_OP, NAME); } while (0)
+ fprintf(FILE, "%s_%s\n", ASM_WORD_OP, NAME); } while (0)
#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
do { dtors_section(); \
- fprintf(FILE, "\t%s\t_%s\n", ASM_WORD_OP, NAME); } while (0)
+ fprintf(FILE, "%s_%s\n", ASM_WORD_OP, NAME); } while (0)
#undef DO_GLOBAL_CTORS_BODY
#define DO_GLOBAL_CTORS_BODY \
/* This is how to output an element of a case-vector that is absolute. */
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- asm_fprintf (FILE, "\t%s .L%d\n", ASM_WORD_OP, VALUE)
+ asm_fprintf (FILE, "%s.L%d\n", ASM_WORD_OP, VALUE)
/* This is how to output an element of a case-vector that is relative. */
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
- fprintf (FILE, "\t%s .L%d-.L%d\n", ASM_WORD_OP, VALUE, REL)
+ fprintf (FILE, "%s.L%d-.L%d\n", ASM_WORD_OP, VALUE, REL)
/* This is how to output an assembler line
that says to advance the location counter
to a multiple of 2**LOG bytes. */
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
+#define ASM_OUTPUT_ALIGN(FILE,LOG) \
+ if ((LOG) != 0) \
fprintf (FILE, "\t.align %d\n", (LOG))
/* This is how to output an assembler line
that says to advance the location counter by SIZE bytes. */
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf(FILE, "%s\t \"%s\"\n", IDENT_ASM_OP, NAME)
+#define ASM_OUTPUT_IDENT(FILE, NAME) \
+ fprintf(FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME)
#define ASM_OUTPUT_SKIP(FILE, SIZE) \
fprintf (FILE, "\t.space %d\n", (SIZE))
/* This says how to output an assembler line
to define a global common symbol. */
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
+#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
+( fputs ("\t.comm ", (FILE)), \
+ assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%d\n", (SIZE)))
/* This says how to output the assembler to define a global
uninitialized but not common symbol.
Try to use asm_output_bss to implement this macro. */
-#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
+#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
/* This says how to output an assembler line
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-/* Define this macro if you want to implement any pragmas. If defined, it
- should be a C expression to be executed when #pragma is seen. The
- argument GETC is a function which will return the next character in the
- input stream, or EOF if no characters are left. The argument UNGETC is
- a function which will push a character back into the input stream. The
- argument NAME is the word following #pragma in the input stream. The input
- stream pointer will be pointing just beyond the end of this word. The
- expression should return true if it handled the pragma, false otherwise.
- The input stream should be left undistrubed if false is returned, otherwise
- it should be pointing at the last character after the end of the pragma
- (newline or end-of-file). */
-#define HANDLE_PRAGMA(GETC, UNGETC, NAME) handle_pragma (GETC, UNGETC, NAME)
+/* H8300 specific pragmas. */
+#define REGISTER_TARGET_PRAGMAS(PFILE) do { \
+ cpp_register_pragma (PFILE, 0, "saveall", h8300_pr_saveall); \
+ cpp_register_pragma (PFILE, 0, "interrupt", h8300_pr_interrupt); \
+} while (0)
#define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
/* Perform target dependent optabs initialization. */
-#define INIT_TARGET_OPTABS \
- do { \
- smul_optab->handlers[(int) HImode].libfunc \
- = init_one_libfunc (MULHI3_LIBCALL); \
- sdiv_optab->handlers[(int) HImode].libfunc \
- = init_one_libfunc (DIVHI3_LIBCALL); \
- udiv_optab->handlers[(int) HImode].libfunc \
- = init_one_libfunc (UDIVHI3_LIBCALL); \
- smod_optab->handlers[(int) HImode].libfunc \
- = init_one_libfunc (MODHI3_LIBCALL); \
- umod_optab->handlers[(int) HImode].libfunc \
- = init_one_libfunc (UMODHI3_LIBCALL); \
+#define INIT_TARGET_OPTABS \
+ do { \
+ smul_optab->handlers[(int) HImode].libfunc \
+ = init_one_libfunc (MULHI3_LIBCALL); \
+ sdiv_optab->handlers[(int) HImode].libfunc \
+ = init_one_libfunc (DIVHI3_LIBCALL); \
+ udiv_optab->handlers[(int) HImode].libfunc \
+ = init_one_libfunc (UDIVHI3_LIBCALL); \
+ smod_optab->handlers[(int) HImode].libfunc \
+ = init_one_libfunc (MODHI3_LIBCALL); \
+ umod_optab->handlers[(int) HImode].libfunc \
+ = init_one_libfunc (UMODHI3_LIBCALL); \
} while (0)
#define MOVE_RATIO 3
+
+#endif /* GCC_H8300_H */