diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2011-07-21 22:22:00 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2011-07-21 15:22:00 -0700 |
commit | 08a8923efc660d4f4cad7885771db91a305f32db (patch) | |
tree | b67c2c0c84365350c42e9e68f6cd8fe87389df98 /gcc | |
parent | 02614448c98bec25dacfe97635f05a04aa748676 (diff) | |
download | gcc-08a8923efc660d4f4cad7885771db91a305f32db.zip gcc-08a8923efc660d4f4cad7885771db91a305f32db.tar.gz gcc-08a8923efc660d4f4cad7885771db91a305f32db.tar.bz2 |
Promote pointer function arguments and return values to Pmode.
2011-07-21 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (function_value_64): Always return pointers
in Pmode.
(ix86_promote_function_mode): New.
(TARGET_PROMOTE_FUNCTION_MODE): Likewise.
From-SVN: r176593
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 24 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 023f478..cf52904 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-07-21 H.J. Lu <hongjiu.lu@intel.com> + + * config/i386/i386.c (function_value_64): Always return pointers + in Pmode. + (ix86_promote_function_mode): New. + (TARGET_PROMOTE_FUNCTION_MODE): Likewise. + 2011-07-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR tree-optimization/49749 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index da6c888..957b51d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -7078,6 +7078,11 @@ function_value_64 (enum machine_mode orig_mode, enum machine_mode mode, return gen_rtx_REG (mode, AX_REG); } } + else if (POINTER_TYPE_P (valtype)) + { + /* Pointers are always returned in Pmode. */ + mode = Pmode; + } ret = construct_container (mode, orig_mode, valtype, 1, X86_64_REGPARM_MAX, X86_64_SSE_REGPARM_MAX, @@ -7147,6 +7152,22 @@ ix86_function_value (const_tree valtype, const_tree fntype_or_decl, return ix86_function_value_1 (valtype, fntype_or_decl, orig_mode, mode); } +/* Pointer function arguments and return values are promoted to Pmode. */ + +static enum machine_mode +ix86_promote_function_mode (const_tree type, enum machine_mode mode, + int *punsignedp, const_tree fntype, + int for_return) +{ + if (type != NULL_TREE && POINTER_TYPE_P (type)) + { + *punsignedp = POINTERS_EXTEND_UNSIGNED; + return Pmode; + } + return default_promote_function_mode (type, mode, punsignedp, fntype, + for_return); +} + rtx ix86_libcall_value (enum machine_mode mode) { @@ -34970,6 +34991,9 @@ ix86_autovectorize_vector_sizes (void) #undef TARGET_FUNCTION_VALUE_REGNO_P #define TARGET_FUNCTION_VALUE_REGNO_P ix86_function_value_regno_p +#undef TARGET_PROMOTE_FUNCTION_MODE +#define TARGET_PROMOTE_FUNCTION_MODE ix86_promote_function_mode + #undef TARGET_SECONDARY_RELOAD #define TARGET_SECONDARY_RELOAD ix86_secondary_reload |