Commit 7d9f07f4 by Jeff Law

h8300.h (FIRST_PSEUDO_REGISTER): Bump up by one.

        * h8300/h8300.h (FIRST_PSEUDO_REGISTER): Bump up by one.
        (ARG_POINTER_REGNUM): Likewise.
        (FIXED_REGISTERS): Add entry for MAC register.
        (CALL_USED_REGISTERS< REG_ALLOC_ORDER): Likewise.
        (HARD_REGNO_NREGS): Handle MAC register.
        (HARD_REGNO_MODE_OK< REGNO_OK_FOR_BASE_P): LIkewise.
        (REGISTER_NAMES): Likewise.
        (enum reg_class): New MAC_REGS register class.
        (REG_CLASS_CONTENTS, REGNO_REG_CLASS): Corresponding changes.
        (REG_CLASS_FROM_LETTER): LIkewise.
        (REGISTER_MOVE_COST): Make copies to/from the MAC register
        expenseive.
        (CONDITIONAL_REGISTER_USAGE): Define.
        * h8300/h8300.md (movsi_h8300hs): Renamed from movsi_h8300h.
        Handle moves to/from the MAC register.
        (mac): Two new patterns to use the mac instruction.

        * h8300/h8300.c (notice_update_cc): Fix CC_SET case.
        (restore_compare_p): Remove unused function.
        * h8300/h8300.md: Handle "set" vs "set_zn_c0" correctly.
        (bCC patterns): No longer need to call restore_compare_p.


        * h8300/h8300.c (get_shift_alg): Fix HImode ASHIFTRT by
        13 or 14 bits.

From-SVN: r12848
parent 725de644
...@@ -1574,11 +1574,10 @@ notice_update_cc (body, insn) ...@@ -1574,11 +1574,10 @@ notice_update_cc (body, insn)
break; break;
case CC_SET: case CC_SET:
/* Insn sets the Z,N flags of CC to recog_operand[0]. /* Insn sets the Z,N,V flags of CC to recog_operand[0].
V is always set to 0. C may or may not be set to 0 but that's ok C may or may not be set to 0 but that's ok
because alter_cond will change tests to use EQ/NE. */ because alter_cond will change tests to use EQ/NE. */
CC_STATUS_INIT; CC_STATUS_INIT;
cc_status.flags |= CC_OVERFLOW_0 | CC_NO_CARRY;
cc_status.value1 = recog_operand[0]; cc_status.value1 = recog_operand[0];
break; break;
...@@ -1604,44 +1603,6 @@ notice_update_cc (body, insn) ...@@ -1604,44 +1603,6 @@ notice_update_cc (body, insn)
} }
} }
/* Return 1 if a previous compare needs to be re-issued. This will happen
if the compare was deleted because the previous insn set it, but the
branch needs CC flags not set.
OP is the comparison being performed. */
int
restore_compare_p (op)
rtx op;
{
switch (GET_CODE (op))
{
case EQ:
case NE:
break;
case LT:
case LE:
case GT:
case GE:
if (cc_status.flags & CC_OVERFLOW_UNUSABLE)
return 1;
break;
case LTU:
case LEU:
case GTU:
case GEU:
/* If the carry flag isn't usable, the test should have been changed
by alter_cond. */
if (cc_status.flags & CC_NO_CARRY)
abort ();
break;
default:
abort ();
}
return 0;
}
/* Recognize valid operators for bit instructions */ /* Recognize valid operators for bit instructions */
int int
...@@ -2329,7 +2290,7 @@ get_shift_alg (cpu, shift_type, mode, count, assembler_p, ...@@ -2329,7 +2290,7 @@ get_shift_alg (cpu, shift_type, mode, count, assembler_p,
*cc_valid_p = 0; *cc_valid_p = 0;
return SHIFT_SPECIAL; return SHIFT_SPECIAL;
} }
else else if (shift_type != SHIFT_ASHIFTRT)
{ {
*assembler_p = rotate_one[cpu][shift_type][shift_mode]; *assembler_p = rotate_one[cpu][shift_type][shift_mode];
if (TARGET_H8300S) if (TARGET_H8300S)
......
...@@ -229,18 +229,18 @@ do { \ ...@@ -229,18 +229,18 @@ do { \
All registers that the compiler knows about must be given numbers, All registers that the compiler knows about must be given numbers,
even those that are not normally considered general registers. even those that are not normally considered general registers.
Reg 8 does not correspond to any hardware register, but instead Reg 9 does not correspond to any hardware register, but instead
appears in the RTL as an argument pointer prior to reload, and is appears in the RTL as an argument pointer prior to reload, and is
eliminated during reloading in favor of either the stack or frame eliminated during reloading in favor of either the stack or frame
pointer. */ pointer. */
#define FIRST_PSEUDO_REGISTER 9 #define FIRST_PSEUDO_REGISTER 10
/* 1 for registers that have pervasive standard uses /* 1 for registers that have pervasive standard uses
and are not available for the register allocator. */ and are not available for the register allocator. */
#define FIXED_REGISTERS \ #define FIXED_REGISTERS \
{ 0, 0, 0, 0, 0, 0, 0, 1, 1} { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1}
/* 1 for registers not available across function calls. /* 1 for registers not available across function calls.
These must include the FIXED_REGISTERS and also any These must include the FIXED_REGISTERS and also any
...@@ -253,19 +253,28 @@ do { \ ...@@ -253,19 +253,28 @@ do { \
h8 destroys r0,r1,r2,r3. */ h8 destroys r0,r1,r2,r3. */
#define CALL_USED_REGISTERS \ #define CALL_USED_REGISTERS \
{ 1, 1, 1, 1, 0, 0, 0, 1, 1 } { 1, 1, 1, 1, 0, 0, 0, 1, 1, 1 }
#define REG_ALLOC_ORDER \ #define REG_ALLOC_ORDER \
{ 2, 3, 0, 1, 4, 5, 6, 7, 8} { 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;\
}
/* Return number of consecutive hard regs needed starting at reg REGNO /* Return number of consecutive hard regs needed starting at reg REGNO
to hold something of mode MODE. to hold something of mode MODE.
This is ordinarily the length in words of a value 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. */ but can be less for certain modes in special long registers.
We pretend the MAC register is 32bits -- we don't have any data
types on the H8 series to handle more than 32bits. */
#define HARD_REGNO_NREGS(REGNO, MODE) \ #define HARD_REGNO_NREGS(REGNO, MODE) \
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) ((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 /* Value is 1 if hard register REGNO can hold a value of machine-mode
MODE. MODE.
...@@ -276,7 +285,7 @@ do { \ ...@@ -276,7 +285,7 @@ do { \
#define HARD_REGNO_MODE_OK(REGNO, MODE) \ #define HARD_REGNO_MODE_OK(REGNO, MODE) \
(TARGET_H8300 ? (((REGNO)&1)==0) || (MODE==HImode) || (MODE==QImode) \ (TARGET_H8300 ? (((REGNO)&1)==0) || (MODE==HImode) || (MODE==QImode) \
: 1) : REGNO == 8 ? MODE == SImode : 1)
/* Value is 1 if it is a good idea to tie two pseudo registers /* Value is 1 if it is a good idea to tie two pseudo registers
when one has mode MODE1 and one has mode MODE2. when one has mode MODE1 and one has mode MODE2.
...@@ -304,7 +313,7 @@ do { \ ...@@ -304,7 +313,7 @@ do { \
#define FRAME_POINTER_REQUIRED 0 #define FRAME_POINTER_REQUIRED 0
/* Base register for access to arguments of the function. */ /* Base register for access to arguments of the function. */
#define ARG_POINTER_REGNUM 8 #define ARG_POINTER_REGNUM 9
/* Register in which static-chain is passed to a function. */ /* Register in which static-chain is passed to a function. */
#define STATIC_CHAIN_REGNUM 3 #define STATIC_CHAIN_REGNUM 3
...@@ -330,7 +339,7 @@ do { \ ...@@ -330,7 +339,7 @@ do { \
class that represents their union. */ class that represents their union. */
enum reg_class { enum reg_class {
NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES 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
...@@ -338,7 +347,7 @@ enum reg_class { ...@@ -338,7 +347,7 @@ enum reg_class {
/* Give names of register classes as strings for dump file. */ /* Give names of register classes as strings for dump file. */
#define REG_CLASS_NAMES \ #define REG_CLASS_NAMES \
{ "NO_REGS", "GENERAL_REGS", "ALL_REGS", "LIM_REGS" } { "NO_REGS", "GENERAL_REGS", "MAC_REGS", "ALL_REGS", "LIM_REGS" }
/* Define which registers fit in which classes. /* Define which registers fit in which classes.
This is an initializer for a vector of HARD_REG_SET This is an initializer for a vector of HARD_REG_SET
...@@ -347,26 +356,27 @@ enum reg_class { ...@@ -347,26 +356,27 @@ enum reg_class {
#define REG_CLASS_CONTENTS \ #define REG_CLASS_CONTENTS \
{ 0, /* No regs */ \ { 0, /* No regs */ \
0x0ff, /* GENERAL_REGS */ \ 0x0ff, /* GENERAL_REGS */ \
0x1ff, /* ALL_REGS */ \ 0x100, /* MAC_REGS */ \
0x3ff, /* ALL_REGS */ \
} }
/* The same information, inverted: /* The same information, inverted:
Return the class number of the smallest class containing Return the class number of the smallest class containing
reg number REGNO. This could be a conditional expression reg number REGNO. This could be a conditional expression
or could index an array. or could index an array. */
??? What about the ARG_POINTER_REGISTER? */
#define REGNO_REG_CLASS(REGNO) GENERAL_REGS #define REGNO_REG_CLASS(REGNO) (REGNO != 8 ? GENERAL_REGS : MAC_REGS)
/* The class value for index registers, and the one for base regs. */ /* The class value for index registers, and the one for base regs. */
#define INDEX_REG_CLASS NO_REGS #define INDEX_REG_CLASS NO_REGS
#define BASE_REG_CLASS GENERAL_REGS #define BASE_REG_CLASS GENERAL_REGS
/* Get reg_class from a letter such as appears in the machine description. */ /* Get reg_class from a letter such as appears in the machine description.
'a' is the MAC register. */
#define REG_CLASS_FROM_LETTER(C) (NO_REGS) #define REG_CLASS_FROM_LETTER(C) ((C) == 'a' ? MAC_REGS : NO_REGS)
/* The letters I, J, K, L, M, N, O, P in a register constraint string /* The letters I, J, K, L, M, N, O, P in a register constraint string
can be used to stand for particular ranges of immediate operands. can be used to stand for particular ranges of immediate operands.
...@@ -422,7 +432,8 @@ enum reg_class { ...@@ -422,7 +432,8 @@ enum reg_class {
so define REGISTER_MOVE_COST to be > 2 so that reload never so define REGISTER_MOVE_COST to be > 2 so that reload never
shortcuts. */ shortcuts. */
#define REGISTER_MOVE_COST(CLASS1, CLASS2) 3 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
(CLASS1 == MAC_REGS || CLASS2 == MAC_REGS ? 6 : 3)
/* Stack layout; function entry, exit and calling. */ /* Stack layout; function entry, exit and calling. */
...@@ -731,7 +742,7 @@ struct rtx_def *function_arg(); ...@@ -731,7 +742,7 @@ struct rtx_def *function_arg();
#define REGNO_OK_FOR_INDEX_P(regno) 0 #define REGNO_OK_FOR_INDEX_P(regno) 0
#define REGNO_OK_FOR_BASE_P(regno) \ #define REGNO_OK_FOR_BASE_P(regno) \
((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0) (((regno) < FIRST_PSEUDO_REGISTER && regno != 8) || reg_renumber[regno] >= 0)
/* Maximum number of registers that can appear in a valid memory address. */ /* Maximum number of registers that can appear in a valid memory address. */
...@@ -1140,7 +1151,7 @@ readonly_data() \ ...@@ -1140,7 +1151,7 @@ readonly_data() \
This sequence is indexed by compiler's hard-register-number (see above). */ This sequence is indexed by compiler's hard-register-number (see above). */
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ap"} { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "mac", "ap"}
#define ADDITIONAL_REGISTER_NAMES { { "r7", 7 } } #define ADDITIONAL_REGISTER_NAMES { { "r7", 7 } }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment