summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@gcc.gnu.org>2005-12-19 10:51:46 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2005-12-19 10:51:46 +0000
commit819f8bd7670aeb497164349aad000a52a08815d4 (patch)
treedba1d3e9167f12f5cfa4b0fa73f032e96e8b4388
parent2803e9970df940bf450c41e68cb15238382f4db2 (diff)
downloadgcc-819f8bd7670aeb497164349aad000a52a08815d4.tar.gz
mt.md (decrement_and_branch_until_zero): Add another scratch.
* config/mt/mt.md (decrement_and_branch_until_zero): Add another scratch. Correct its reload split. Adjust its peephole. (doloop_end): Add additional scratch. (nop): Use 'nop'. * config/mt/mt.c (MT_INT_ARG_FIRST): Remove. (mt_asm_output_opcode, mt_print_operand): Use 'nop'. (mt_function_arg_slotno): Use FIRST_ARG_REGNUM. (mt_builtin_saveregs): Replace with ... (mt_setup_incoming_varargs): ... here. Save just the varadic args. (mt_va_start): Remove. (mt_reorg_hazard): Ignore USE insns. Don't call set_noop_p. (mt_machine_reorg): Split all insns here. (TARGET_SETUP_INCOMING_VARARGS): Override. * config/mt/mt.h (TARGET_CPU_CPP_BUILTINS): Define __mt__ only. Set to CPU type. (EXPAND_BUILTIN_VA_START): Remove. From-SVN: r108787
-rw-r--r--gcc/ChangeLog27
-rw-r--r--gcc/config/mt/mt.c85
-rw-r--r--gcc/config/mt/mt.h5
-rw-r--r--gcc/config/mt/mt.md16
4 files changed, 73 insertions, 60 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 56acc14bd84..a86156df094 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,23 @@
+2005-12-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * config/mt/mt.md (decrement_and_branch_until_zero): Add another
+ scratch. Correct its reload split. Adjust its peephole.
+ (doloop_end): Add additional scratch.
+ (nop): Use 'nop'.
+ * config/mt/mt.c (MT_INT_ARG_FIRST): Remove.
+ (mt_asm_output_opcode, mt_print_operand): Use 'nop'.
+ (mt_function_arg_slotno): Use FIRST_ARG_REGNUM.
+ (mt_builtin_saveregs): Replace with ...
+ (mt_setup_incoming_varargs): ... here. Save just the varadic
+ args.
+ (mt_va_start): Remove.
+ (mt_reorg_hazard): Ignore USE insns. Don't call set_noop_p.
+ (mt_machine_reorg): Split all insns here.
+ (TARGET_SETUP_INCOMING_VARARGS): Override.
+ * config/mt/mt.h (TARGET_CPU_CPP_BUILTINS): Define __mt__ only.
+ Set to CPU type.
+ (EXPAND_BUILTIN_VA_START): Remove.
+
2005-12-17 Kenneth Zadeck <zadeck@naturalbridge.com>
* flow.c (update_life_info, count_or_remove_death_notes): Fixed
@@ -906,9 +926,6 @@
2005-12-13 Nathan Sidwell <nathan@codesourcery.com>
- * sim/common/sim-signal.c (sim_signal_to_target): Add missing ':'.
- * sim/common/sim-signal.h (sim_signal_to_target): Return an int.
-
* config/mt/t-mt (crti.o, crtn.o): Add multilib options.
(EXTRA_MULTILIB_PARTS): Define.
@@ -1222,8 +1239,8 @@
2005-12-09 Aldy Hernandez <aldyh@redhat.com>
- * config/ms1/t-ms1 (MULTILIB_OPTIONS): Define.
- (MULTILIB_DIRNAMES): Define.
+ * config/ms1/t-ms1 (MULTILIB_OPTIONS): Define.
+ (MULTILIB_DIRNAMES): Define.
2005-12-09 Ulrich Weigand <uweigand@de.ibm.com>
diff --git a/gcc/config/mt/mt.c b/gcc/config/mt/mt.c
index 7efd2f78e4d..6ee7ce90b2e 100644
--- a/gcc/config/mt/mt.c
+++ b/gcc/config/mt/mt.c
@@ -55,9 +55,6 @@
/* Link register mask. */
#define LINK_MASK (1 << (GPR_LINK))
-/* First GPR. */
-#define MT_INT_ARG_FIRST 1
-
/* Given a SIZE in bytes, advance to the next word. */
#define ROUND_ADVANCE(SIZE) (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
@@ -122,7 +119,7 @@ mt_asm_output_opcode (FILE *f ATTRIBUTE_UNUSED, const char *ptr)
while (mt_nops_required)
{
- fprintf (f, "or r0, r0, r0\n\t");
+ fprintf (f, "nop\n\t");
-- mt_nops_required;
}
@@ -421,7 +418,7 @@ mt_print_operand (FILE * file, rtx x, int code)
case '#':
/* Output a nop if there's nothing for the delay slot. */
if (dbr_sequence_length () == 0)
- fputs ("\n\tor r0, r0, r0", file);
+ fputs ("\n\tnop", file);
return;
case 'H':
@@ -538,7 +535,7 @@ mt_function_arg_slotno (const CUMULATIVE_ARGS * cum,
int incoming_p ATTRIBUTE_UNUSED,
int * pregno)
{
- int regbase = MT_INT_ARG_FIRST;
+ int regbase = FIRST_ARG_REGNUM;
int slotno = * cum;
if (mode == VOIDmode || targetm.calls.must_pass_in_stack (mode, type))
@@ -827,35 +824,29 @@ mt_override_options (void)
to determine if stdarg or varargs is used and return the address of the
first unnamed parameter. */
-static rtx
-mt_builtin_saveregs (void)
+static void
+mt_setup_incoming_varargs (CUMULATIVE_ARGS *cum,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ tree type ATTRIBUTE_UNUSED,
+ int *pretend_size, int no_rtl)
{
- int first_reg = 0;
- rtx address;
int regno;
-
- for (regno = first_reg; regno < MT_NUM_ARG_REGS; regno ++)
- emit_move_insn
- (gen_rtx_MEM (word_mode,
- gen_rtx_PLUS (Pmode,
- gen_rtx_REG (SImode, ARG_POINTER_REGNUM),
- GEN_INT (UNITS_PER_WORD * regno))),
- gen_rtx_REG (word_mode,
- MT_INT_ARG_FIRST + regno));
-
- address = gen_rtx_PLUS (Pmode,
- gen_rtx_REG (SImode, ARG_POINTER_REGNUM),
- GEN_INT (UNITS_PER_WORD * first_reg));
- return address;
-}
-
-/* Implement `va_start'. */
-
-void
-mt_va_start (tree valist, rtx nextarg)
-{
- mt_builtin_saveregs ();
- std_expand_builtin_va_start (valist, nextarg);
+ int regs = MT_NUM_ARG_REGS - *cum;
+
+ *pretend_size = regs < 0 ? 0 : GET_MODE_SIZE (SImode) * regs;
+
+ if (no_rtl)
+ return;
+
+ for (regno = *cum; regno < MT_NUM_ARG_REGS; regno++)
+ {
+ rtx reg = gen_rtx_REG (SImode, FIRST_ARG_REGNUM + regno);
+ rtx slot = gen_rtx_PLUS (Pmode,
+ gen_rtx_REG (SImode, ARG_POINTER_REGNUM),
+ GEN_INT (UNITS_PER_WORD * regno));
+
+ emit_move_insn (gen_rtx_MEM (SImode, slot), reg);
+ }
}
/* Returns the number of bytes offset between the frame pointer and the stack
@@ -2312,9 +2303,14 @@ mt_reorg_hazard (void)
gcc_assert (INSN_P (insn) && !INSN_DELETED_P (insn));
for (next = NEXT_INSN (insn);
- next && !INSN_P (next);
+ next;
next = NEXT_INSN (next))
- continue;
+ {
+ if (!INSN_P (next))
+ continue;
+ if (GET_CODE (PATTERN (next)) != USE)
+ break;
+ }
jmp = insn;
if (GET_CODE (PATTERN (insn)) == SEQUENCE)
@@ -2390,7 +2386,7 @@ mt_reorg_hazard (void)
}
continue;
}
- if (!INSN_P (prev))
+ if (!INSN_P (prev) || GET_CODE (PATTERN (prev)) == USE)
continue;
if (GET_CODE (PATTERN (prev)) == SEQUENCE)
@@ -2421,14 +2417,7 @@ mt_reorg_hazard (void)
}
if (INSN_CODE (prev) >= 0)
- {
- rtx set = single_set (prev);
-
- /* A noop set will get deleted in a later split pass,
- so we can't count on it for hazard avoidance. */
- if (!set || !set_noop_p (set))
- count--;
- }
+ count--;
}
if (rescan)
@@ -2470,7 +2459,11 @@ mt_machine_reorg (void)
dbr_schedule (get_insns (), dump_file);
if (TARGET_MS2)
- mt_reorg_hazard ();
+ {
+ /* Force all instructions to be split into their final form. */
+ split_all_insns_noflow ();
+ mt_reorg_hazard ();
+ }
}
/* Initialize the GCC target structure. */
@@ -2488,6 +2481,8 @@ const struct attribute_spec mt_attribute_table[];
#define TARGET_MUST_PASS_IN_STACK mt_pass_in_stack
#undef TARGET_ARG_PARTIAL_BYTES
#define TARGET_ARG_PARTIAL_BYTES mt_arg_partial_bytes
+#undef TARGET_SETUP_INCOMING_VARARGS
+#define TARGET_SETUP_INCOMING_VARARGS mt_setup_incoming_varargs
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG mt_machine_reorg
diff --git a/gcc/config/mt/mt.h b/gcc/config/mt/mt.h
index 017f1ac2d9d..3b5bb6a04ea 100644
--- a/gcc/config/mt/mt.h
+++ b/gcc/config/mt/mt.h
@@ -79,7 +79,7 @@ march=ms2:exit-ms2.o%s; \
#define TARGET_CPU_CPP_BUILTINS() \
do \
{ \
- builtin_define_std ("mt"); \
+ builtin_define_with_int_value ("__mt__", mt_cpu); \
builtin_assert ("machine=mt"); \
} \
while (0)
@@ -600,9 +600,6 @@ extern struct mt_frame_info current_frame_info;
#define FUNCTION_PROFILER(FILE, LABELNO) gcc_unreachable ()
-#define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \
- mt_va_start (VALIST, NEXTARG)
-
/* Trampolines are not implemented. */
#define TRAMPOLINE_SIZE 0
diff --git a/gcc/config/mt/mt.md b/gcc/config/mt/mt.md
index caf6fffb8f9..fd244386ccd 100644
--- a/gcc/config/mt/mt.md
+++ b/gcc/config/mt/mt.md
@@ -89,7 +89,8 @@
(set (match_dup 0)
(plus:SI (match_dup 0)
(const_int -1)))
- (clobber (match_scratch:SI 2 "=X,&r"))]
+ (clobber (match_scratch:SI 2 "=X,&r"))
+ (clobber (match_scratch:SI 3 "=X,&r"))]
"TARGET_MS1_16_003 || TARGET_MS2"
"@
dbnz\t%0, %l1%#
@@ -110,11 +111,12 @@
(set (match_dup 0)
(plus:SI (match_dup 0)
(const_int -1)))
- (clobber (match_scratch:SI 2 ""))]
+ (clobber (match_scratch:SI 2 ""))
+ (clobber (match_scratch:SI 3 ""))]
"TARGET_MS1_16_003 || TARGET_MS2"
[(set (match_dup 2) (match_dup 0))
- (set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
- (set (match_dup 0) (match_dup 2))
+ (set (match_dup 3) (plus:SI (match_dup 2) (const_int -1)))
+ (set (match_dup 0) (match_dup 3))
(set (pc)
(if_then_else
(ne (match_dup 2)
@@ -145,6 +147,7 @@
(pc)))
(set (match_dup 0)
(plus:SI (match_dup 0) (const_int -1)))
+ (clobber (reg:SI 0))
(clobber (reg:SI 0))])]
"")
@@ -197,7 +200,8 @@
(set (match_dup 0)
(plus:SI (match_dup 0)
(const_int -1)))
- (clobber (match_scratch:SI 5 ""))])]
+ (clobber (match_scratch:SI 5 ""))
+ (clobber (match_scratch:SI 6 ""))])]
"TARGET_MS1_16_003 || TARGET_MS2"
{mt_add_loop ();})
@@ -1436,7 +1440,7 @@
(define_insn "nop"
[(const_int 0)]
""
- "or r0,r0,r0"
+ "nop"
[(set_attr "length" "4")
(set_attr "type" "arith")])