@@ -29693,22 +29709,10 @@ } -/* Table of valid machine attributes. - If you change it, you must change the array at the beginning of - ix86_comp_type_attributes() as well! */ +/* Table of valid machine attributes. */ static const struct attribute_spec ix86_attribute_table[] = { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ -#ifdef EMX /** @todo: ugly stuff, cleanup later. */ - /* Stdcall attribute says callee is responsible for popping arguments - if they are not variable. */ - { "stdcall", 0, 0, false, false, false, ix86_handle_system_attribute }, - /* Fastcall attribute says callee is responsible for popping arguments - if they are not variable. */ - { "fastcall", 0, 0, false, false, false, ix86_handle_system_attribute }, - /* Cdecl attribute says the callee is a normal C declaration */ - { "cdecl", 0, 0, false, false, false, ix86_handle_system_attribute }, -#else /* Stdcall attribute says callee is responsible for popping arguments if they are not variable. */ { "stdcall", 0, 0, false, true, true, ix86_handle_cconv_attribute }, @@ -29717,7 +29721,6 @@ { "fastcall", 0, 0, false, true, true, ix86_handle_cconv_attribute }, /* Cdecl attribute says the callee is a normal C declaration */ { "cdecl", 0, 0, false, true, true, ix86_handle_cconv_attribute }, -#endif /* Regparm attribute specifies how many integer arguments are to be passed in registers. */ { "regparm", 1, 1, false, true, true, ix86_handle_cconv_attribute }, @@ -29727,7 +29730,6 @@ /* force_align_arg_pointer says this function realigns the stack at entry. */ { (const char *)&ix86_force_align_arg_pointer_string, 0, 0, false, true, true, ix86_handle_cconv_attribute }, - #if TARGET_DLLIMPORT_DECL_ATTRIBUTES { "dllimport", 0, 0, false, false, false, handle_dll_attribute }, { "dllexport", 0, 0, false, false, false, handle_dll_attribute }, @@ -29742,106 +29744,17 @@ { "ms_abi", 0, 0, false, true, true, ix86_handle_abi_attribute }, { "sysv_abi", 0, 0, false, true, true, ix86_handle_abi_attribute }, /* End element. */ -#ifdef EMX /** @todo: ugly stuff, cleanup later. */ -#ifdef TARGET_SYSTEM_DECL_ATTRIBUTES - /* System says the function is extern "C" and is not underscored. */ - { "system", 0, 0, false, false, false, ix86_handle_system_attribute }, -#endif -#ifdef TARGET_OPTLINK_DECL_ATTRIBUTES - /* Optlink is like regparm with a few differences */ - { "optlink", 0, 0, false, false, false, ix86_handle_optlink_attribute }, -#endif -#else #ifdef TARGET_SYSTEM_DECL_ATTRIBUTES /* System says the function is extern "C" and is not underscored. */ - { "system", 0, 0, false, true, true, ix86_handle_system_attribute }, + { "system", 0, 0, false, true, true, ix86_handle_cconv_attribute }, #endif #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES /* Optlink is like regparm with a few differences */ - { "optlink", 0, 0, false, true, true, ix86_handle_optlink_attribute }, -#endif + { "optlink", 0, 0, false, true, true, ix86_handle_cconv_attribute }, #endif { NULL, 0, 0, false, false, false, NULL } }; -/* The attribute denotes a calling convention */ -#define IX86_ATTR_TYPE_CALLCONV 0x00010000 -/* Calling convention mask: attributes with bits - in these positions equal are nealy compatible */ -#define IX86_ATTR_MASK_CALLCONV 0x0000000f -/* Ordinal number for attributes with equal calling convention bits */ -#define IX86_ATTR_MASK_ORDINAL 0x000000f0 - -/* This array contains some flags containing additional information - about attributes. Keep it in sync with ix86_attribute_table. */ -static unsigned ix86_attribute_codes [] = -{ - IX86_ATTR_TYPE_CALLCONV | 0x01, /* stdcall */ - IX86_ATTR_TYPE_CALLCONV | 0x05, /* fastcall */ - IX86_ATTR_TYPE_CALLCONV | 0x02, /* cdecl */ - IX86_ATTR_TYPE_CALLCONV | 0x03, /* regparm */ - IX86_ATTR_TYPE_CALLCONV | 0x06, /* sseregparm */ -#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES - 0, /* dllimport */ - 0, /* dllexport */ - 0, /* shared */ -#endif - IX86_ATTR_TYPE_CALLCONV | 0x07, /* ms_struct */ - IX86_ATTR_TYPE_CALLCONV | 0x08, /* gcc_struct */ -#ifdef TARGET_SYSTEM_DECL_ATTRIBUTES - IX86_ATTR_TYPE_CALLCONV | 0x12, /* system is compatible with cdecl */ -#endif -#ifdef TARGET_OPTLINK_DECL_ATTRIBUTES - IX86_ATTR_TYPE_CALLCONV | 0x04, /* optlink */ -#endif -}; - - -/* Check if we don't have incompatible calling conversion attributes */ -int -ix86_check_append_attr (type, name, no_add_attrs) - tree type, name; - bool *no_add_attrs; -{ - /* ??? use ix86_comp_type_attributes maybe ??? */ - unsigned i; - const char *exclname; - - exclname = IDENTIFIER_POINTER (name); - if (exclname [0] == '_') - { - /* Remove leading and trailing underscores */ - const char *x1, *x2; - char *newname; - x1 = exclname + 1; - while (*x1 == '_') - x1++; - x2 = strchr (x1, 0); - while (x2 [-1] == '_' && x2 > x1) - x2--; - newname = alloca (x2 - x1 + 1); - memcpy (newname, x1, x2 - x1); - newname [x2 - x1] = 0; - exclname = newname; - } - - for (i = 0; ix86_attribute_table [i].name; i++) - if ((ix86_attribute_codes [i] & IX86_ATTR_TYPE_CALLCONV) - && lookup_attribute (ix86_attribute_table [i].name, TYPE_ATTRIBUTES (type))) - { - /* Warn if we have another calling convention attribute and it is - different from the currently processed attribute. If there is - already an attribute with the same name attached, silently ignore - currently processed attribute. */ - if (strcmp (exclname, ix86_attribute_table [i].name)) - warning ("`%s' attribute is incompatible with earlier defined `%s' attribute", - IDENTIFIER_POINTER (name), ix86_attribute_table [i].name); - *no_add_attrs = true; - return -1; - } - - return 0; -} /* Implement targetm.vectorize.builtin_vectorization_cost. */ static int