Changeset 2249 for trunk


Ignore:
Timestamp:
Jul 15, 2005, 7:03:45 AM (20 years ago)
Author:
bird
Message:

more tracking and dumping.

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.30 to 1.31
    r2248 r2249  
    4242
    4343#ifdef BIRD_DEBUG
    44 static const char *code(node)
    45     tree node;
     44static const char *code(tree node)
    4645{
    4746    if (node)
     
    4948        switch (TREE_CODE (node))
    5049        {
    51             case FUNCTION_TYPE: return "FUNCTION_TYPE";
    52             case FUNCTION_DECL: return "FUNCTION_DECL";
    53             case METHOD_TYPE:   return "METHOD_TYPE";
    54             case FIELD_DECL:    return "FIELD_DECL";
    55             case TYPE_DECL:     return "TYPE_DECL";
    56             case VAR_DECL:      return "VAR_DECL";
    57             case PARM_DECL:     return "PARM_DECL";
    58             case RESULT_DECL:   return "RESULT_DECL";
    59             case CONST_DECL:    return "CONST_DECL";
    60             case POINTER_TYPE:  return "POINTER_TYPE";
    61             case VOID_TYPE:     return "VOID_TYPE";
    62             case INTEGER_TYPE:  return "INTEGER_TYPE";
    63             case CHAR_TYPE:     return "CHAR_TYPE";
    64             case SET_TYPE:      return "SET_TYPE";
    65             case ARRAY_TYPE:    return "ARRAY_TYPE";
    66             case RECORD_TYPE:   return "RECORD_TYPE";
    67             case QUAL_UNION_TYPE:  return "QUAL_UNION_TYPE";
    68             case UNION_TYPE:    return "UNION_TYPE";
     50            case IDENTIFIER_NODE:   return "IDENTIFIER_NODE";
     51            case TREE_LIST:         return "TREE_LIST      ";
     52            case TREE_VEC:          return "TREE_VEC       ";
     53            case BLOCK:             return "BLOCK          ";
     54            case FUNCTION_TYPE:     return "FUNCTION_TYPE  ";
     55            case FUNCTION_DECL:     return "FUNCTION_DECL  ";
     56            case METHOD_TYPE:       return "METHOD_TYPE    ";
     57            case FIELD_DECL:        return "FIELD_DECL     ";
     58            case TYPE_DECL:         return "TYPE_DECL      ";
     59            case VAR_DECL:          return "VAR_DECL       ";
     60            case PARM_DECL:         return "PARM_DECL      ";
     61            case RESULT_DECL:       return "RESULT_DECL    ";
     62            case CONST_DECL:        return "CONST_DECL     ";
     63            case POINTER_TYPE:      return "POINTER_TYPE   ";
     64            case VOID_TYPE:         return "VOID_TYPE      ";
     65            case INTEGER_TYPE:      return "INTEGER_TYPE   ";
     66            case CHAR_TYPE:         return "CHAR_TYPE      ";
     67            case BOOLEAN_TYPE:      return "BOOLEAN_TYPE   ";
     68            case SET_TYPE:          return "SET_TYPE       ";
     69            case ARRAY_TYPE:        return "ARRAY_TYPE     ";
     70            case RECORD_TYPE:       return "RECORD_TYPE    ";
     71            case QUAL_UNION_TYPE:   return "QUAL_UNION_TYPE";
     72            case UNION_TYPE:        return "UNION_TYPE     ";
     73            case INTEGER_CST:       return "INTEGER_CST    ";
    6974            default:
    7075                break;
     
    7883    tree node;
    7984{
    80     static const char *apsz[] = {"system", "optlink", "stdcall"};
     85    static const char *apsz[] = {"system", "optlink", "stdcall", "cdecl", "dllimport", "dllexport"};
    8186    static const char *psznone = "none";
    8287    static const char *pszdefault = "default";
     
    98103}
    99104
    100 void birddump (node)
    101     tree node;
    102 {
    103     tree type, type2, context, name;
     105void birddump (tree node, const char *pszFunction)
     106{
     107    tree type, type2, context, name, tname;
    104108    if (!node)
    105109        return;
    106110
     111    name = DECL_P (node) ? DECL_NAME (node) : TYPE_P (node) ? TYPE_NAME (node) : NULL_TREE;
    107112    type = TREE_TYPE (node);
    108     type2 = type ? TREE_TYPE(type) : NULL;
     113    tname = type ? TYPE_NAME (type) : NULL_TREE;
     114    type2 = type ? TREE_TYPE(type) : NULL_TREE;
    109115    context = DECL_P (node) ? DECL_CONTEXT (node) : NULL_TREE;
    110     name = DECL_P (node) ? DECL_NAME (node) : NULL_TREE;
    111 
    112     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",
    113             TREE_CODE(node), code(node), (void*)node, birddump_callingconv(node),
    114             type ? (int)TREE_CODE(type) : -1, code(type), (void*)type, birddump_callingconv(type),
     116
     117    fprintf(stderr, "dbg: node=%d %s %p %s '%s'  type=%d %s %p %s '%s'  type_type=%d %s %p %s  context=%d %s %p %s (%s)\n",
     118            TREE_CODE(node), code(node), (void*)node, birddump_callingconv(node), name ? IDENTIFIER_POINTER (name) : "<none>",
     119            type ? (int)TREE_CODE(type) : -1, code(type), (void*)type, birddump_callingconv(type), tname ? IDENTIFIER_POINTER (tname) : "<none>",
    115120            type2 ? (int)TREE_CODE(type2) : -1, code(type2), (void*)type2, birddump_callingconv(type2),
    116             context ? (int)TREE_CODE(context) : -1, code(context), (void*)context,
    117             name ? IDENTIFIER_POINTER (name) : "<none>");
     121            context ? (int)TREE_CODE(context) : -1, code(context), (void*)context, birddump_callingconv(context),
     122            pszFunction);
    118123}
    119124
    120125#define dfprintf(a) fprintf a
    121 #define DUMP(node) birddump(node)
     126#define DUMP(node) birddump(node, __FUNCTION__)
    122127#else
    123128#define dfprintf(a) do {} while (0)
     
    136141  int rc = 1;
    137142
    138   /*
    139143  dfprintf((stderr, "emx_c_set_decl_assembler_name\n"));
    140144  DUMP(decl);
    141   */
    142145
    143146  /* Sometimes we recursively call DECL_ASSEMBLER_NAME to apply the default
     
    306309  tree type;
    307310
    308   dfprintf((stderr, "emx_handle_vacpp_attribute: node=%p\n", node));
     311  dfprintf((stderr, "emx_handle_vacpp_attribute: node=%p\n", (void *)node));
    309312  DUMP (*node);
    310313
     
    440443    tree type, fntype;
    441444{
     445  dfprintf ((stderr, "trace: emx_return_in_memory_with_fntype\n"));
    442446  /* (from aggregate_value_p() CVS trunk) */
    443447  if (fntype)
     
    483487    const char *str;
    484488{
     489  dfprintf ((stderr, "trace: i386_emx_strip_name_encoding(%s)\n", str));
    485490  if (*str == DLL_IMPORT_EXPORT_PREFIX)
    486491    str += 3;
     
    498503{
    499504  const char *p;
     505  const char *ret;
    500506  const char *name = i386_emx_strip_name_encoding (str);
    501507
    502508  p = strchr (name, '@');
    503509  if (p)
    504     return ggc_alloc_string (name, p - name);
    505 
    506   return name;
     510    ret = ggc_alloc_string (name, p - name);
     511  else
     512    ret = name;
     513  dfprintf ((stderr, "trace: emx_strip_name_encoding_full: '%s' -> '%s'\n", str, ret));
     514  return ret;
    507515}
    508516
     
    528536{
    529537  tree node = *pnode;
     538  dfprintf((stderr, "trace: ix86_handle_dll_attribute\n"));
     539  DUMP (node);
    530540
    531541  /* These attributes may apply to structure and union types being created,
     
    604614     bool *no_add_attrs;
    605615{
     616  dfprintf ((stderr, "trace: ix86_handle_shared_attribute\n"));
     617  DUMP (*node);
    606618  if (TREE_CODE (*node) != VAR_DECL)
    607619    {
     
    658670  if (associated_type (decl))
    659671    {
     672      DUMP (associated_type (decl));
     673      DUMP (decl);
    660674      exp = lookup_attribute ("dllexport",
    661675                              TYPE_ATTRIBUTES (associated_type (decl)));
     
    747761
    748762int
    749 i386_emx_dllexport_name_p (symbol)
    750      const char *symbol;
    751 {
     763i386_emx_dllexport_name_p (const char *symbol EMX_DBG_LOC_DECL)
     764{
     765  dfprintf ((stderr,
     766             "trace: i386_emx_dllexport_name_p: %s %s(%d)\n"
     767             "           symbol=%s\n", EMX_DBG_LOC_RARGS, symbol));
    752768  return symbol[0] == DLL_IMPORT_EXPORT_PREFIX
    753769         && symbol[1] == 'e' && symbol[2] == '.';
     
    757773
    758774int
    759 i386_emx_dllimport_name_p (symbol)
    760      const char *symbol;
    761 {
     775i386_emx_dllimport_name_p (const char *symbol EMX_DBG_LOC_DECL)
     776{
     777  dfprintf ((stderr,
     778             "trace: i386_emx_dllimport_name_p: %s %s(%d)\n"
     779             "           symbol='%s'\n", EMX_DBG_LOC_RARGS, symbol));
    762780  return symbol[0] == DLL_IMPORT_EXPORT_PREFIX
    763781         && symbol[1] == 'i' && symbol[2] == '.';
     
    775793  rtx rtlname;
    776794  tree idp;
     795  dfprintf ((stderr, "trace: i386_emx_mark_dllexport\n"));
     796  DUMP (decl);
    777797
    778798  rtlname = XEXP (DECL_RTL (decl), 0);
     
    784804  else
    785805    abort ();
    786   if (i386_emx_dllimport_name_p (oldname))
     806  if (i386_emx_dllimport_name_p (oldname EMX_DBG_LOC_INARGS))
    787807    {
    788808      warning_with_decl (decl,"inconsistent dll linkage for '%s': dllexport assumed.");
     
    791811      DECL_NON_ADDR_CONST_P (decl) = 0;
    792812    }
    793   else if (i386_emx_dllexport_name_p (oldname))
     813  else if (i386_emx_dllexport_name_p (oldname EMX_DBG_LOC_INARGS))
    794814    return; /* already done */
    795815
     
    817837  tree idp;
    818838  rtx rtlname, newrtl;
     839  dfprintf ((stderr, "trace: i386_emx_mark_dllimport\n"));
    819840
    820841  rtlname = XEXP (DECL_RTL (decl), 0);
     
    826847  else
    827848    abort ();
    828   if (i386_emx_dllexport_name_p (oldname))
     849  if (i386_emx_dllexport_name_p (oldname EMX_DBG_LOC_INARGS))
    829850    {
    830851      error ("`%s' declared as both exported to and imported from a DLL",
     
    832853      return;
    833854    }
    834   else if (i386_emx_dllimport_name_p (oldname))
     855  else if (i386_emx_dllimport_name_p (oldname EMX_DBG_LOC_INARGS))
    835856    {
    836857      /* Already done, but do a sanity check to prevent assembler errors. */
     
    866887   arguments */
    867888
    868 static const char *
     889const char *
    869890gen_stdcall_suffix (decl)
    870891  tree decl;
     
    906927     int first ATTRIBUTE_UNUSED;
    907928{
     929  dfprintf ((stderr, "trace: i386_emx_encode_section_info\n"));
     930  DUMP (decl);
     931
    908932  /* This bit is copied from i386.h.  */
    909933  if (optimize > 0 && TREE_CONSTANT (decl)
     
    941965           && GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM
    942966           && GET_CODE (XEXP (XEXP (DECL_RTL (decl), 0), 0)) == SYMBOL_REF
    943            && i386_emx_dllimport_name_p (XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0)))
     967           && i386_emx_dllimport_name_p (XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0)  EMX_DBG_LOC_INARGS))
    944968    {
    945969      const char *oldname = XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0);
     
    10141038
    10151039void
    1016 i386_emx_record_exported_symbol (decl, name, is_data)
    1017     tree decl;
    1018      const char *name;
    1019      int is_data;
     1040i386_emx_record_exported_symbol (tree decl, const char *name, int is_data EMX_DBG_LOC_DECL)
    10201041{
    10211042  struct export_list *p;
    1022   DUMP(decl);
     1043  dfprintf ((stderr,
     1044             "trace: i386_emx_record_exported_symbol: %s %s(%d)\n"
     1045             "           name='%s' is_data=%d\n", EMX_DBG_LOC_RARGS, name, is_data));
     1046  DUMP (decl);
    10231047
    10241048  p = (struct export_list *) xmalloc (sizeof *p);
     
    10721096              DUMP(decl);
    10731097              if (!TREE_STATIC (decl))
    1074                 continue;
     1098                {
     1099                  dfprintf ((stderr, "dbg: skipping %p. !TREE_STATIC\n", decl));
     1100                  continue;
     1101                }
    10751102              if (!q->asm_name)
    10761103                q->asm_name = q->exported_name ? q->exported_name
  • trunk/src/gcc/gcc/config/i386/emx.h

    • Property cvs2svn:cvs-rev changed from 1.37 to 1.38
    r2248 r2249  
    210210#define TARGET_ENCODE_SECTION_INFO  i386_emx_encode_section_info
    211211
     212#if 0 /* useful for hacking declspec attributes */
     213#define EMX_DBG_LOC_DECL , const char *function,  const char *file, unsigned line
     214#define EMX_DBG_LOC_INARGS , __FUNCTION__, __FILE__, __LINE__
     215#define EMX_DBG_LOC_RARGS function, file, line
     216#else
     217#define EMX_DBG_LOC_DECL
     218#define EMX_DBG_LOC_INARGS
     219#define EMX_DBG_LOC_RARGS "", "", 0
     220#endif
     221
     222
    212223/* Output a common block.  */
    213224#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
    214225#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \
    215226do {                                                    \
    216   if (i386_emx_dllexport_name_p (NAME))                 \
    217     i386_emx_record_exported_symbol (DECL, NAME, 1);    \
    218   if (! i386_emx_dllimport_name_p (NAME))               \
     227  if (i386_emx_dllexport_name_p (NAME EMX_DBG_LOC_INARGS))                      \
     228    i386_emx_record_exported_symbol (DECL, NAME, 1 EMX_DBG_LOC_INARGS); \
     229  if (! i386_emx_dllimport_name_p (NAME EMX_DBG_LOC_INARGS))            \
    219230    {                                                   \
    220231      /* 16 is the best we can do (segment para). */    \
     
    232243#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)     \
    233244do {                                                    \
    234   if (i386_emx_dllexport_name_p (NAME))                 \
    235     i386_emx_record_exported_symbol (DECL, NAME, 1);    \
     245  if (i386_emx_dllexport_name_p (NAME EMX_DBG_LOC_INARGS)) \
     246    i386_emx_record_exported_symbol (DECL, NAME, 1 EMX_DBG_LOC_INARGS); \
    236247  ASM_OUTPUT_LABEL ((STREAM), (NAME));                  \
    237248} while (0)
     
    242253  do                                                                    \
    243254    {                                                                   \
    244       if (i386_emx_dllexport_name_p (NAME))                             \
    245         i386_emx_record_exported_symbol (DECL, NAME, 0);                \
     255      if (i386_emx_dllexport_name_p (NAME EMX_DBG_LOC_INARGS))          \
     256        i386_emx_record_exported_symbol (DECL, NAME, 0 EMX_DBG_LOC_INARGS); \
    246257      ASM_OUTPUT_LABEL (FILE, NAME);                                    \
    247258    }                                                                   \
     
    282293
    283294/* These functions are for handling dllexport and dllimport. */
    284 extern void i386_emx_record_exported_symbol PARAMS ((tree, const char *, int));
     295extern void i386_emx_record_exported_symbol PARAMS ((tree, const char *, int EMX_DBG_LOC_DECL));
    285296extern void i386_emx_asm_file_end PARAMS ((FILE *));
    286 extern int i386_emx_dllexport_name_p PARAMS ((const char *));
    287 extern int i386_emx_dllimport_name_p PARAMS ((const char *));
     297extern int i386_emx_dllexport_name_p PARAMS ((const char * EMX_DBG_LOC_DECL));
     298extern int i386_emx_dllimport_name_p PARAMS ((const char * EMX_DBG_LOC_DECL));
    288299extern void i386_emx_encode_section_info PARAMS ((tree, int));
    289300
Note: See TracChangeset for help on using the changeset viewer.