Commit ef63002f authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Remove address name SymConsts.

[r27182]
parent d59632bf
...@@ -146,8 +146,8 @@ typedef enum { ...@@ -146,8 +146,8 @@ typedef enum {
} mtp_additional_property; } mtp_additional_property;
/** This enum names the different kinds of symbolic Constants represented by /** This enum names the different kinds of symbolic Constants represented by
* SymConst. The content of the attribute type_or_id depends on this tag. Use * SymConst. The content of the attribute symconst_symbol depends on this tag.
* the proper access routine after testing this flag. */ * Use the proper access routine after testing this flag. */
typedef enum symconst_kind { typedef enum symconst_kind {
symconst_type_tag, /**< The SymConst is a type tag for the given type. symconst_type_tag, /**< The SymConst is a type tag for the given type.
symconst_symbol is type *. */ symconst_symbol is type *. */
...@@ -155,9 +155,6 @@ typedef enum symconst_kind { ...@@ -155,9 +155,6 @@ typedef enum symconst_kind {
symconst_symbol is type *. */ symconst_symbol is type *. */
symconst_type_align, /**< The SymConst is the alignment of the given type. symconst_type_align, /**< The SymConst is the alignment of the given type.
symconst_symbol is type *. */ symconst_symbol is type *. */
symconst_addr_name, /**< The SymConst is a symbolic pointer to be filled in
by the linker. The pointer is represented by a string.
symconst_symbol is ident *. */
symconst_addr_ent, /**< The SymConst is a symbolic pointer to be filled in symconst_addr_ent, /**< The SymConst is a symbolic pointer to be filled in
by the linker. The pointer is represented by an entity. by the linker. The pointer is represented by an entity.
symconst_symbol is entity *. */ symconst_symbol is entity *. */
...@@ -173,7 +170,6 @@ typedef enum symconst_kind { ...@@ -173,7 +170,6 @@ typedef enum symconst_kind {
*/ */
typedef union symconst_symbol { typedef union symconst_symbol {
ir_type *type_p; /**< The type of a SymConst. */ ir_type *type_p; /**< The type of a SymConst. */
ident *ident_p; /**< The ident of a SymConst. */
ir_entity *entity_p; /**< The entity of a SymConst. */ ir_entity *entity_p; /**< The entity of a SymConst. */
ir_enum_const *enum_p; /**< The enumeration constant of a SymConst. */ ir_enum_const *enum_p; /**< The enumeration constant of a SymConst. */
} symconst_symbol; } symconst_symbol;
......
...@@ -543,24 +543,12 @@ ...@@ -543,24 +543,12 @@
* symconst_type_tag The symbolic constant represents a type tag. * symconst_type_tag The symbolic constant represents a type tag.
* symconst_type_size The symbolic constant represents the size of a type. * symconst_type_size The symbolic constant represents the size of a type.
* symconst_type_align The symbolic constant represents the alignment of a type. * symconst_type_align The symbolic constant represents the alignment of a type.
* symconst_addr_name Information for the linker, e.g. the name of a global
* variable.
* symconst_addr_ent The symbolic constant represents the address of an entity. * symconst_addr_ent The symbolic constant represents the address of an entity.
* symconst_ofs_ent The symbolic constant represents the offset of an * symconst_ofs_ent The symbolic constant represents the offset of an
* entity in its owner type. * entity in its owner type.
* symconst_enum_const The symbolic constant is a enumeration constant of an * symconst_enum_const The symbolic constant is a enumeration constant of an
* enumeration type. * enumeration type.
* *
* To represent a pointer to an entity that is represented by an entity
* datastructure don't use
* sym.ident_p = get_entity_ld_ident(ent);
* new_SymConst(mode_P, sym, symconst_addr_name);.
* Use a real const instead:
* sym.entity_p = ent;
* new_SymConst(mode_P, sym, symconst_addr_ent);
* This makes the constant independent of name changes of the entity due to
* mangling.
*
* Parameters * Parameters
* mode P for SymConsts representing addresses, Iu otherwise. * mode P for SymConsts representing addresses, Iu otherwise.
* value The type, ident, entity or enum constant, depending on the * value The type, ident, entity or enum constant, depending on the
...@@ -577,7 +565,6 @@ ...@@ -577,7 +565,6 @@
* -symconst_type_tag * -symconst_type_tag
* -symconst_type_size * -symconst_type_size
* -symconst_type_align * -symconst_type_align
* -symconst_addr_name
* -symconst_addr_ent * -symconst_addr_ent
* *
* If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align, * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
...@@ -1316,9 +1303,6 @@ ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg, ...@@ -1316,9 +1303,6 @@ ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg,
* - symconst_type_align The symbolic constant represents the alignment of a * - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the * type. The type of which the constant represents the
* size is given explicitly. * size is given explicitly.
* - symconst_addr_name The symbolic constant represents the address of an
* entity (variable or method). The variable is
* indicated by a name that is valid for linking.
* - symconst_addr_ent The symbolic constant represents the address of an * - symconst_addr_ent The symbolic constant represents the address of an
* entity (variable or method). The variable is given * entity (variable or method). The variable is given
* explicitly by a firm entity. * explicitly by a firm entity.
...@@ -1371,15 +1355,6 @@ ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ...@@ -1371,15 +1355,6 @@ ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
ir_entity *symbol, ir_type *tp); ir_entity *symbol, ir_type *tp);
/** Constructor for a SymConst addr_name node.
*
* Same as new_rd_SymConst_type, except that the constructor is tailored for
* symconst_addr_name.
* Adds the SymConst to the start block of irg.
*/
ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode,
ident *symbol, ir_type *tp);
/** Constructor for a SymConst type_tag node. /** Constructor for a SymConst type_tag node.
* *
* Same as new_rd_SymConst_type, except that the constructor is tailored for * Same as new_rd_SymConst_type, except that the constructor is tailored for
...@@ -2184,9 +2159,6 @@ ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp); ...@@ -2184,9 +2159,6 @@ ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
* - symconst_type_align The symbolic constant represents the alignment of a * - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the * type. The type of which the constant represents the
* size is given explicitly. * size is given explicitly.
* - symconst_addr_name The symbolic constant represents the address of an
* entity (variable or method). The variable is
* indicated by a name that is valid for linking.
* - symconst_addr_ent The symbolic constant represents the address of an * - symconst_addr_ent The symbolic constant represents the address of an
* entity (variable or method). The variable is given * entity (variable or method). The variable is given
* explicitly by a firm entity. * explicitly by a firm entity.
...@@ -2959,9 +2931,6 @@ ir_node *new_d_Const(dbg_info *db, tarval *con); ...@@ -2959,9 +2931,6 @@ ir_node *new_d_Const(dbg_info *db, tarval *con);
* - symconst_type_align The symbolic constant represents the alignment of a * - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the * type. The type of which the constant represents the
* size is given explicitly. * size is given explicitly.
* - symconst_addr_name The symbolic constant represents the address of an
* entity (variable or method). The variable is
* indicated by a name that is valid for linking.
* - symconst_addr_ent The symbolic constant represents the address of an * - symconst_addr_ent The symbolic constant represents the address of an
* entity (variable or method). The variable is given * entity (variable or method). The variable is given
* explicitly by a firm entity. * explicitly by a firm entity.
...@@ -3772,9 +3741,6 @@ ir_node *new_Const_type(tarval *con, ir_type *tp); ...@@ -3772,9 +3741,6 @@ ir_node *new_Const_type(tarval *con, ir_type *tp);
* - symconst_type_align The symbolic constant represents the alignment of a * - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the * type. The type of which the constant represents the
* size is given explicitly. * size is given explicitly.
* - symconst_addr_name The symbolic constant represents the address of an
* entity (variable or method). The variable is
* indicated by a name that is valid for linking.
* - symconst_addr_ent The symbolic constant represents the address of an * - symconst_addr_ent The symbolic constant represents the address of an
* entity (variable or method). The variable is given * entity (variable or method). The variable is given
* explicitly by a firm entity. * explicitly by a firm entity.
...@@ -3811,9 +3777,6 @@ ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_ ...@@ -3811,9 +3777,6 @@ ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_
* - symconst_type_align The symbolic constant represents the alignment of a * - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the * type. The type of which the constant represents the
* size is given explicitly. * size is given explicitly.
* - symconst_addr_name The symbolic constant represents the address of an
* entity (variable or method). The variable is
* indicated by a name that is valid for linking.
* - symconst_addr_ent The symbolic constant represents the address of an * - symconst_addr_ent The symbolic constant represents the address of an
* entity (variable or method). The variable is given * entity (variable or method). The variable is given
* explicitly by a firm entity. * explicitly by a firm entity.
......
...@@ -499,9 +499,6 @@ void set_Const_type(ir_node *node, ir_type *tp); ...@@ -499,9 +499,6 @@ void set_Const_type(ir_node *node, ir_type *tp);
/** Returns non-zero if s symconst kind has a type attribute */ /** Returns non-zero if s symconst kind has a type attribute */
#define SYMCONST_HAS_TYPE(kind) ((kind) <= symconst_type_align) #define SYMCONST_HAS_TYPE(kind) ((kind) <= symconst_type_align)
/** Returns non-zero if s symconst kind has an ident attribute */
#define SYMCONST_HAS_ID(kind) ((kind) == symconst_addr_name)
/** Returns non-zero if s symconst kind has an entity attribute */ /** Returns non-zero if s symconst kind has an entity attribute */
#define SYMCONST_HAS_ENT(kind) ((kind) == symconst_addr_ent || (kind) == symconst_ofs_ent) #define SYMCONST_HAS_ENT(kind) ((kind) == symconst_addr_ent || (kind) == symconst_ofs_ent)
...@@ -517,10 +514,6 @@ void set_SymConst_kind(ir_node *node, symconst_kind num); ...@@ -517,10 +514,6 @@ void set_SymConst_kind(ir_node *node, symconst_kind num);
ir_type *get_SymConst_type(const ir_node *node); ir_type *get_SymConst_type(const ir_node *node);
void set_SymConst_type(ir_node *node, ir_type *tp); void set_SymConst_type(ir_node *node, ir_type *tp);
/** Only to access SymConst of kind addr_name. Else assertion: */
ident *get_SymConst_name(const ir_node *node);
void set_SymConst_name(ir_node *node, ident *name);
/** Only to access SymConst of kind addr_ent. Else assertion: */ /** Only to access SymConst of kind addr_ent. Else assertion: */
ir_entity *get_SymConst_entity(const ir_node *node); ir_entity *get_SymConst_entity(const ir_node *node);
void set_SymConst_entity(ir_node *node, ir_entity *ent); void set_SymConst_entity(ir_node *node, ir_entity *ent);
......
...@@ -47,13 +47,10 @@ ...@@ -47,13 +47,10 @@
/* irnode.h */ /* irnode.h */
#define get_Return_n_res get_Return_n_ress #define get_Return_n_res get_Return_n_ress
#define get_Sel_n_index get_Sel_n_indexs #define get_Sel_n_index get_Sel_n_indexs
#define get_SymConst_ptrinfo get_SymConst_name
#define set_SymConst_ptrinfo set_SymConst_name
#define type_tag symconst_type_tag #define type_tag symconst_type_tag
/* don't do this -- too many use this name elswhere */ /* don't do this -- too many use this name elswhere */
/* #define size symconst_type_size */ /* #define size symconst_type_size */
#define symconst_size symconst_type_size #define symconst_size symconst_type_size
#define linkage_ptr_info symconst_addr_name
#define get_nodes_Block(X) get_nodes_block(X) #define get_nodes_Block(X) get_nodes_block(X)
#define set_nodes_Block(X, Y) set_nodes_block(X, Y) #define set_nodes_Block(X, Y) set_nodes_block(X, Y)
......
...@@ -163,8 +163,8 @@ static ir_entity ** get_impl_methods(ir_entity * method) ...@@ -163,8 +163,8 @@ static ir_entity ** get_impl_methods(ir_entity * method)
*/ */
static void sel_methods_walker(ir_node *node, void *env) static void sel_methods_walker(ir_node *node, void *env)
{ {
pmap *ldname_map = env;
ir_entity **arr; ir_entity **arr;
(void)env;
/* Call standard optimizations */ /* Call standard optimizations */
if (is_Sel(node)) { if (is_Sel(node)) {
...@@ -175,16 +175,7 @@ static void sel_methods_walker(ir_node *node, void *env) ...@@ -175,16 +175,7 @@ static void sel_methods_walker(ir_node *node, void *env)
} }
} }
/* replace SymConst(name)-operations by SymConst(ent) */ if (is_Sel(node) && is_Method_type(get_entity_type(get_Sel_entity(node)))) {
if (is_SymConst(node)) {
if (get_SymConst_kind(node) == symconst_addr_name) {
pmap_entry *entry = pmap_find(ldname_map, get_SymConst_name(node));
if (entry != NULL) { /* Method is declared in the compiled code */
assert(!"There should not be a SymConst[addr_name] addressing a method with an implementation"
"in this compilation unit. Use a SymConst[addr_ent].");
}
}
} else if (is_Sel(node) && is_Method_type(get_entity_type(get_Sel_entity(node)))) {
ir_entity *ent = get_SymConst_entity(get_atomic_ent_value(get_Sel_entity(node))); ir_entity *ent = get_SymConst_entity(get_atomic_ent_value(get_Sel_entity(node)));
if (!eset_contains(entities, ent)) { if (!eset_contains(entities, ent)) {
...@@ -250,7 +241,7 @@ static void sel_methods_init(void) ...@@ -250,7 +241,7 @@ static void sel_methods_init(void)
} }
} }
all_irg_walk(sel_methods_walker, NULL, ldname_map); all_irg_walk(sel_methods_walker, NULL, NULL);
pmap_destroy(ldname_map); pmap_destroy(ldname_map);
} }
...@@ -672,17 +663,14 @@ static void callee_ana_node(ir_node *node, eset *methods) ...@@ -672,17 +663,14 @@ static void callee_ana_node(ir_node *node, eset *methods)
call and ignore it completely. */ call and ignore it completely. */
eset_insert(methods, unknown_entity); /* free method -> unknown */ eset_insert(methods, unknown_entity); /* free method -> unknown */
break; break;
case iro_SymConst:
if (get_SymConst_kind(node) == symconst_addr_ent) { case iro_SymConst: {
ir_entity *ent = get_SymConst_entity(node); ir_entity *ent = get_SymConst_entity(node);
assert(ent && is_method_entity(ent)); assert(ent && is_method_entity(ent));
eset_insert(methods, ent); eset_insert(methods, ent);
} else {
assert(get_SymConst_kind(node) == symconst_addr_name);
/* external method (because fix_symconst()!) */
eset_insert(methods, unknown_entity); /* free method -> unknown */
}
break; break;
}
case iro_Sel: case iro_Sel:
/* polymorphic method */ /* polymorphic method */
for (i = get_Sel_n_methods(node) - 1; i >= 0; --i) { for (i = get_Sel_n_methods(node) - 1; i >= 0; --i) {
......
...@@ -157,11 +157,6 @@ static void rta_act(ir_node *node, void *env) ...@@ -157,11 +157,6 @@ static void rta_act(ir_node *node, void *env)
} else { } else {
/* it's an external allocated thing. */ /* it's an external allocated thing. */
} }
} else if (get_SymConst_kind(ptr) == symconst_addr_name) {
/* Entities of kind addr_name may not be allocated in this compilation unit.
If so, the frontend built faulty Firm. So just ignore. */
/* if (get_SymConst_name(ptr) != new_id_from_str("iro_Catch"))
assert(ent && "couldn't determine entity of call to SymConst of kind addr_name."); */
} else { } else {
/* other symconst. */ /* other symconst. */
panic("This SymConst can not be an address for a method call."); panic("This SymConst can not be an address for a method call.");
......
...@@ -664,10 +664,6 @@ static void do_emit_atomic_init(be_gas_decl_env_t *env, ir_node *init) ...@@ -664,10 +664,6 @@ static void do_emit_atomic_init(be_gas_decl_env_t *env, ir_node *init)
case iro_SymConst: case iro_SymConst:
switch (get_SymConst_kind(init)) { switch (get_SymConst_kind(init)) {
case symconst_addr_name:
be_emit_ident(get_SymConst_name(init));
break;
case symconst_addr_ent: case symconst_addr_ent:
ent = get_SymConst_entity(init); ent = get_SymConst_entity(init);
be_gas_emit_entity(ent); be_gas_emit_entity(ent);
......
...@@ -145,9 +145,6 @@ static const char *get_symconst_str(ir_node *node) ...@@ -145,9 +145,6 @@ static const char *get_symconst_str(ir_node *node)
ident *id; ident *id;
switch (get_SymConst_kind(node)) { switch (get_SymConst_kind(node)) {
case symconst_addr_name:
id = get_SymConst_name(node);
return get_id_str(id);
case symconst_addr_ent: case symconst_addr_ent:
id = get_entity_ident(get_SymConst_entity(node)); id = get_entity_ident(get_SymConst_entity(node));
return get_id_str(id); return get_id_str(id);
......
...@@ -499,13 +499,6 @@ ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_ ...@@ -499,13 +499,6 @@ ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_
return new_rd_SymConst_type(db, irg, mode, sym, symconst_ofs_ent, tp); return new_rd_SymConst_type(db, irg, mode, sym, symconst_ofs_ent, tp);
} /* new_rd_SymConst_ofs_ent */ } /* new_rd_SymConst_ofs_ent */
ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode, ident *symbol, ir_type *tp)
{
symconst_symbol sym;
sym.ident_p = symbol;
return new_rd_SymConst_type(db, irg, mode, sym, symconst_addr_name, tp);
} /* new_rd_SymConst_addr_name */
ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol, ir_type *tp) ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol, ir_type *tp)
{ {
symconst_symbol sym; symconst_symbol sym;
......
...@@ -783,10 +783,6 @@ int dump_node_opcode(FILE *F, ir_node *n) ...@@ -783,10 +783,6 @@ int dump_node_opcode(FILE *F, ir_node *n)
switch (get_irn_opcode(n)) { switch (get_irn_opcode(n)) {
case iro_SymConst: case iro_SymConst:
switch (get_SymConst_kind(n)) { switch (get_SymConst_kind(n)) {
case symconst_addr_name:
/* don't use get_SymConst_ptr_info as it mangles the name. */
fprintf(F, "SymC %s", get_id_str(get_SymConst_name(n)));
break;
case symconst_addr_ent: case symconst_addr_ent:
fprintf(F, "SymC &%s", get_entity_name(get_SymConst_entity(n))); fprintf(F, "SymC &%s", get_entity_name(get_SymConst_entity(n)));
break; break;
......
...@@ -317,10 +317,6 @@ int dump_irnode_to_file(FILE *F, ir_node *n) ...@@ -317,10 +317,6 @@ int dump_irnode_to_file(FILE *F, ir_node *n)
} break; } break;
case iro_SymConst: { case iro_SymConst: {
switch (get_SymConst_kind(n)) { switch (get_SymConst_kind(n)) {
case symconst_addr_name:
fprintf(F, " kind: addr_name\n");
fprintf(F, " name: %s\n", get_id_str(get_SymConst_name(n)));
break;
case symconst_addr_ent: case symconst_addr_ent:
fprintf(F, " kind: addr_ent\n"); fprintf(F, " kind: addr_ent\n");
fprintf(F, " entity: "); fprintf(F, " entity: ");
......
...@@ -1270,18 +1270,6 @@ void set_SymConst_type(ir_node *node, ir_type *tp) ...@@ -1270,18 +1270,6 @@ void set_SymConst_type(ir_node *node, ir_type *tp)
node->attr.symc.sym.type_p = tp; node->attr.symc.sym.type_p = tp;
} }
ident *get_SymConst_name(const ir_node *node)
{
assert(is_SymConst(node) && SYMCONST_HAS_ID(get_SymConst_kind(node)));
return node->attr.symc.sym.ident_p;
}
void set_SymConst_name(ir_node *node, ident *name)
{
assert(is_SymConst(node) && SYMCONST_HAS_ID(get_SymConst_kind(node)));
node->attr.symc.sym.ident_p = name;
}
/* Only to access SymConst of kind symconst_addr_ent. Else assertion: */ /* Only to access SymConst of kind symconst_addr_ent. Else assertion: */
ir_entity *get_SymConst_entity(const ir_node *node) ir_entity *get_SymConst_entity(const ir_node *node)
......
...@@ -277,9 +277,6 @@ static void lower_symconst(ir_node *symc) ...@@ -277,9 +277,6 @@ static void lower_symconst(ir_node *symc)
hook_lower(symc); hook_lower(symc);
exchange(symc, newn); exchange(symc, newn);
break; break;
case symconst_addr_name:
/* do not rewrite - pass info to back end */
break;
case symconst_addr_ent: case symconst_addr_ent:
/* leave */ /* leave */
break; break;
......
...@@ -2103,7 +2103,6 @@ static void compute_SymConst(node_t *node) ...@@ -2103,7 +2103,6 @@ static void compute_SymConst(node_t *node)
} }
switch (get_SymConst_kind(irn)) { switch (get_SymConst_kind(irn)) {
case symconst_addr_ent: case symconst_addr_ent:
/* case symconst_addr_name: cannot handle this yet */
node->type.sym = get_SymConst_symbol(irn); node->type.sym = get_SymConst_symbol(irn);
break; break;
default: default:
......
...@@ -531,12 +531,6 @@ static HRESULT format_node(DEBUGHELPER *pHelper, int nBase, const void *addr, ch ...@@ -531,12 +531,6 @@ static HRESULT format_node(DEBUGHELPER *pHelper, int nBase, const void *addr, ch
return E_FAIL; return E_FAIL;
_tcsncat(pResult, name, max); _tcsncat(pResult, name, max);
break; break;
case symconst_addr_name:
_tcsncat(pResult, "NAME:", max);
if (format_ident(pHelper, n.attr.symc.sym.ident_p, name, sizeof(name)) != S_OK)
return E_FAIL;
_tcsncat(pResult, name, max);
break;
case symconst_addr_ent: case symconst_addr_ent:
_tcsncat(pResult, "ENT:", max); _tcsncat(pResult, "ENT:", max);
if (format_entity(pHelper, nBase, n.attr.symc.sym.entity_p, name, sizeof(name), 0) != S_OK) if (format_entity(pHelper, nBase, n.attr.symc.sym.entity_p, name, sizeof(name), 0) != S_OK)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment