This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: MeP: Fix ICE building newlib
- From: Nick Clifton <nickc at redhat dot com>
- To: dj at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 21 Feb 2010 18:42:04 +0000
- Subject: RFA: MeP: Fix ICE building newlib
Hi DJ,
The patch below fixes an ICE building newlib for an mep-elf toolchain.
I had been baffled as to the cause, as it appeared that a internal
tree pointer was being corrupted, so in desperation I tried fixing all
of the compile time warning messages building mep.c. Lo and behold -
after adding a #include "gimple.h" in order to get the prototype for
create_tmp_var() the build started working!
So - the patch below fixes all of the compile time warnings for mep.c,
except those about the %E printf format type not being recognised. I
am not sure if those can actually be fixed without upgrading my host
gcc to a newer version.
Tested by building a mep-elf toolchain.
OK to apply ?
Cheers
Nick
gcc/ChangeLog
2010-02-21 Nick Clifton <nickc@redhat.com>
* config/mep/mep.c: Include gimple.h.
(mep_function_uses_sp): Delete unused function.
(mep_gimplify_va_arg_expr): Change types of pre_p and post_p
parameters. Use unsigned integers to count args. Return a
NULL_RTX rather than an error_mark_node. Tidy up formatting.
Index: gcc/config/mep/mep.c
===================================================================
--- gcc/config/mep/mep.c (revision 156922)
+++ gcc/config/mep/mep.c (working copy)
@@ -50,6 +50,7 @@
#include "target-def.h"
#include "langhooks.h"
#include "df.h"
+#include "gimple.h"
/* Structure of this file:
@@ -160,7 +161,6 @@
static bool mep_call_saves_register (int);
static rtx F (rtx);
static void add_constant (int, int, int, int);
-static bool mep_function_uses_sp (void);
static rtx maybe_dead_move (rtx, rtx, bool);
static void mep_reload_pointer (int, const char *);
static void mep_start_function (FILE *, HOST_WIDE_INT);
@@ -227,7 +227,7 @@
static rtx mep_expand_builtin_saveregs (void);
static tree mep_build_builtin_va_list (void);
static void mep_expand_va_start (tree, rtx);
-static tree mep_gimplify_va_arg_expr (tree, tree, tree *, tree *);
+static tree mep_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
static bool mep_can_eliminate (const int, const int);
static void mep_trampoline_init (rtx, tree, rtx);
@@ -2757,27 +2757,6 @@
}
}
-static bool
-mep_function_uses_sp (void)
-{
- rtx insn;
- struct sequence_stack *seq;
- rtx sp = gen_rtx_REG (SImode, SP_REGNO);
-
- insn = get_insns ();
- for (seq = crtl->emit.sequence_stack;
- seq;
- insn = seq->first, seq = seq->next);
-
- while (insn)
- {
- if (mep_mentioned_p (insn, sp, 0))
- return true;
- insn = NEXT_INSN (insn);
- }
- return false;
-}
-
/* Move SRC to DEST. Mark the move as being potentially dead if
MAYBE_DEAD_P. */
@@ -3699,7 +3678,8 @@
static tree
mep_gimplify_va_arg_expr (tree valist, tree type,
- tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
+ gimple_seq *pre_p,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
{
HOST_WIDE_INT size, rsize;
bool by_reference, ivc2_vec;
@@ -6355,9 +6335,9 @@
tree fnname;
const struct cgen_insn *cgen_insn;
const struct insn_data *idata;
- int first_arg = 0;
- int return_type = void_type_node;
- int builtin_n_args;
+ unsigned int first_arg = 0;
+ tree return_type = void_type_node;
+ unsigned int builtin_n_args;
fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
fnname = DECL_NAME (fndecl);
@@ -6367,7 +6347,7 @@
if (!mep_get_intrinsic_insn (DECL_FUNCTION_CODE (fndecl), &cgen_insn))
{
mep_intrinsic_unavailable (DECL_FUNCTION_CODE (fndecl));
- return error_mark_node;
+ return NULL_RTX;
}
idata = &insn_data[cgen_insn->icode];
@@ -6388,19 +6368,19 @@
if (n_args < builtin_n_args)
{
error ("too few arguments to %qE", fnname);
- return error_mark_node;
+ return NULL_RTX;
}
if (n_args > builtin_n_args)
{
error ("too many arguments to %qE", fnname);
- return error_mark_node;
+ return NULL_RTX;
}
- for (a = first_arg; a < builtin_n_args+first_arg; a++)
+ for (a = first_arg; a < builtin_n_args + first_arg; a++)
{
tree value;
- args = CALL_EXPR_ARG (exp, a-first_arg);
+ args = CALL_EXPR_ARG (exp, a - first_arg);
value = args;
@@ -6411,7 +6391,7 @@
{
debug_tree(value);
error ("argument %d of %qE must be an address", a+1, fnname);
- return error_mark_node;
+ return NULL_RTX;
}
value = TREE_OPERAND (value, 0);
}
@@ -6450,11 +6430,11 @@
{
error ("argument %d of %qE must be in the range %d...%d",
a + 1, fnname, 0, cgen_insn->regnums[a].count - 1);
- return error_mark_node;
+ return NULL_RTX;
}
}
- for (a=0; a<first_arg; a++)
+ for (a = 0; a < first_arg; a++)
{
if (a == 0 && target && GET_MODE (target) == idata->operand[0].mode)
arg[a] = target;
@@ -6473,7 +6453,7 @@
{
mep_incompatible_arg (&idata->operand[opindex],
arg[a], a + 1 - first_arg, fnname);
- return error_mark_node;
+ return NULL_RTX;
}
}