From: Uros Bizjak Date: Wed, 17 Jun 2015 19:54:10 +0000 (+0200) Subject: i386.c (ix86_function_arg): Nest TARGET_64BIT code. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=341d2da30c969bd66fa4af8ecee8349de7ad93bf;p=gcc.git i386.c (ix86_function_arg): Nest TARGET_64BIT code. * 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. From-SVN: r224576 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bddcd0f5606..e71021725e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-17 Uros Bizjak + + * 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. + 2015-06-17 Andrew MacLeod * function.h (struct rtl_data): Remove struct and accessor macros. @@ -37,11 +43,11 @@ 2017-06-17 Andrew MacLeod - * tree-core.h (tree_target_option): Make opts field a pointer to a + * tree-core.h (tree_target_option): Make opts field a pointer to a cl_target_option instead of an instance of the struct. * tree.h (TREE_TARGET_OPTION): Return the pointer, not an address of the structure. - * tree.c (make_node_stat ): Allocate a cl_target_option struct for + * tree.c (make_node_stat ): Allocate a cl_target_option struct for TARGET_OPTION_NODE. (copy_node_stat): Allocate and copy struct cl_target_option. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 44a8624725f..bd548a969fb 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -7657,10 +7657,15 @@ ix86_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, 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); @@ -7947,10 +7952,15 @@ ix86_function_arg (cumulative_args_t cum_v, machine_mode omode, 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); @@ -7974,36 +7984,37 @@ ix86_pass_by_reference (cumulative_args_t cum_v, machine_mode mode, || 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. */ - switch (msize) { - case 1: case 2: case 4: case 8: - break; - default: - return true; - } + /* __m128 is passed by reference. */ + return msize != 1 && msize != 2 && msize != 4 && msize != 8; + } + 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