This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] use expand_modifier in expand_expr langhook
- From: Thomas Neumann <tneumann at users dot sourceforge dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 May 2007 13:20:20 +0200
- Subject: [patch] use expand_modifier in expand_expr langhook
The attached patch changes the expand_expr langhook to use the correct
enum expand_modifier type instead of an int for argument 4.
Bootstrapped and test on i686. Ok?
Thomas
* langhooks.h (enum expand_modifier): Move the declaration from ...
* expr.h (enum expand_modifier): ... here to use it in the expand_expr
langhook.
* langhooks.h (struct lang_hooks): Use expand_modifier as argument type
for expand_expr.
* expr.h: Include langhooks.h to get enum expand_modifier.
* langhooks-def.h: Likewise.
(lhd_expand_expr): Use expand_modifier as argument type.
* c-common.h: Include langhooks.h to get enum expand_modifier.
(c_expand_expr): Use expand_modifier as argument type.
* langhooks.c (lhd_expand_expr): Likewise.
* c-common.c (c_expand_expr): Likewise.
cp/
* cp-tree.h: Include langhooks.h to get enum expand_modifier.
(cxx_expand_expr): Use expand_modifier as argument type.
* expr.c (cxx_expand_expr): Likewise.
Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h (revision 124745)
+++ gcc/cp/cp-tree.h (working copy)
@@ -31,6 +31,8 @@ Boston, MA 02110-1301, USA. */
#include "varray.h"
#include "c-common.h"
#include "name-lookup.h"
+/* For expand_modifier */
+#include "langhooks.h"
struct diagnostic_context;
/* Usage of TREE_LANG_FLAG_?:
@@ -4289,7 +4291,7 @@ extern tree eh_type_info (tree);
/* in expr.c */
extern rtx cxx_expand_expr (tree, rtx,
enum machine_mode,
- int, rtx *);
+ enum expand_modifier, rtx *);
extern tree cplus_expand_constant (tree);
/* friend.c */
Index: gcc/cp/expr.c
===================================================================
--- gcc/cp/expr.c (revision 124745)
+++ gcc/cp/expr.c (working copy)
@@ -91,8 +91,8 @@ cplus_expand_constant (tree cst)
gimplification routines. Are EMPTY_CLASS_EXPR or BASELINK needed? */
rtx
-cxx_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier,
- rtx *alt_rtl)
+cxx_expand_expr (tree exp, rtx target, enum machine_mode tmode,
+ enum expand_modifier modifier, rtx *alt_rtl)
{
tree type = TREE_TYPE (exp);
enum machine_mode mode = TYPE_MODE (type);
Index: gcc/expr.h
===================================================================
--- gcc/expr.h (revision 124745)
+++ gcc/expr.h (working copy)
@@ -34,26 +34,14 @@ Software Foundation, 51 Franklin Street,
#include "tree.h"
/* For GET_MODE_BITSIZE, word_mode */
#include "machmode.h"
+/* For expand_modifier */
+#include "langhooks.h"
/* The default branch cost is 1. */
#ifndef BRANCH_COST
#define BRANCH_COST 1
#endif
-/* This is the 4th arg to `expand_expr'.
- EXPAND_STACK_PARM means we are possibly expanding a call param onto
- the stack.
- EXPAND_SUM means it is ok to return a PLUS rtx or MULT rtx.
- EXPAND_INITIALIZER is similar but also record any labels on forced_labels.
- EXPAND_CONST_ADDRESS means it is ok to return a MEM whose address
- is a constant that is not a legitimate address.
- EXPAND_WRITE means we are only going to write to the resulting rtx.
- EXPAND_MEMORY means we are interested in a memory result, even if
- the memory is constant and we could have propagated a constant value. */
-enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM,
- EXPAND_CONST_ADDRESS, EXPAND_INITIALIZER, EXPAND_WRITE,
- EXPAND_MEMORY};
-
/* Prevent the compiler from deferring stack pops. See
inhibit_defer_pop for more information. */
#define NO_DEFER_POP (inhibit_defer_pop += 1)
Index: gcc/langhooks.c
===================================================================
--- gcc/langhooks.c (revision 124745)
+++ gcc/langhooks.c (working copy)
@@ -223,7 +223,7 @@ hook_get_alias_set_0 (tree ARG_UNUSED (t
rtx
lhd_expand_expr (tree ARG_UNUSED (t), rtx ARG_UNUSED (r),
enum machine_mode ARG_UNUSED (mm),
- int ARG_UNUSED (em),
+ enum expand_modifier ARG_UNUSED (em),
rtx * ARG_UNUSED (a))
{
gcc_unreachable ();
Index: gcc/langhooks.h
===================================================================
--- gcc/langhooks.h (revision 124745)
+++ gcc/langhooks.h (working copy)
@@ -27,6 +27,20 @@ struct diagnostic_context;
struct gimplify_omp_ctx;
+/* This is the 4th arg to `expand_expr'.
+ * EXPAND_STACK_PARM means we are possibly expanding a call param onto
+ * the stack.
+ * EXPAND_SUM means it is ok to return a PLUS rtx or MULT rtx.
+ * EXPAND_INITIALIZER is similar but also record any labels on forced_labels.
+ * EXPAND_CONST_ADDRESS means it is ok to return a MEM whose address
+ * is a constant that is not a legitimate address.
+ * EXPAND_WRITE means we are only going to write to the resulting rtx.
+ * EXPAND_MEMORY means we are interested in a memory result, even if
+ * the memory is constant and we could have propagated a constant value. */
+enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM,
+ EXPAND_CONST_ADDRESS, EXPAND_INITIALIZER, EXPAND_WRITE,
+ EXPAND_MEMORY};
+
/* A print hook for print_tree (). */
typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
@@ -300,9 +314,9 @@ struct lang_hooks
constant equivalent to its input. */
tree (*expand_constant) (tree);
- /* Called by expand_expr for language-specific tree codes.
- Fourth argument is actually an enum expand_modifier. */
- rtx (*expand_expr) (tree, rtx, enum machine_mode, int, rtx *);
+ /* Called by expand_expr for language-specific tree codes. */
+ rtx (*expand_expr) (tree, rtx, enum machine_mode, enum expand_modifier,
+ rtx *);
/* Called by expand_expr to generate the definition of a decl. Returns
1 if handled, 0 otherwise. */
Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c (revision 124745)
+++ gcc/c-common.c (working copy)
@@ -4274,7 +4274,7 @@ finish_label_address_expr (tree label)
rtx
c_expand_expr (tree exp, rtx target, enum machine_mode tmode,
- int modifier /* Actually enum_modifier. */,
+ enum expand_modifier modifier,
rtx *alt_rtl)
{
switch (TREE_CODE (exp))
Index: gcc/c-common.h
===================================================================
--- gcc/c-common.h (revision 124745)
+++ gcc/c-common.h (working copy)
@@ -25,6 +25,8 @@ Software Foundation, 51 Franklin Street,
#include "splay-tree.h"
#include "cpplib.h"
#include "ggc.h"
+/* For expand_modifier */
+#include "langhooks.h"
/* Usage of TREE_LANG_FLAG_?:
0: TREE_NEGATED_INT (in INTEGER_CST).
@@ -824,7 +826,8 @@ extern tree lookup_name (tree);
extern bool vector_types_convertible_p (tree t1, tree t2, bool emit_lax_note);
-extern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
+extern rtx c_expand_expr (tree, rtx, enum machine_mode, enum expand_modifier,
+ rtx *);
extern void c_expand_body (tree);
extern tree c_staticp (tree);
Index: gcc/langhooks-def.h
===================================================================
--- gcc/langhooks-def.h (revision 124745)
+++ gcc/langhooks-def.h (working copy)
@@ -23,6 +23,8 @@ Boston, MA 02110-1301, USA. */
#define GCC_LANG_HOOKS_DEF_H
#include "hooks.h"
+/* For enum expand_modifier */
+#include "langhooks.h"
struct diagnostic_context;
@@ -54,7 +56,7 @@ extern void lhd_print_tree_nothing (FILE
extern const char *lhd_decl_printable_name (tree, int);
extern const char *lhd_dwarf_name (tree, int);
extern int lhd_types_compatible_p (tree, tree);
-extern rtx lhd_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
+extern rtx lhd_expand_expr (tree, rtx, enum machine_mode, enum expand_modifier, rtx *);
extern int lhd_expand_decl (tree);
extern void lhd_print_error_function (struct diagnostic_context *,
const char *);