diff options
author | Richard Henderson <rth@redhat.com> | 2003-01-20 15:20:18 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2003-01-20 15:20:18 -0800 |
commit | a4b1b92af3fa1384872bcf78966cc93ea68c752e (patch) | |
tree | 0e621df774f2b6ae7e3e0299e68ea6fb231b0044 /gcc | |
parent | d530b07f81e389fde99a626460ea3b33a34b9a83 (diff) | |
download | gcc-a4b1b92af3fa1384872bcf78966cc93ea68c752e.zip gcc-a4b1b92af3fa1384872bcf78966cc93ea68c752e.tar.gz gcc-a4b1b92af3fa1384872bcf78966cc93ea68c752e.tar.bz2 |
expr.h (MUST_PASS_IN_STACK): Move implementation...
* expr.h (MUST_PASS_IN_STACK): Move implementation...
* calls.c (default_must_pass_in_stack): ... here.
From-SVN: r61514
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/calls.c | 45 | ||||
-rw-r--r-- | gcc/expr.h | 29 |
3 files changed, 53 insertions, 26 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2bada01..6b827d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-01-20 Richard Henderson <rth@redhat.com> + + * expr.h (MUST_PASS_IN_STACK): Move implementation... + * calls.c (default_must_pass_in_stack): ... here. + 2003-01-20 Vladimir Makarov <vmakarov@redhat.com> * genattrtab.h (INSN_ALTS_FUNC_NAME): Move it from genautomata.c. diff --git a/gcc/calls.c b/gcc/calls.c index 52b5fc3..8296b84 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -4656,3 +4656,48 @@ store_one_arg (arg, argblock, flags, variable_size, reg_parm_stack_space) return sibcall_failure; } + + +/* Nonzero if we do not know how to pass TYPE solely in registers. + We cannot do so in the following cases: + + - if the type has variable size + - if the type is marked as addressable (it is required to be constructed + into the stack) + - if the padding and mode of the type is such that a copy into a register + would put it into the wrong part of the register. + + Which padding can't be supported depends on the byte endianness. + + A value in a register is implicitly padded at the most significant end. + On a big-endian machine, that is the lower end in memory. + So a value padded in memory at the upper end can't go in a register. + For a little-endian machine, the reverse is true. */ + +bool +default_must_pass_in_stack (mode, type) + enum machine_mode mode; + tree type; +{ + if (!type) + return true; + + /* If the type has variable size... */ + if (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) + return true; + + /* If the type is marked as addressable (it is required + to be constructed into the stack)... */ + if (TREE_ADDRESSABLE (type)) + return true; + + /* If the padding and mode of the type is such that a copy into + a register would put it into the wrong part of the register. */ + if (mode == BLKmode + && int_size_in_bytes (type) % (PARM_BOUNDARY / BITS_PER_UNIT) + && (FUNCTION_ARG_PADDING (mode, type) + == (BYTES_BIG_ENDIAN ? upward : downward))) + return true; + + return false; +} @@ -153,33 +153,10 @@ enum direction {none, upward, downward}; /* Value has this type. */ #define PRETEND_OUTGOING_VARARGS_NAMED 0 #endif -/* Nonzero if we do not know how to pass TYPE solely in registers. - We cannot do so in the following cases: - - - if the type has variable size - - if the type is marked as addressable (it is required to be constructed - into the stack) - - if the padding and mode of the type is such that a copy into a register - would put it into the wrong part of the register. - - Which padding can't be supported depends on the byte endianness. - - A value in a register is implicitly padded at the most significant end. - On a big-endian machine, that is the lower end in memory. - So a value padded in memory at the upper end can't go in a register. - For a little-endian machine, the reverse is true. */ - +/* Nonzero if we do not know how to pass TYPE solely in registers. */ #ifndef MUST_PASS_IN_STACK -#define MUST_PASS_IN_STACK(MODE,TYPE) \ - ((TYPE) != 0 \ - && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \ - || TREE_ADDRESSABLE (TYPE) \ - || ((MODE) == BLKmode \ - && ! ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \ - && 0 == (int_size_in_bytes (TYPE) \ - % (PARM_BOUNDARY / BITS_PER_UNIT))) \ - && (FUNCTION_ARG_PADDING (MODE, TYPE) \ - == (BYTES_BIG_ENDIAN ? upward : downward))))) +extern bool default_must_pass_in_stack PARAMS((enum machine_mode, tree)); +#define MUST_PASS_IN_STACK(MODE,TYPE) default_must_pass_in_stack(MODE, TYPE) #endif /* Nonzero if type TYPE should be returned in memory. |