diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-03 13:40:47 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-03 13:40:47 +0000 |
commit | 8c3216aef96b99f911d02b76caee0faf6e4ba2d6 (patch) | |
tree | 7bd88a4c0b05c32d50e4e322adfc7539f8ada941 | |
parent | c56a693ae2eaef3b8fecee8f29fa4107dbd037fb (diff) | |
download | ppe42-gcc-8c3216aef96b99f911d02b76caee0faf6e4ba2d6.tar.gz ppe42-gcc-8c3216aef96b99f911d02b76caee0faf6e4ba2d6.zip |
* langhooks-def.h (LANG_HOOKS_TYPE_MAX_SIZE): New langhook.
* langhooks.h (strct lang_hooks): New field type_max_size.
* function.c (assign_temp): Call it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84053 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/function.c | 8 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 2 | ||||
-rw-r--r-- | gcc/langhooks.h | 4 |
4 files changed, 20 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 447484b9879..7a161eb5371 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-07-03 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> + + * langhooks-def.h (LANG_HOOKS_TYPE_MAX_SIZE): New langhook. + * langhooks.h (strct lang_hooks): New field type_max_size. + * function.c (assign_temp): Call it. + 2004-07-03 Steven Bosscher <stevenb@suse.de> * config/sh/sh.c (sh_use_dfa_interface): Add TARGET_SH1. diff --git a/gcc/function.c b/gcc/function.c index b6d37896a8e..c3ab96dbae3 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -914,6 +914,7 @@ assign_temp (tree type_or_decl, int keep, int memory_required, if (mode == BLKmode || memory_required) { HOST_WIDE_INT size = int_size_in_bytes (type); + tree size_tree; rtx tmp; /* Zero sized arrays are GNU C extension. Set size to 1 to avoid @@ -930,6 +931,13 @@ assign_temp (tree type_or_decl, int keep, int memory_required, && host_integerp (TYPE_ARRAY_MAX_SIZE (type), 1)) size = tree_low_cst (TYPE_ARRAY_MAX_SIZE (type), 1); + /* If we still haven't been able to get a size, see if the language + can compute a maximum size. */ + if (size == -1 + && (size_tree = lang_hooks.type_max_size (type)) != 0 + && host_integerp (size_tree, 1)) + size = tree_low_cst (size_tree, 1); + /* The size of the temporary may be too large to fit into an integer. */ /* ??? Not sure this should happen except for user silliness, so limit this to things that aren't compiler-generated temporaries. The diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 60642990794..2cbd3fd2d14 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -127,6 +127,7 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *); #define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name #define LANG_HOOKS_GET_CALLEE_FNDECL lhd_return_null_tree #define LANG_HOOKS_EXPR_SIZE lhd_expr_size +#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_tree #define LANG_HOOKS_TREE_SIZE lhd_tree_size #define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p #define LANG_HOOKS_UPDATE_DECL_AFTER_SAVING NULL @@ -305,6 +306,7 @@ extern tree lhd_make_node (enum tree_code); LANG_HOOKS_GET_CALLEE_FNDECL, \ LANG_HOOKS_PRINT_ERROR_FUNCTION, \ LANG_HOOKS_EXPR_SIZE, \ + LANG_HOOKS_TYPE_MAX_SIZE, \ LANG_HOOKS_UPDATE_DECL_AFTER_SAVING, \ LANG_HOOKS_ATTRIBUTE_TABLE, \ LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index a8c0ccac2a7..6f526ef898d 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -390,6 +390,10 @@ struct lang_hooks semantics in cases that it doesn't want to handle specially. */ tree (*expr_size) (tree); + /* Called from assign_temp to return the maximum size, if there is one, + for a type. */ + tree (*type_max_size) PARAMS ((tree)); + /* Update lang specific fields after duplicating function body. */ void (*update_decl_after_saving) (tree, void *); |