} mtp_additional_property;
/** 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
- * the proper access routine after testing this flag. */
+ * SymConst. The content of the attribute symconst_symbol depends on this tag.
+ * Use the proper access routine after testing this flag. */
typedef enum symconst_kind {
symconst_type_tag, /**< The SymConst is a type tag for the given type.
symconst_symbol is type *. */
symconst_symbol is type *. */
symconst_type_align, /**< The SymConst is the alignment of the given 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
by the linker. The pointer is represented by an entity.
symconst_symbol is entity *. */
*/
typedef union symconst_symbol {
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_enum_const *enum_p; /**< The enumeration constant of a SymConst. */
} symconst_symbol;
* symconst_type_tag The symbolic constant represents a type tag.
* 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_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_ofs_ent The symbolic constant represents the offset of an
* entity in its owner type.
* symconst_enum_const The symbolic constant is a enumeration constant of an
* 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
* mode P for SymConsts representing addresses, Iu otherwise.
* value The type, ident, entity or enum constant, depending on the
* -symconst_type_tag
* -symconst_type_size
* -symconst_type_align
- * -symconst_addr_name
* -symconst_addr_ent
*
* If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
* - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the
* 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
* entity (variable or method). The variable is given
* explicitly by a firm entity.
ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
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.
*
* Same as new_rd_SymConst_type, except that the constructor is tailored for
* - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the
* 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
* entity (variable or method). The variable is given
* explicitly by a firm entity.
* - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the
* 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
* entity (variable or method). The variable is given
* explicitly by a firm entity.
* - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the
* 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
* entity (variable or method). The variable is given
* explicitly by a firm entity.
* - symconst_type_align The symbolic constant represents the alignment of a
* type. The type of which the constant represents the
* 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
* entity (variable or method). The variable is given
* explicitly by a firm entity.
/** Returns non-zero if s symconst kind has a type attribute */
#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 */
#define SYMCONST_HAS_ENT(kind) ((kind) == symconst_addr_ent || (kind) == symconst_ofs_ent)
ir_type *get_SymConst_type(const ir_node *node);
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: */
ir_entity *get_SymConst_entity(const ir_node *node);
void set_SymConst_entity(ir_node *node, ir_entity *ent);
/* irnode.h */
#define get_Return_n_res get_Return_n_ress
#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
/* don't do this -- too many use this name elswhere */
/* #define 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 set_nodes_Block(X, Y) set_nodes_block(X, Y)
*/
static void sel_methods_walker(ir_node *node, void *env)
{
- pmap *ldname_map = env;
ir_entity **arr;
+ (void)env;
/* Call standard optimizations */
if (is_Sel(node)) {
}
}
- /* replace SymConst(name)-operations by SymConst(ent) */
- 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)))) {
+ 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)));
if (!eset_contains(entities, ent)) {
}
}
- all_irg_walk(sel_methods_walker, NULL, ldname_map);
+ all_irg_walk(sel_methods_walker, NULL, NULL);
pmap_destroy(ldname_map);
}
call and ignore it completely. */
eset_insert(methods, unknown_entity); /* free method -> unknown */
break;
- case iro_SymConst:
- if (get_SymConst_kind(node) == symconst_addr_ent) {
- ir_entity *ent = get_SymConst_entity(node);
- assert(ent && is_method_entity(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 */
- }
+
+ case iro_SymConst: {
+ ir_entity *ent = get_SymConst_entity(node);
+ assert(ent && is_method_entity(ent));
+ eset_insert(methods, ent);
break;
+ }
+
case iro_Sel:
/* polymorphic method */
for (i = get_Sel_n_methods(node) - 1; i >= 0; --i) {
} else {
/* 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 {
/* other symconst. */
panic("This SymConst can not be an address for a method call.");
case iro_SymConst:
switch (get_SymConst_kind(init)) {
- case symconst_addr_name:
- be_emit_ident(get_SymConst_name(init));
- break;
-
case symconst_addr_ent:
ent = get_SymConst_entity(init);
be_gas_emit_entity(ent);
ident *id;
switch (get_SymConst_kind(node)) {
- case symconst_addr_name:
- id = get_SymConst_name(node);
- return get_id_str(id);
case symconst_addr_ent:
id = get_entity_ident(get_SymConst_entity(node));
return get_id_str(id);
return new_rd_SymConst_type(db, irg, mode, sym, symconst_ofs_ent, tp);
} /* 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)
{
symconst_symbol sym;
switch (get_irn_opcode(n)) {
case iro_SymConst:
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:
fprintf(F, "SymC &%s", get_entity_name(get_SymConst_entity(n)));
break;
} break;
case iro_SymConst: {
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:
fprintf(F, " kind: addr_ent\n");
fprintf(F, " entity: ");
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: */
ir_entity *get_SymConst_entity(const ir_node *node)
hook_lower(symc);
exchange(symc, newn);
break;
- case symconst_addr_name:
- /* do not rewrite - pass info to back end */
- break;
case symconst_addr_ent:
/* leave */
break;
}
switch (get_SymConst_kind(irn)) {
case symconst_addr_ent:
- /* case symconst_addr_name: cannot handle this yet */
node->type.sym = get_SymConst_symbol(irn);
break;
default:
return E_FAIL;
_tcsncat(pResult, name, max);
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:
_tcsncat(pResult, "ENT:", max);
if (format_entity(pHelper, nBase, n.attr.symc.sym.entity_p, name, sizeof(name), 0) != S_OK)