Changeset 597
- Timestamp:
- Aug 15, 2003, 3:42:47 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gcc/gcc/config/i386/emx.c
-
Property cvs2svn:cvs-rev
changed from
1.11
to1.12
r596 r597 35 35 #define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT) 36 36 #endif 37 #if 0 /* debug */38 const char *code(tree node)37 #ifdef BIRD_DEBUG 38 static const char *code(tree node) 39 39 { 40 40 if (node) … … 44 44 case FUNCTION_TYPE: return "FUNCTION_TYPE"; 45 45 case FUNCTION_DECL: return "FUNCTION_DECL"; 46 case METHOD_TYPE: return "METHOD_TYPE"; 47 case FIELD_DECL: return "FIELD_DECL"; 48 case TYPE_DECL: return "TYPE_DECL"; 49 case POINTER_TYPE: return "POINTER_TYPE"; 50 case VOID_TYPE: return "VOID_TYPE"; 51 case INTEGER_TYPE: return "INTEGER_TYPE"; 52 case CHAR_TYPE: return "CHAR_TYPE"; 53 case SET_TYPE: return "SET_TYPE"; 54 case ARRAY_TYPE: return "ARRAY_TYPE"; 55 case RECORD_TYPE: return "RECORD_TYPE"; 56 case QUAL_UNION_TYPE: return "QUAL_UNION_TYPE"; 57 case UNION_TYPE: return "UNION_TYPE"; 46 case METHOD_TYPE: return "METHOD_TYPE"; 47 case FIELD_DECL: return "FIELD_DECL"; 48 case TYPE_DECL: return "TYPE_DECL"; 49 case POINTER_TYPE: return "POINTER_TYPE"; 50 case VOID_TYPE: return "VOID_TYPE"; 51 case INTEGER_TYPE: return "INTEGER_TYPE"; 52 case CHAR_TYPE: return "CHAR_TYPE"; 53 case SET_TYPE: return "SET_TYPE"; 54 case ARRAY_TYPE: return "ARRAY_TYPE"; 55 case RECORD_TYPE: return "RECORD_TYPE"; 56 case QUAL_UNION_TYPE: return "QUAL_UNION_TYPE"; 57 case UNION_TYPE: return "UNION_TYPE"; 58 58 default: 59 59 break; … … 63 63 } 64 64 65 void dump (tree node); 65 66 void dump (tree node) 66 67 { 67 const char *psz = ""; 68 tree type = TREE_TYPE (node); 69 tree type2 = type ? TREE_TYPE(type) : NULL; 70 71 fprintf(stderr, "dbg: node=%d %s type=%d %s type_type=%d %s\n", 68 tree type, type2, context; 69 if (!node) 70 return; 71 72 type = TREE_TYPE (node); 73 type2 = type ? TREE_TYPE(type) : NULL; 74 context = DECL_P (node) ? DECL_CONTEXT (node) : NULL_TREE; 75 fprintf(stderr, "dbg: node=%d %s type=%d %s type_type=%d %s context=%d %s\n", 72 76 TREE_CODE(node), code(node), 73 77 type ? TREE_CODE(type) : -1, code(type), 74 type2 ? TREE_CODE(type2) : -1, code(type2)); 75 } 76 #endif 78 type2 ? TREE_CODE(type2) : -1, code(type2), 79 context ? TREE_CODE(context) : -1, code(context)); 80 } 81 82 #define dfprintf(a) fprintf a 83 #define DUMP(node) dump(node) 84 #else 85 #define dfprintf(a) do {} while (0) 86 #define DUMP(node) do {} while (0) 87 #endif 88 77 89 78 90 tree ix86_handle_system_attribute (tree *node, tree name, tree args, 79 91 int flags, bool *no_add_attrs) 80 92 { 81 tree type; 82 size_t sl; 83 const char *oldsym; 84 char *newsym; 85 93 tree type; 86 94 (void)args; (void)flags; 95 96 dfprintf ((stderr, "dbg: %s flags=%x\n", __FUNCTION__, flags)); 97 DUMP (*node); 87 98 88 99 type = TREE_TYPE (*node); … … 91 102 { 92 103 case FUNCTION_TYPE: 93 oldsym = IDENTIFIER_POINTER (DECL_NAME (*node)); 94 sl = strlen (oldsym); 95 newsym = xmalloc (sl + 2); 96 /* Specifying '*' as first symbol character tells gcc (see varasm.c, 97 function assemble_name()) to output the label as-is rather than 98 invoking the ASM_OUTPUT_LABELREF macro (which prepends a underscore) */ 99 newsym [0] = '*'; 100 memcpy (newsym + 1, oldsym, sl + 1); 101 SET_DECL_ASSEMBLER_NAME (*node, get_identifier (newsym)); 102 break; 104 { 105 tree context; 106 size_t sl; 107 const char * oldsym; 108 char * newsym; 109 110 /* typedef and field may end up here. they should not get their name changed! */ 111 if (TREE_CODE (*node) == FIELD_DECL | TREE_CODE (*node) == TYPE_DECL) 112 return NULL_TREE; 113 114 /* class method (static) ends up here too, they should be get their 115 name changed. Try check if context is RECORD_TYPE and pray that 116 means it's a class... 117 @todo: verify the class detection here! CLASSTYPE_DECLARED_CLASS? */ 118 context = DECL_CONTEXT (*node); 119 DUMP ((context)); 120 if (context && ( TREE_CODE (context) == RECORD_TYPE 121 || TREE_CODE (context) == UNION_TYPE)) 122 return NULL_TREE; 123 /** @todo more decl code checks? */ 124 125 126 /* _System mangling! 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 oldsym = IDENTIFIER_POINTER (DECL_NAME (*node)); 131 sl = strlen (oldsym); 132 newsym = xmalloc (sl + 2); 133 newsym [0] = '*'; 134 memcpy (newsym + 1, oldsym, sl + 1); 135 SET_DECL_ASSEMBLER_NAME (*node, get_identifier (newsym)); 136 dfprintf((stderr, "dbg: name change: %s -> %s\n", oldsym, newsym)); 137 return NULL_TREE; 138 } 103 139 case POINTER_TYPE: 104 140 /* Pointer-to-a-function type is allowed */ 105 141 if (TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE 106 142 && TREE_CODE (TREE_TYPE (type)) != METHOD_TYPE) 107 goto warn; 108 /*@@@@@todo: not finished*/ 109 break; 143 break; 110 144 case METHOD_TYPE: 111 145 case FIELD_DECL: 112 146 case TYPE_DECL: 113 147 /* Not a error but no action either */ 148 return NULL_TREE; 149 default: 114 150 break; 115 default:116 goto warn;117 151 } 118 152 else if (TREE_CODE (*node) == POINTER_TYPE && type) … … 122 156 case FUNCTION_TYPE: 123 157 case METHOD_TYPE: 158 return NULL_TREE; 159 default: 124 160 break; 125 default:126 goto warn;127 161 } 128 162 } 129 else 130 { 131 warn: warning ("`%s' attribute only applies to functions and function types", 132 IDENTIFIER_POINTER (name)); 133 *no_add_attrs = true; 134 /*dump(*node); */ 135 } 163 /* potential warnings get here */ 164 165 /* IF there is a function in the works, we don't complain and 166 make sure _System is tried again on the function declaration. 167 OR if this is a function type we need to pass it up to the 168 declaration which is likely to be a some kind of type or field. 169 */ 170 if ( (flags & (int)ATTR_FLAG_FUNCTION_NEXT) 171 || TREE_CODE (*node) == FUNCTION_TYPE 172 || TREE_CODE (*node) == METHOD_TYPE) 173 return tree_cons (name, args, NULL_TREE); 174 175 warning ("`%s' attribute only applies to functions and function types", 176 IDENTIFIER_POINTER (name)); 177 *no_add_attrs = true; 136 178 137 179 return NULL_TREE; 138 180 } 181 139 182 140 183 tree ix86_handle_optlink_attribute (tree *node, tree name, tree args, … … 157 200 typeset = type; 158 201 case FIELD_DECL: /* how come these needs mangling? */ 159 case TYPE_DECL: 202 case TYPE_DECL: 160 203 id = DECL_ASSEMBLER_NAME (*node); 161 204 /* Remove the leading underscore */ … … 196 239 IDENTIFIER_POINTER (name)); 197 240 *no_add_attrs = true; 198 /*dump(*node); */241 DUMP (*node); 199 242 } 200 243 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.