[PATCH, i386]: A couple of cleanups in i386.c
Uros Bizjak
ubizjak@gmail.com
Wed Jun 17 19:56:00 GMT 2015
No functional changes.
2015-06-17 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.c (ix86_function_arg): Nest TARGET_64BIT code.
(ix86_function_arg_advance): Ditto.
(ix86_pass_by_reference): Ditto. Rewrite MS_ABI part.
Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.
Uros.
-------------- next part --------------
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 224561)
+++ config/i386/i386.c (working copy)
@@ -7659,10 +7659,15 @@ ix86_function_arg_advance (cumulative_args_t cum_v
cum->force_bnd_pass = 0;
}
- if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI)
- nregs = function_arg_advance_ms_64 (cum, bytes, words);
- else if (TARGET_64BIT)
- nregs = function_arg_advance_64 (cum, mode, type, words, named);
+ if (TARGET_64BIT)
+ {
+ enum calling_abi call_abi = cum ? cum->call_abi : ix86_abi;
+
+ if (call_abi == MS_ABI)
+ nregs = function_arg_advance_ms_64 (cum, bytes, words);
+ else
+ nregs = function_arg_advance_64 (cum, mode, type, words, named);
+ }
else
nregs = function_arg_advance_32 (cum, mode, type, bytes, words);
@@ -7949,10 +7954,15 @@ ix86_function_arg (cumulative_args_t cum_v, machin
if (type && TREE_CODE (type) == VECTOR_TYPE)
mode = type_natural_mode (type, cum, false);
- if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI)
- arg = function_arg_ms_64 (cum, mode, omode, named, bytes);
- else if (TARGET_64BIT)
- arg = function_arg_64 (cum, mode, omode, type, named);
+ if (TARGET_64BIT)
+ {
+ enum calling_abi call_abi = cum ? cum->call_abi : ix86_abi;
+
+ if (call_abi == MS_ABI)
+ arg = function_arg_ms_64 (cum, mode, omode, named, bytes);
+ else
+ arg = function_arg_64 (cum, mode, omode, type, named);
+ }
else
arg = function_arg_32 (cum, mode, omode, type, bytes, words);
@@ -7976,36 +7986,37 @@ ix86_pass_by_reference (cumulative_args_t cum_v, m
|| POINTER_BOUNDS_MODE_P (mode))
return false;
- /* See Windows x64 Software Convention. */
- if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI)
+ if (TARGET_64BIT)
{
- int msize = (int) GET_MODE_SIZE (mode);
- if (type)
+ enum calling_abi call_abi = cum ? cum->call_abi : ix86_abi;
+
+ /* See Windows x64 Software Convention. */
+ if (call_abi == MS_ABI)
{
- /* Arrays are passed by reference. */
- if (TREE_CODE (type) == ARRAY_TYPE)
- return true;
+ HOST_WIDE_INT msize = GET_MODE_SIZE (mode);
- if (AGGREGATE_TYPE_P (type))
+ if (type)
{
- /* Structs/unions of sizes other than 8, 16, 32, or 64 bits
- are passed by reference. */
- msize = int_size_in_bytes (type);
+ /* Arrays are passed by reference. */
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ return true;
+
+ if (RECORD_OR_UNION_TYPE_P (type))
+ {
+ /* Structs/unions of sizes other than 8, 16, 32, or 64 bits
+ are passed by reference. */
+ msize = int_size_in_bytes (type);
+ }
}
+
+ /* __m128 is passed by reference. */
+ return msize != 1 && msize != 2 && msize != 4 && msize != 8;
}
-
- /* __m128 is passed by reference. */
- switch (msize) {
- case 1: case 2: case 4: case 8:
- break;
- default:
- return true;
- }
+ else if (type && int_size_in_bytes (type) == -1)
+ return true;
}
- else if (TARGET_64BIT && type && int_size_in_bytes (type) == -1)
- return 1;
- return 0;
+ return false;
}
/* Return true when TYPE should be 128bit aligned for 32bit argument
More information about the Gcc-patches
mailing list