Changeset 666


Ignore:
Timestamp:
Sep 9, 2003, 1:17:27 AM (22 years ago)
Author:
bird
Message:

#572: Fixing calling conventions again... not 100 cleaned up yet.

Location:
trunk/src/gcc/gcc/config/i386
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gcc/gcc/config/i386/emx.c

    • Property cvs2svn:cvs-rev changed from 1.21 to 1.22
    r665 r666  
    3131#include "flags.h"
    3232#include "i386-protos.h"
     33
    3334
    3435/* The size of the target's pointer type.  */
     
    7273}
    7374
    74 static void dump (tree node);
    75 static void dump (tree node)
     75const char *birddump_callingconv(tree node);
     76const char *birddump_callingconv(tree node)
     77{
     78    static const char *apsz[] = {"system", "optlink", "stdcall"};
     79    static const char *psznone = "none";
     80    static const char *pszdefault = "default";
     81    tree        attr;
     82    unsigned    i;
     83
     84    if (!node)
     85        return psznone;
     86
     87    attr = (DECL_P (node) ? DECL_ATTRIBUTES (node) : TYPE_ATTRIBUTES (node));
     88    if (!attr)
     89        return pszdefault;
     90
     91    for (i = 0; i < sizeof(apsz) / sizeof(apsz[0]); i++)
     92        if (node && attr && lookup_attribute (apsz[i], attr))
     93            return apsz[i];
     94
     95    return pszdefault;
     96}
     97
     98void birddump (tree node);
     99void birddump (tree node)
    76100{
    77101    tree type, type2, context, name;
     
    83107    context = DECL_P (node) ? DECL_CONTEXT (node) : NULL_TREE;
    84108    name = DECL_P (node) ? DECL_NAME (node) : NULL_TREE;
    85     fprintf(stderr, "dbg: node=%d %s type=%d %s type_type=%d %s context=%d %s name=%s\n",
    86             TREE_CODE(node), code(node),
    87             type ? (int)TREE_CODE(type) : -1, code(type),
    88             type2 ? (int)TREE_CODE(type2) : -1, code(type2),
    89             context ? (int)TREE_CODE(context) : -1, code(context),
     109
     110    fprintf(stderr, "dbg: node=%d %s %p %s  type=%d %s %p %s  type_type=%d %s %p %s  context=%d %s %p  name=%s\n",
     111            TREE_CODE(node), code(node), (void*)node, birddump_callingconv(node),
     112            type ? (int)TREE_CODE(type) : -1, code(type), (void*)type, birddump_callingconv(type),
     113            type2 ? (int)TREE_CODE(type2) : -1, code(type2), (void*)type2, birddump_callingconv(type2),
     114            context ? (int)TREE_CODE(context) : -1, code(context), (void*)context,
    90115            name ? IDENTIFIER_POINTER (name) : "<none>");
    91116}
    92117
    93118#define dfprintf(a) fprintf a
    94 #define DUMP(node) dump(node)
     119#define DUMP(node) dump(node)
    95120#else
    96121#define dfprintf(a) do {} while (0)
     
    112137    return 0;
    113138
     139
     140
     141
     142
     143
     144
     145
    114146  recurse++;
    115 
    116147  type = TREE_TYPE (decl);
    117148
     
    205236}
    206237
     238
     239
     240
    207241tree emx_handle_vacpp_attribute (tree *node, tree name, tree args,
    208242  int flags, bool *no_add_attrs)
    209243{
     244
    210245  (void) args;
    211246  (void) flags;
    212247
     248
    213249  DUMP (*node);
    214250
     
    233269    return NULL_TREE;
    234270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
    235289  return NULL_TREE;
    236290}
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
    237391
    238392void
     
    265419  }
    266420}
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
  • trunk/src/gcc/gcc/config/i386/i386.c

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r665 r666  
    12731273{
    12741274  /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
     1275
     1276
     1277
     1278
     1279
     1280
     1281
    12751282  /* Stdcall attribute says callee is responsible for popping arguments
    12761283     if they are not variable.  */
     
    12781285  /* Cdecl attribute says the callee is a normal C declaration */
    12791286  { "cdecl",     0, 0, false, true,  true,  ix86_handle_cdecl_attribute },
     1287
    12801288  /* Regparm attribute specifies how many integer arguments are to be
    12811289     passed in registers.  */
     
    12861294  { "shared",    0, 0, true,  false, false, ix86_handle_shared_attribute },
    12871295#endif
     1296
     1297
     1298
     1299
     1300
     1301
     1302
     1303
     1304
     1305
    12881306#ifdef TARGET_SYSTEM_DECL_ATTRIBUTES
    12891307  /* System says the function is extern "C" and is not underscored. */
     
    12931311  /* Optlink is like regparm with a few differences */
    12941312  { "optlink",   0, 0, false, true,  true,  ix86_handle_optlink_attribute },
     1313
    12951314#endif
    12961315  { NULL,        0, 0, false, false, false, NULL }
     
    15581577  unsigned i, cc1 = 0, cc2 = 0;
    15591578
    1560   /* The following calling conventions have meaning only for functions */
    1561   if (TREE_CODE (type1) != FUNCTION_TYPE)
     1579  /* The following calling conventions have meaning only for functions,
     1580     methods and pointers to such. */
     1581  if (TREE_CODE (type1) == POINTER_TYPE)
     1582      type1 = TREE_TYPE(type1);
     1583  if (TREE_CODE (type2) == POINTER_TYPE)
     1584      type2 = TREE_TYPE(type2);
     1585  if (   TREE_CODE (type1) != FUNCTION_TYPE
     1586      && TREE_CODE (type1) != METHOD_TYPE
     1587      && TREE_CODE (type2) != FUNCTION_TYPE
     1588      && TREE_CODE (type2) != METHOD_TYPE)
    15621589    return 1;
    15631590
    1564 /*@@@todo: this doesn't work yet because of some bug somewhere inside gcc.
    1565 testcase for both C and C++:
    1566   void f (); static void (* _Optlink x) () = f;           <-- compiles ok
    1567 testcase for C++:
    1568   void _Optlink f (); static void (* _Optlink x) () = f;  <-- bad types
    1569 */
    1570 #if __ANNOYING_BUG_IN_GCC_IS_FINALLY_FIXED
    15711591  /* The function may have only one calling convention.
    15721592   * For simplicity we translate the calling conversion attribute
     
    15761596   * (e.g. issue a warning but allow the operation).
    15771597   */
    1578 
    15791598  for (i = 0; ix86_attribute_table [i].name; i++)
    15801599    if (ix86_attribute_codes [i] & IX86_ATTR_TYPE_CALLCONV)
     
    16011620  /* They are nearly compatible */
    16021621  return 2;
    1603 #else
    1604   return 1;
    1605 #endif
    16061622}
    16071623
Note: See TracChangeset for help on using the changeset viewer.