diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 99826371b3230..2c5637aeff802 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4485,6 +4485,18 @@ ix86_comp_type_attributes (const_tree type1, const_tree type2) != ix86_function_regparm (type2, NULL))) return 0; +#ifdef TARGET_SYSTEM_DECL_ATTRIBUTES + if (!lookup_attribute ("system", TYPE_ATTRIBUTES (type1)) + != !lookup_attribute ("system", TYPE_ATTRIBUTES (type2))) + return 0; +#endif + +#ifdef TARGET_OPTLINK_DECL_ATTRIBUTES + if (!lookup_attribute ("optlink", TYPE_ATTRIBUTES (type1)) + != !lookup_attribute ("optlink", TYPE_ATTRIBUTES (type2))) + return 0; +#endif + /* Check for mismatched sseregparm types. */ if (!lookup_attribute ("sseregparm", TYPE_ATTRIBUTES (type1)) != !lookup_attribute ("sseregparm", TYPE_ATTRIBUTES (type2))) @@ -4541,6 +4553,27 @@ ix86_function_regparm (const_tree type, const_tree decl) if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type))) return 2; +#ifdef TARGET_OPTLINK_DECL_ATTRIBUTES + if (lookup_attribute ("optlink", TYPE_ATTRIBUTES (type))) + { + if (decl && TREE_CODE (decl) == FUNCTION_DECL) + { + /* We can't use _Optlink for nested functions as it may use + up to 3 regparms (see above about regparm(3)). */ + if (!error_issued + && decl_function_context (decl) + && !DECL_NO_STATIC_CHAIN (decl)) + { + error ("nested functions cannot use optlink attribute"); + error_issued = true; + return 0; + } + } + + return 3; + } +#endif + /* Use register calling convention for local functions when possible. */ if (decl && TREE_CODE (decl) == FUNCTION_DECL @@ -5767,7 +5800,7 @@ function_arg_advance_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode, { /* If out of eyecatcher slots, do nothing */ if (!cum->ec_slots) - return; + break; if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)) @@ -5793,7 +5826,7 @@ function_arg_advance_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode, /* The case with ec_slots <= 0 will be catched a little lates */ if (cum->ec_slots > 0) - return; + break; } else { @@ -5801,7 +5834,7 @@ function_arg_advance_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode, Pass it on the stack but count its size in eyecatcher. */ cum->ec_slots -= words; if (cum->ec_slots > 0) - return; + break; } /* If we're out of eyecatcher slots, pass the arg on the stack */ @@ -5810,7 +5843,7 @@ function_arg_advance_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode, cum->ec_slots = 0; cum->nregs = 0; cum->fpu_nregs = 0; - return; + break; } } #endif