- Timestamp:
- Jul 15, 2005, 7:03:45 AM (20 years ago)
- 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
to1.31
r2248 r2249 42 42 43 43 #ifdef BIRD_DEBUG 44 static const char *code(node) 45 tree node; 44 static const char *code(tree node) 46 45 { 47 46 if (node) … … 49 48 switch (TREE_CODE (node)) 50 49 { 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 "; 69 74 default: 70 75 break; … … 78 83 tree node; 79 84 { 80 static const char *apsz[] = {"system", "optlink", "stdcall" };85 static const char *apsz[] = {"system", "optlink", "stdcall", "cdecl", "dllimport", "dllexport"}; 81 86 static const char *psznone = "none"; 82 87 static const char *pszdefault = "default"; … … 98 103 } 99 104 100 void birddump (node) 101 tree node; 102 { 103 tree type, type2, context, name; 105 void birddump (tree node, const char *pszFunction) 106 { 107 tree type, type2, context, name, tname; 104 108 if (!node) 105 109 return; 106 110 111 name = DECL_P (node) ? DECL_NAME (node) : TYPE_P (node) ? TYPE_NAME (node) : NULL_TREE; 107 112 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; 109 115 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>", 115 120 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); 118 123 } 119 124 120 125 #define dfprintf(a) fprintf a 121 #define DUMP(node) birddump(node )126 #define DUMP(node) birddump(node, __FUNCTION__) 122 127 #else 123 128 #define dfprintf(a) do {} while (0) … … 136 141 int rc = 1; 137 142 138 /*139 143 dfprintf((stderr, "emx_c_set_decl_assembler_name\n")); 140 144 DUMP(decl); 141 */142 145 143 146 /* Sometimes we recursively call DECL_ASSEMBLER_NAME to apply the default … … 306 309 tree type; 307 310 308 dfprintf((stderr, "emx_handle_vacpp_attribute: node=%p\n", node));311 dfprintf((stderr, "emx_handle_vacpp_attribute: node=%p\n", (void *)node)); 309 312 DUMP (*node); 310 313 … … 440 443 tree type, fntype; 441 444 { 445 dfprintf ((stderr, "trace: emx_return_in_memory_with_fntype\n")); 442 446 /* (from aggregate_value_p() CVS trunk) */ 443 447 if (fntype) … … 483 487 const char *str; 484 488 { 489 dfprintf ((stderr, "trace: i386_emx_strip_name_encoding(%s)\n", str)); 485 490 if (*str == DLL_IMPORT_EXPORT_PREFIX) 486 491 str += 3; … … 498 503 { 499 504 const char *p; 505 const char *ret; 500 506 const char *name = i386_emx_strip_name_encoding (str); 501 507 502 508 p = strchr (name, '@'); 503 509 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; 507 515 } 508 516 … … 528 536 { 529 537 tree node = *pnode; 538 dfprintf((stderr, "trace: ix86_handle_dll_attribute\n")); 539 DUMP (node); 530 540 531 541 /* These attributes may apply to structure and union types being created, … … 604 614 bool *no_add_attrs; 605 615 { 616 dfprintf ((stderr, "trace: ix86_handle_shared_attribute\n")); 617 DUMP (*node); 606 618 if (TREE_CODE (*node) != VAR_DECL) 607 619 { … … 658 670 if (associated_type (decl)) 659 671 { 672 DUMP (associated_type (decl)); 673 DUMP (decl); 660 674 exp = lookup_attribute ("dllexport", 661 675 TYPE_ATTRIBUTES (associated_type (decl))); … … 747 761 748 762 int 749 i386_emx_dllexport_name_p (symbol) 750 const char *symbol; 751 { 763 i386_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)); 752 768 return symbol[0] == DLL_IMPORT_EXPORT_PREFIX 753 769 && symbol[1] == 'e' && symbol[2] == '.'; … … 757 773 758 774 int 759 i386_emx_dllimport_name_p (symbol) 760 const char *symbol; 761 { 775 i386_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)); 762 780 return symbol[0] == DLL_IMPORT_EXPORT_PREFIX 763 781 && symbol[1] == 'i' && symbol[2] == '.'; … … 775 793 rtx rtlname; 776 794 tree idp; 795 dfprintf ((stderr, "trace: i386_emx_mark_dllexport\n")); 796 DUMP (decl); 777 797 778 798 rtlname = XEXP (DECL_RTL (decl), 0); … … 784 804 else 785 805 abort (); 786 if (i386_emx_dllimport_name_p (oldname ))806 if (i386_emx_dllimport_name_p (oldname EMX_DBG_LOC_INARGS)) 787 807 { 788 808 warning_with_decl (decl,"inconsistent dll linkage for '%s': dllexport assumed."); … … 791 811 DECL_NON_ADDR_CONST_P (decl) = 0; 792 812 } 793 else if (i386_emx_dllexport_name_p (oldname ))813 else if (i386_emx_dllexport_name_p (oldname EMX_DBG_LOC_INARGS)) 794 814 return; /* already done */ 795 815 … … 817 837 tree idp; 818 838 rtx rtlname, newrtl; 839 dfprintf ((stderr, "trace: i386_emx_mark_dllimport\n")); 819 840 820 841 rtlname = XEXP (DECL_RTL (decl), 0); … … 826 847 else 827 848 abort (); 828 if (i386_emx_dllexport_name_p (oldname ))849 if (i386_emx_dllexport_name_p (oldname EMX_DBG_LOC_INARGS)) 829 850 { 830 851 error ("`%s' declared as both exported to and imported from a DLL", … … 832 853 return; 833 854 } 834 else if (i386_emx_dllimport_name_p (oldname ))855 else if (i386_emx_dllimport_name_p (oldname EMX_DBG_LOC_INARGS)) 835 856 { 836 857 /* Already done, but do a sanity check to prevent assembler errors. */ … … 866 887 arguments */ 867 888 868 staticconst char *889 const char * 869 890 gen_stdcall_suffix (decl) 870 891 tree decl; … … 906 927 int first ATTRIBUTE_UNUSED; 907 928 { 929 dfprintf ((stderr, "trace: i386_emx_encode_section_info\n")); 930 DUMP (decl); 931 908 932 /* This bit is copied from i386.h. */ 909 933 if (optimize > 0 && TREE_CONSTANT (decl) … … 941 965 && GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM 942 966 && 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)) 944 968 { 945 969 const char *oldname = XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0); … … 1014 1038 1015 1039 void 1016 i386_emx_record_exported_symbol (decl, name, is_data) 1017 tree decl; 1018 const char *name; 1019 int is_data; 1040 i386_emx_record_exported_symbol (tree decl, const char *name, int is_data EMX_DBG_LOC_DECL) 1020 1041 { 1021 1042 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); 1023 1047 1024 1048 p = (struct export_list *) xmalloc (sizeof *p); … … 1072 1096 DUMP(decl); 1073 1097 if (!TREE_STATIC (decl)) 1074 continue; 1098 { 1099 dfprintf ((stderr, "dbg: skipping %p. !TREE_STATIC\n", decl)); 1100 continue; 1101 } 1075 1102 if (!q->asm_name) 1076 1103 q->asm_name = q->exported_name ? q->exported_name -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/emx.h
-
Property cvs2svn:cvs-rev
changed from
1.37
to1.38
r2248 r2249 210 210 #define TARGET_ENCODE_SECTION_INFO i386_emx_encode_section_info 211 211 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 212 223 /* Output a common block. */ 213 224 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON 214 225 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \ 215 226 do { \ 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)) \ 219 230 { \ 220 231 /* 16 is the best we can do (segment para). */ \ … … 232 243 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ 233 244 do { \ 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); \ 236 247 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ 237 248 } while (0) … … 242 253 do \ 243 254 { \ 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); \ 246 257 ASM_OUTPUT_LABEL (FILE, NAME); \ 247 258 } \ … … 282 293 283 294 /* These functions are for handling dllexport and dllimport. */ 284 extern void i386_emx_record_exported_symbol PARAMS ((tree, const char *, int ));295 extern void i386_emx_record_exported_symbol PARAMS ((tree, const char *, int EMX_DBG_LOC_DECL)); 285 296 extern 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 * ));297 extern int i386_emx_dllexport_name_p PARAMS ((const char * EMX_DBG_LOC_DECL)); 298 extern int i386_emx_dllimport_name_p PARAMS ((const char * EMX_DBG_LOC_DECL)); 288 299 extern void i386_emx_encode_section_info PARAMS ((tree, int)); 289 300 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.