diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2004-07-03 13:40:47 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2004-07-03 09:40:47 -0400 |
commit | e30bb772cb02a5b523d036eaaa5a402a471d476b (patch) | |
tree | 7bd88a4c0b05c32d50e4e322adfc7539f8ada941 /gcc/function.c | |
parent | 52c27e16fdfee3fdda117195c05768e27f37cc8e (diff) | |
download | gcc-e30bb772cb02a5b523d036eaaa5a402a471d476b.zip gcc-e30bb772cb02a5b523d036eaaa5a402a471d476b.tar.gz gcc-e30bb772cb02a5b523d036eaaa5a402a471d476b.tar.bz2 |
langhooks-def.h (LANG_HOOKS_TYPE_MAX_SIZE): New langhook.
* 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.
From-SVN: r84053
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/function.c b/gcc/function.c index b6d3789..c3ab96d 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 |