Changeset 645
- Timestamp:
- Sep 2, 2003, 9:15:54 PM (22 years ago)
- Location:
- trunk/src/gcc/gcc
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gcc/gcc/config/i386/emx.c
-
Property cvs2svn:cvs-rev
changed from
1.20
to1.21
r644 r645 30 30 #include "toplev.h" 31 31 #include "flags.h" 32 33 /* Prototypes */ 34 static const char *gen_stdcall_suffix (tree); 32 #include "i386-protos.h" 35 33 36 34 /* The size of the target's pointer type. */ … … 100 98 #endif 101 99 102 tree ix86_handle_vacpp_attribute (tree *node, tree name, tree args, 103 int flags, bool *no_add_attrs) 104 { 105 tree id, type, context; 106 size_t sl; 100 int emx_c_set_decl_assembler_name (tree decl) 101 { 102 static int recurse; 107 103 const char *oldsym; 108 104 char *newsym; 109 110 DUMP (*node); 111 112 switch (TREE_CODE (*node)) 113 { 114 case FUNCTION_DECL: 115 /* This is the core of attribute handling. Every other code is 116 designed so that we end up with a function declaration and 117 an attached attribute (either optlink or system). 118 This is the only part which is changing the mangling. */ 119 120 type = TREE_TYPE (*node); 121 122 if (ix86_check_append_attr (type, name, no_add_attrs)) 123 break; 124 125 if (is_attribute_p ("system", name)) 105 size_t sl; 106 tree id, type; 107 int rc = 1; 108 109 /* Sometimes we recursively call DECL_ASSEMBLER_NAME to apply the default 110 mangling rules for current compiler. */ 111 if (recurse) 112 return 0; 113 114 recurse++; 115 116 type = TREE_TYPE (decl); 117 118 if (lookup_attribute ("system", TYPE_ATTRIBUTES (type))) 119 { 120 /* Here we mangle _System functions as defined by IBM specs. 121 The function always gets its name as-is (unless it is a method, 122 which is a undefined case as VACPP always use _Optlink for methods, 123 at least that's what I have understood from the docs). */ 124 125 oldsym = IDENTIFIER_POINTER (DECL_NAME (decl)); 126 127 /* Specifying '*' as first symbol character tells gcc (see varasm.c, 128 function assemble_name()) to output the label as-is rather than 129 invoking the ASM_OUTPUT_LABELREF macro (which prepends a underscore) */ 130 131 sl = strlen (oldsym); 132 newsym = xmalloc (sl + 2); 133 newsym [0] = '*'; 134 memcpy (newsym + 1, oldsym, sl + 1); 135 136 SET_DECL_ASSEMBLER_NAME (decl, get_identifier (newsym)); 137 138 dfprintf ((stderr, "dbg: system %s -> %s\n", oldsym, newsym)); 139 } 140 else if (lookup_attribute ("optlink", TYPE_ATTRIBUTES (type))) 141 { 142 /* At the moment we're only implementing OS/2 VAC linking 143 compatibility for the C language. This means that no leading 144 underscore. 145 For C++ we are not compatible. It doesn't make that much sense 146 either since we're not VFT compatible either. For simplicity 147 and safety we are removing the leading underscore from the 148 default mangled names to catch invalid declarations in the 149 linking. */ 150 151 id = DECL_ASSEMBLER_NAME (decl); 152 153 /* Remove the leading underscore. */ 154 oldsym = IDENTIFIER_POINTER (id); 155 sl = strlen (oldsym); 156 newsym = xmalloc (sl + 2); 157 newsym [0] = '*'; 158 memcpy (newsym + 1, oldsym, sl + 1); 159 160 XEXP (DECL_RTL (decl), 0) = gen_rtx (SYMBOL_REF, Pmode, 161 IDENTIFIER_POINTER (get_identifier (newsym))); 162 163 dfprintf ((stderr, "dbg: optlink %s -> %s\n", oldsym, newsym)); 164 } 165 else if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (type))) 166 { 167 /* Mangle decl as the former assembler name modified with a 168 suffix consisting of an atsign (@) followed by the number of bytes of 169 arguments */ 170 171 int total = 0; 172 173 /* If function does not have ellipsis as last argument, count total args size */ 174 if (TYPE_ARG_TYPES (type)) 175 if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (type))) == void_type_node) 126 176 { 127 /* Here we mangle _System functions as defined by IBM specs. 128 The function always gets its name as-is (unless it is a method, 129 which is a undefined case as VACPP always use _Optlink for methods, 130 at least that's what I have understood from the docs). */ 131 /* @todo: verify the class detection here! Does it require use of 132 CLASSTYPE_DECLARED_CLASS (meaning it doesn't apply to plain 133 structs/unions) ? */ 134 if ( TREE_CODE (type) != METHOD_TYPE 135 && ( !(context = DECL_CONTEXT (*node)) 136 || ( TREE_CODE (context) != RECORD_TYPE 137 && TREE_CODE (context) != UNION_TYPE))) 177 tree formal_type = TYPE_ARG_TYPES (type); 178 179 while (TREE_VALUE (formal_type) != void_type_node) 138 180 { 139 oldsym = IDENTIFIER_POINTER (DECL_NAME (*node)); 140 /* Specifying '*' as first symbol character tells gcc (see varasm.c, 141 function assemble_name()) to output the label as-is rather than 142 invoking the ASM_OUTPUT_LABELREF macro (which prepends a underscore) */ 143 sl = strlen (oldsym); 144 newsym = xmalloc (sl + 2); 145 newsym [0] = '*'; 146 memcpy (newsym + 1, oldsym, sl + 1); 147 SET_DECL_ASSEMBLER_NAME (*node, get_identifier (newsym)); 148 dfprintf((stderr, "dbg: system %s -> %s\n", oldsym, newsym)); 181 int parm_size = TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type))); 182 /* Must round up to include padding. This is done the same 183 way as in store_one_arg. */ 184 parm_size = ((parm_size + PARM_BOUNDARY - 1) / PARM_BOUNDARY * PARM_BOUNDARY); 185 total += parm_size; 186 formal_type = TREE_CHAIN (formal_type); 149 187 } 150 188 } 151 else if (is_attribute_p ("optlink", name)) 152 { 153 /* At the moment we're only implementing OS/2 VAC linking 154 compatibility for the C language. This means that no leading 155 underscore. 156 For C++ we are not compatible. It doesn't make that much sense 157 either since we're not VFT compatible either. For simplicity 158 and safety we are removing the leading underscore from the 159 default mangled names to catch invalid declarations in the 160 linking. */ 161 162 id = DECL_ASSEMBLER_NAME (*node); 163 /* Remove the leading underscore. */ 164 oldsym = IDENTIFIER_POINTER (id); 165 sl = strlen (oldsym); 166 newsym = xmalloc (sl + 2); 167 newsym [0] = '*'; 168 memcpy (newsym + 1, oldsym, sl + 1); 169 XEXP (DECL_RTL (*node), 0) = gen_rtx (SYMBOL_REF, Pmode, 170 IDENTIFIER_POINTER (get_identifier (newsym))); 171 dfprintf ((stderr, "dbg: optlink %s -> %s\n", oldsym, newsym)); 172 } 173 else /* Internal error!!! */ 174 { 175 warning ("unexpected attribute `%s' in ix86_handle_vacpp_attribute()", 176 IDENTIFIER_POINTER (name)); 177 *no_add_attrs = true; 178 break; 179 } 180 181 /* The attribute should really be attached to our _TYPE 182 rather than to the _DECL. */ 183 TYPE_ATTRIBUTES (type) = chainon (TYPE_ATTRIBUTES (type), 184 tree_cons (name, args, NULL_TREE)); 185 *no_add_attrs = true; 186 break; 187 188 /* Only function declarations needs mangling changes, however other 189 declarations involving function types needs to get the parameter 190 passing right. */ 191 /*case CONST_DECL: ?? */ 192 /* Is this possible - make testcase. */ 193 /*case PARM_DECL: ?? */ 194 /* Is this possible - make testcase. */ 195 case VAR_DECL: 196 /* Function pointer variable. */ 197 case FIELD_DECL: 198 /* Struct, union or class member declaration. Same handling as 199 type declarations. */ 200 case TYPE_DECL: 201 /* If this is a type declaration with our attribute, we allow it 202 only if it is a pointer-to-a-function type or a function type. */ 203 type = TREE_TYPE (*node); 204 if (TREE_CODE (type) == POINTER_TYPE) 205 type = TREE_TYPE(type); 206 if ( TREE_CODE (type) == FUNCTION_TYPE 207 || TREE_CODE (type) == METHOD_TYPE) 208 { 209 if (ix86_check_append_attr (type, name, no_add_attrs)) 210 break; 211 212 /* Attach the attribute to the (FUNCTION|METHOD)_TYPE node */ 213 TYPE_ATTRIBUTES (type) = chainon (TYPE_ATTRIBUTES (type), 214 tree_cons (name, args, NULL_TREE)); 215 *no_add_attrs = true; 216 break; 217 } 218 warning ("`%s' attribute only applies to functions and function types", 219 IDENTIFIER_POINTER (name)); 220 *no_add_attrs = true; 221 break; 222 223 224 /* For types involving functions we need to convince decl_attributes 225 (and its callers) to supply a declaration in case the mangling needs 226 to be changed. */ 227 case POINTER_TYPE: 228 /* We allow: 229 This being the return type of a function which is coming soon. 230 This being a function pointer which declaration is coming next. 231 Everything else is considered inappropriate use of the attribute. */ 232 if ( !(flags & ATTR_FLAG_FUNCTION_NEXT) 233 && ( !(flags & ATTR_FLAG_DECL_NEXT) 234 || !(type = TREE_TYPE (*node)) 235 || ( TREE_CODE (type) != FUNCTION_TYPE 236 && TREE_CODE (type) != METHOD_TYPE))) 237 { 238 warning ("`%s' attribute only applies to functions and function types", 239 IDENTIFIER_POINTER (name)); 240 *no_add_attrs = true; 241 break; 242 } 243 /* fall thru */ 244 case FUNCTION_TYPE: 245 case METHOD_TYPE: 246 /* This branch is taken when a function/method type is encountered. 247 We defer attribute handling until we get the complete declaration */ 248 #if 0 /* bird: This fixes optlink/tst4.c and doesn't seem to break anything. 249 If set to true we are in some cases imposing _Optlink onto following 250 declarations. This is weird stuff! */ 251 *no_add_attrs = true; 252 #endif 253 return tree_cons (name, args, NULL_TREE); 254 255 default: 256 warning ("`%s' attribute only applies to functions and function types (code=%d)", 257 IDENTIFIER_POINTER (name), TREE_CODE (*node)); 258 *no_add_attrs = true; 259 break; 260 } 189 190 id = DECL_ASSEMBLER_NAME (decl); 191 oldsym = IDENTIFIER_POINTER (id); 192 newsym = xmalloc (strlen (oldsym) + 10); 193 sprintf (newsym, "%s@%d", oldsym, total / BITS_PER_UNIT); 194 195 XEXP (DECL_RTL (decl), 0) = 196 gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (get_identifier (newsym))); 197 198 dfprintf ((stderr, "dbg: stdcall %s -> %s\n", oldsym, newsym)); 199 } 200 else 201 rc = 0; 202 203 recurse--; 204 return rc; 205 } 206 207 tree emx_handle_vacpp_attribute (tree *node, tree name, tree args, 208 int flags, bool *no_add_attrs) 209 { 210 (void) args; 211 (void) flags; 212 213 DUMP (*node); 214 215 if (TREE_CODE (*node) != FUNCTION_TYPE 216 && TREE_CODE (*node) != METHOD_TYPE 217 && TREE_CODE (*node) != FIELD_DECL 218 && TREE_CODE (*node) != TYPE_DECL) 219 { 220 warning ("`%s' attribute only applies to functions", 221 IDENTIFIER_POINTER (name)); 222 *no_add_attrs = true; 223 } 224 225 if (TARGET_64BIT) 226 { 227 warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); 228 *no_add_attrs = true; 229 } 230 231 /* Check if the attributes are compatible */ 232 if (ix86_check_append_attr (*node, name, no_add_attrs)) 233 return NULL_TREE; 261 234 262 235 return NULL_TREE; … … 292 265 } 293 266 } 294 295 /* Return string which is the former assembler name modified with a296 suffix consisting of an atsign (@) followed by the number of bytes of297 arguments */298 299 static const char *300 gen_stdcall_suffix (tree decl)301 {302 int total = 0;303 /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead304 of DECL_ASSEMBLER_NAME. */305 const char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));306 char *newsym;307 308 if (TYPE_ARG_TYPES (TREE_TYPE (decl)))309 if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl))))310 == void_type_node)311 {312 tree formal_type = TYPE_ARG_TYPES (TREE_TYPE (decl));313 314 while (TREE_VALUE (formal_type) != void_type_node)315 {316 int parm_size317 = TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type)));318 /* Must round up to include padding. This is done the same319 way as in store_one_arg. */320 parm_size = ((parm_size + PARM_BOUNDARY - 1)321 / PARM_BOUNDARY * PARM_BOUNDARY);322 total += parm_size;323 formal_type = TREE_CHAIN (formal_type);324 }325 }326 327 newsym = xmalloc (strlen (asmname) + 10);328 sprintf (newsym, "%s@%d", asmname, total/BITS_PER_UNIT);329 return IDENTIFIER_POINTER (get_identifier (newsym));330 }331 332 /* Cover function to implement ENCODE_SECTION_INFO.333 Note that this could be implemented much better by doing the334 stdcall mangling like optlink and system, but unfortunately */335 336 void337 emx_encode_section_info (tree decl)338 {339 /* The default ENCODE_SECTION_INFO from i386.h */340 if (flag_pic)341 {342 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd'343 ? TREE_CST_RTL (decl) : DECL_RTL (decl));344 345 if (GET_CODE (rtl) == MEM)346 {347 if (TARGET_DEBUG_ADDR348 && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')349 {350 fprintf (stderr, "Encode %s, public = %d\n",351 IDENTIFIER_POINTER (DECL_NAME (decl)),352 TREE_PUBLIC (decl));353 }354 355 SYMBOL_REF_FLAG (XEXP (rtl, 0))356 = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd'357 || ! TREE_PUBLIC (decl));358 }359 }360 361 /* If declaring a function, mangle it if it's stdcall */362 if (TREE_CODE (decl) == FUNCTION_DECL)363 {364 if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (TREE_TYPE (decl))))365 XEXP (DECL_RTL (decl), 0) =366 gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (decl));367 }368 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/emx.h
-
Property cvs2svn:cvs-rev
changed from
1.15
to1.16
r644 r645 92 92 93 93 /* This function handles both _System and _Optlink attributes */ 94 extern tree ix86_handle_vacpp_attribute PARAMS ((tree *, tree, tree, int, _Bool *));94 extern tree emx_handle_vacpp_attribute PARAMS ((tree *, tree, tree, int, _Bool *)); 95 95 96 96 /* We want the _System attribute */ 97 97 #define TARGET_SYSTEM_DECL_ATTRIBUTES 98 #define ix86_handle_system_attribute ix86_handle_vacpp_attribute98 #define ix86_handle_system_attribute emx_handle_vacpp_attribute 99 99 100 100 /* We want the _Optlink attribute */ 101 101 #define TARGET_OPTLINK_DECL_ATTRIBUTES 102 #define ix86_handle_optlink_attribute ix86_handle_vacpp_attribute 102 #define ix86_handle_optlink_attribute emx_handle_vacpp_attribute 103 104 /* Do our own mangling on some kinds of decls */ 105 extern int emx_c_set_decl_assembler_name PARAMS ((tree)); 106 #define TARGET_C_SET_DECL_ASSEMBLER_NAME(decl) \ 107 emx_c_set_decl_assembler_name (decl) 108 #define TARGET_CXX_SET_DECL_ASSEMBLER_NAME(decl) \ 109 (DECL_LANG_SPECIFIC(decl) && DECL_FUNCTION_MEMBER_P (decl) ? 0 : \ 110 emx_c_set_decl_assembler_name (decl)) 103 111 104 112 /* This macros will stick a label to exception table for current file, … … 183 191 *******************************************************************/ 184 192 185 /* Define this macro if references to a symbol must be treated 186 differently depending on something about the variable or 187 function named by the symbol (such as what section it is in). */ 188 #undef ENCODE_SECTION_INFO 189 #define ENCODE_SECTION_INFO(DECL) emx_encode_section_info (DECL) 190 extern void emx_encode_section_info PARAMS ((tree)); 191 192 /* This macro gets just the user-specified name 193 out of the string in a SYMBOL_REF. Discard 194 trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ 193 /* This macro gets just the user-specified name out of the string 194 in a SYMBOL_REF. Discard trailing @[NUM] encoded by ENCODE_SECTION_INFO. 195 This is used to generate unique section names from function names 196 (if -ffunction-sections is given). */ 195 197 #undef STRIP_NAME_ENCODING 196 198 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/i386.c
-
Property cvs2svn:cvs-rev
changed from
1.9
to1.10
r644 r645 1288 1288 #ifdef TARGET_SYSTEM_DECL_ATTRIBUTES 1289 1289 /* System says the function is extern "C" and is not underscored. */ 1290 { "system", 0, 0, false, false, false,ix86_handle_system_attribute },1290 { "system", 0, 0, false, true, true, ix86_handle_system_attribute }, 1291 1291 #endif 1292 1292 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 1293 1293 /* Optlink is like regparm with a few differences */ 1294 { "optlink", 0, 0, false, false, false,ix86_handle_optlink_attribute },1294 { "optlink", 0, 0, false, true, true, ix86_handle_optlink_attribute }, 1295 1295 #endif 1296 1296 { NULL, 0, 0, false, false, false, NULL } … … 1739 1739 { 1740 1740 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 1741 /* Count conforming arguments for optlink */ 1742 int cfarg_count = 0; 1741 if (cum->optlink) 1742 { 1743 /* Only arguments until the ellipsis are passed in registers. Count them. */ 1744 cum->nregs = 0; 1745 cum->fpu_nregs = 0; 1746 /* The total size of arguments passed in registers can be up to 12 dwords. 1747 Float types count for their real size (e.g. float for 1 dword, double 1748 for 2 dwords, long double for 4 dwords). */ 1749 cum->ec_slots = 12; 1750 } 1743 1751 #endif 1744 1745 1752 for (param = (fntype) ? TYPE_ARG_TYPES (fntype) : 0; 1746 1753 param != 0; param = next_param) 1747 1754 { 1748 1755 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 1749 if (INTEGRAL_TYPE_P (TREE_VALUE (param)) 1750 || POINTER_TYPE_P (TREE_VALUE (param))) 1751 cfarg_count++; 1756 if (cum->optlink) 1757 if (INTEGRAL_TYPE_P (TREE_VALUE (param)) 1758 || POINTER_TYPE_P (TREE_VALUE (param))) 1759 cum->nregs++; 1760 else if (TREE_CODE (TREE_VALUE (param)) == REAL_TYPE) 1761 cum->fpu_nregs++; 1752 1762 #endif 1753 1763 next_param = TREE_CHAIN (param); … … 1755 1765 { 1756 1766 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 1757 /* Visual Age docs says that the params preceeding the 1758 ellipsis still are passed in registers. */ 1759 if (cum->optlink) 1760 cum->nregs = cfarg_count > 3 ? 3 : cfarg_count; 1761 else 1767 /* _Optlink calling convention says all args until the ellipsis 1768 are passed in registers, and all varargs on the stack. */ 1769 if (!cum->optlink) 1762 1770 #endif 1763 1771 if (!TARGET_64BIT) … … 1766 1774 } 1767 1775 } 1776 1777 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 1778 /* Limit number of registers to pass arguments as in _Optlink specification */ 1779 if (cum->optlink) 1780 { 1781 if (cum->nregs > 3) 1782 cum->nregs = 3; 1783 if (cum->fpu_nregs > 4) 1784 cum->fpu_nregs = 4; 1785 } 1786 #endif 1768 1787 } 1769 1788 if ((!fntype && !libname) … … 2324 2343 else 2325 2344 { 2326 if (TARGET_SSE && mode == TImode) 2345 if (TARGET_SSE && mode == TImode 2346 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 2347 && !cum->optlink 2348 #endif 2349 ) 2327 2350 { 2328 2351 cum->sse_words += words; … … 2341 2364 /* Optlink functions never pass aggregates in registers 2342 2365 (they are pushed on the stack, and the registers are 2343 preserved for following parameters). Unfortunately GCC 2344 optimizes short structures to SImode or DImode, thus 2345 this detection works only for large structs. */ 2346 if (cum->optlink 2347 && !(INTEGRAL_TYPE_P (type) 2348 || POINTER_TYPE_P (type))) 2349 return; 2366 preserved for following parameters). */ 2367 if (cum->optlink) 2368 { 2369 /* If out of eyecatcher slots, do nothing */ 2370 if (!cum->ec_slots) 2371 return; 2372 2373 if (INTEGRAL_TYPE_P (type) 2374 || POINTER_TYPE_P (type)) 2375 { 2376 /* Integer types takes one slot in eyecatcher */ 2377 cum->ec_slots--; 2378 } 2379 else if (TREE_CODE (type) == REAL_TYPE) 2380 { 2381 /* Fixed-point parameters are passed in FPU registers */ 2382 if (cum->fpu_nregs) 2383 { 2384 cum->fpu_nregs--; 2385 cum->fpu_regno++; 2386 regstack_first_undef_reg = FIRST_FLOAT_REG + cum->fpu_regno; 2387 /* Args passed in FPU stack takes one eyecatcher slot */ 2388 cum->ec_slots--; 2389 } 2390 else 2391 { 2392 /* FPU args passed on RT stack takes 1/2/4 slots */ 2393 cum->ec_slots -= words; 2394 } 2395 2396 /* The case with ec_slots <= 0 will be catched a little lates */ 2397 if (cum->ec_slots > 0) 2398 return; 2399 } 2400 else 2401 { 2402 /* This is nor a integer, address or float parameter. 2403 Pass it on the stack but count its size in eyecatcher. */ 2404 cum->ec_slots -= words; 2405 if (cum->ec_slots > 0) 2406 return; 2407 } 2408 2409 /* If we're out of eyecatcher slots, pass the arg on the stack */ 2410 if (cum->ec_slots <= 0) 2411 { 2412 cum->ec_slots = 0; 2413 cum->nregs = 0; 2414 cum->fpu_nregs = 0; 2415 return; 2416 } 2417 } 2350 2418 #endif 2351 2419 cum->nregs -= words; … … 2406 2474 cum->sse_regno); 2407 2475 else 2408 switch (mode) 2409 { 2410 /* For now, pass fp/complex values on the stack. */ 2411 default: 2412 break; 2413 2414 case BLKmode: 2476 { 2415 2477 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 2416 if (cum->optlink) 2417 break; 2418 /* fall through */ 2478 /* For optlink calling convention, don't pass anything other than 2479 integral types and floats through registers. */ 2480 if (!cum->optlink 2481 || INTEGRAL_TYPE_P (type) 2482 || POINTER_TYPE_P (type) 2483 || (TREE_CODE (type) == REAL_TYPE)) 2419 2484 #endif 2420 case DImode: 2421 case SImode: 2422 case HImode: 2423 case QImode: 2424 if (words <= cum->nregs) 2485 switch (mode) 2486 { 2487 /* For now, pass fp/complex values on the stack. */ 2488 default: 2489 break; 2490 2491 #if defined TARGET_OPTLINK_DECL_ATTRIBUTES && defined NOT_WORKING_YET 2492 case QFmode: 2493 case HFmode: 2494 case TQFmode: 2495 case SFmode: 2496 case DFmode: 2497 case XFmode: 2498 case TFmode: 2499 if (cum->fpu_nregs && cum->optlink && cum->ec_slots) 2500 { 2501 /* Pass first four floating-point args in FPU registers */ 2502 ret = gen_rtx (PARALLEL, mode, rtvec_alloc (2)); 2503 XVECEXP (ret, 0, 0) = gen_rtx (EXPR_LIST, VOIDmode, 2504 NULL_RTX, const0_rtx); 2505 XVECEXP (ret, 0, 1) = gen_rtx (EXPR_LIST, VOIDmode, 2506 gen_rtx (REG, mode, FIRST_FLOAT_REG + cum->fpu_regno), 2507 const0_rtx); 2508 } 2509 break; 2510 #endif 2511 2512 case BLKmode: 2513 case DImode: 2514 case SImode: 2515 case HImode: 2516 case QImode: 2517 if (words <= cum->nregs) 2425 2518 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 2426 /* Optlink specs says that the parameter is passed in a register2427 and space on the stack is reserved for it as well (which is not2428 filled). Currently GCC will pass the parameter *both* in register2429 and stack; this is suboptimal but is compatible. */2430 2519 if (cum->optlink) 2431 2520 { 2432 ret = gen_rtx (PARALLEL, mode, rtvec_alloc (2)); 2433 XVECEXP (ret, 0, 0) = gen_rtx (EXPR_LIST, VOIDmode, 2434 NULL_RTX, const0_rtx); 2435 XVECEXP (ret, 0, 1) = gen_rtx (EXPR_LIST, VOIDmode, 2436 gen_rtx (REG, mode, cum->regno), 2437 const0_rtx); 2521 if (cum->ec_slots) 2522 { 2523 /* Optlink specs says that the parameter is passed in a register 2524 and space on the stack is reserved for it as well (which is not 2525 filled). Currently GCC will pass the parameter *both* in register 2526 and stack; this is suboptimal but is compatible. */ 2527 ret = gen_rtx (PARALLEL, mode, rtvec_alloc (2)); 2528 XVECEXP (ret, 0, 0) = gen_rtx (EXPR_LIST, VOIDmode, 2529 NULL_RTX, const0_rtx); 2530 XVECEXP (ret, 0, 1) = gen_rtx (EXPR_LIST, VOIDmode, 2531 gen_rtx (REG, mode, cum->regno), 2532 const0_rtx); 2533 } 2438 2534 } 2439 2535 else 2440 2536 #endif 2441 ret = gen_rtx_REG (mode, cum->regno);2537 ret = gen_rtx_REG (mode, cum->regno); 2442 2538 break; 2443 case TImode:2539 case TImode: 2444 2540 if (cum->sse_nregs) 2445 2541 ret = gen_rtx_REG (mode, cum->sse_regno); 2446 2542 break; 2447 } 2543 } 2544 } 2448 2545 2449 2546 if (TARGET_DEBUG_ARG) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/i386.h
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r644 r645 1692 1692 int maybe_vaarg; /* true for calls to possibly vardic fncts. */ 1693 1693 #ifdef EMX 1694 int optlink; /* nonzero if optlink (vs. regparm) */ 1694 int fpu_regno; /* next available FPU register number */ 1695 int fpu_nregs; /* # registers available for passing */ 1696 int ec_slots; /* # eyecatcher slots left (see optlink specs) */ 1697 int optlink; /* nonzero if optlink (vs. regparm) */ 1695 1698 #endif /* EMX */ 1696 1699 } CUMULATIVE_ARGS; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/cp/except.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r644 r645 806 806 807 807 id = DECL_ASSEMBLER_NAME (fn); 808 #ifdef EMX 808 #ifdef TARGET_CXX_SET_DECL_ASSEMBLER_NAME 809 /* Actually the above is a bug. We can't mangle correctly unless we 810 have a complete decl. Until then, as a partial fix, reset the 811 mangled name to NULL so that next DECL_ASSEMBLER_NAME calls 812 mangler again, now with a complete decl. */ 809 813 SET_DECL_ASSEMBLER_NAME(fn, NULL_TREE); 810 814 #endif -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/cp/mangle.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r644 r645 73 73 # define MANGLE_TRACE(FN, INPUT) 74 74 # define MANGLE_TRACE_TREE(FN, NODE) 75 #endif 76 77 /* Provide a dummy target-specific name mangling hook */ 78 #ifndef TARGET_CXX_SET_DECL_ASSEMBLER_NAME 79 #define TARGET_CXX_SET_DECL_ASSEMBLER_NAME(decl) 0 75 80 #endif 76 81 … … 2272 2277 tree decl; 2273 2278 { 2274 tree id = get_identifier (mangle_decl_string (decl)); 2275 2276 SET_DECL_ASSEMBLER_NAME (decl, id); 2279 tree id; 2280 2281 if (!TARGET_CXX_SET_DECL_ASSEMBLER_NAME (decl)) 2282 { 2283 id = get_identifier (mangle_decl_string (decl)); 2284 2285 SET_DECL_ASSEMBLER_NAME (decl, id); 2286 } 2277 2287 } 2278 2288 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/reg-stack.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r644 r645 232 232 /* Used to initialize uninitialized registers. */ 233 233 static rtx nan; 234 235 /* The first undefined stack register at the beginning of this function. 236 This variable is set from machine-dependent code when placing certain 237 function arguments in stack registers at function entry, in this case 238 the variable is set to first stack register that has undefined contents 239 at the beginning of function. */ 240 int regstack_first_undef_reg = FIRST_STACK_REG; 234 241 235 242 /* Forward declarations */ … … 2440 2447 int reg, top = -1; 2441 2448 2442 for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; --reg)2449 for (reg = LAST_STACK_REG; reg >= regstack_first_undef_reg; --reg) 2443 2450 if (TEST_HARD_REG_BIT (bi->stack_in.reg_set, reg)) 2444 2451 { … … 2447 2454 bi->stack_in.reg[++top] = reg; 2448 2455 2449 2450 2451 2452 2453 2456 init = gen_rtx_SET (VOIDmode, 2457 FP_MODE_REG (FIRST_STACK_REG, SFmode), 2458 nan); 2459 insert_insn_on_edge (init, e); 2460 inserted = 1; 2454 2461 } 2455 2462 2463 /* All registers that are valid on function entry should be 2464 marked as such. ??? Possibly we should do it in flow.c ??? */ 2465 for (reg = regstack_first_undef_reg - 1; reg >= FIRST_STACK_REG; --reg) 2466 { 2467 bi->stack_in.reg[++top] = reg; 2468 } 2469 2470 /* At the start of next block we cannot assume anything about 2471 stack register contents. */ 2472 regstack_first_undef_reg = FIRST_STACK_REG; 2456 2473 bi->stack_in.top = top; 2457 2474 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/rtl.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r644 r645 2007 2007 /* In reg-stack.c */ 2008 2008 #ifdef BUFSIZ 2009 extern int regstack_first_undef_reg; 2009 2010 extern void reg_to_stack PARAMS ((rtx, FILE *)); 2010 2011 #endif -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/tree.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r644 r645 47 47 #include "target.h" 48 48 #include "langhooks.h" 49 50 /* Provide a dummy target-specific name mangling hook */ 51 #ifndef TARGET_C_SET_DECL_ASSEMBLER_NAME 52 #define TARGET_C_SET_DECL_ASSEMBLER_NAME(decl) 0 53 #endif 49 54 50 55 #define obstack_chunk_alloc xmalloc … … 206 211 || DECL_EXTERNAL (decl) 207 212 || TREE_PUBLIC (decl)))) 208 /* By default, assume the name to use in assembly code is the 209 same as that used in the source language. (That's correct 210 for C, and GCC used to set DECL_ASSEMBLER_NAME to the same 211 value as DECL_NAME in build_decl, so this choice provides 212 backwards compatibility with existing front-ends. */ 213 SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl)); 213 { 214 /* Some targets may want to apply special mangling depending 215 on certain attributes etc (e.g. stdcall). */ 216 if (!TARGET_C_SET_DECL_ASSEMBLER_NAME (decl)) 217 /* By default, assume the name to use in assembly code is the 218 same as that used in the source language. (That's correct 219 for C, and GCC used to set DECL_ASSEMBLER_NAME to the same 220 value as DECL_NAME in build_decl, so this choice provides 221 backwards compatibility with existing front-ends. */ 222 SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl)); 223 } 214 224 else 215 225 /* Nobody should ever be asking for the DECL_ASSEMBLER_NAME of -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.