{
ir_node *load, *pload, *pred, *in[2];
- assert(get_irg_phase_state (current_ir_graph) == phase_building);
+ assert(get_irg_phase_state(current_ir_graph) == phase_building);
+ assert(get_irn_mode(store) == mode_M && "storing non-memory node");
if (get_opt_auto_create_sync()) {
/* handle non-volatile Load nodes by automatically creating Sync's */
* Modified by: Goetz Lindenmaier, Hubert Schmidt
* Created:
* CVS-ID: $Id$
- * Copyright: (c) 1998-2003 Universit�t Karlsruhe
+ * Copyright: (c) 1998-2006 Universit�t Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
#ifdef HAVE_CONFIG_H
} break;
case iro_SymConst: {
- if (get_SymConst_kind(n) == symconst_addr_name) {
+ 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)));
- } else if (get_SymConst_kind(n) == symconst_addr_ent) {
- assert(get_SymConst_entity(n));
- assert(is_entity(get_SymConst_entity(n)));
- fprintf (F, "SymC &%s", get_entity_name(get_SymConst_entity(n)));
- } else {
- assert(get_kind(get_SymConst_type(n)) == k_type);
- assert(get_type_ident(get_SymConst_type(n)));
- fprintf (F, "SymC %s ", get_type_name_ex(get_SymConst_type(n), &bad));
- if (get_SymConst_kind(n) == symconst_type_tag)
- fprintf (F, "tag");
- else
- fprintf (F, "size");
+ 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;
+ case symconst_type_tag:
+ fprintf(F, "SymC %s tag", get_type_name_ex(get_SymConst_type(n), &bad));
+ break;
+ case symconst_type_size:
+ fprintf(F, "SymC %s size", get_type_name_ex(get_SymConst_type(n), &bad));
+ break;
+ case symconst_type_align:
+ fprintf(F, "SymC %s align", get_type_name_ex(get_SymConst_type(n), &bad));
+ break;
+ case symconst_enum_const:
+ fprintf(F, "SymC %s enum", get_enumeration_name(get_SymConst_enum(n)));
+ break;
}
} break;
static void dump_enum_item(FILE *F, ir_type *tp, int pos)
{
char buf[1024];
- ident *id = get_enumeration_nameid(tp, pos);
- tarval *tv = get_enumeration_enum(tp, pos);
+ ir_enum_const *ec = get_enumeration_const(tp, pos);
+ ident *id = get_enumeration_nameid(ec);
+ tarval *tv = get_enumeration_value(ec);
- tarval_snprintf(buf, sizeof(buf), tv);
- fprintf (F, "node: {title: \"");
+ if (tv)
+ tarval_snprintf(buf, sizeof(buf), tv);
+ else
+ strncpy(buf, "<not set>", sizeof(buf));
+ fprintf(F, "node: {title: \"");
PRINT_ITEMID(tp, pos); fprintf(F, "\"");
- fprintf (F, DEFAULT_ENUM_ITEM_ATTRIBUTE);
- fprintf (F, "label: ");
- fprintf (F, "\"enum item %s\" " ENUM_ITEM_NODE_ATTR, get_id_str(id));
- fprintf (F, "\n info1: \"value: %s\"}\n", buf);
+ fprintf(F, DEFAULT_ENUM_ITEM_ATTRIBUTE);
+ fprintf(F, "label: ");
+ fprintf(F, "\"enum item %s\" " ENUM_ITEM_NODE_ATTR, get_id_str(id));
+ fprintf(F, "\n info1: \"value: %s\"}\n", buf);
}
/* dumps a type or entity and it's edges. */
* Modified by: Goetz Lindenmaier, Hubert Schmidt
* Created:
* CVS-ID: $Id$
- * Copyright: (c) 1998-2003 Universität Karlsruhe
+ * Copyright: (c) 1998-2006 Universität Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
#ifdef HAVE_CONFIG_H
fprintf(F, " type: ");
dump_type_to_file(F, get_SymConst_type(n), dump_verbosity_onlynames);
break;
+ case symconst_enum_const:
+ fprintf(F, " kind: enumeration\n");
+ fprintf(F, " name: %s\n", get_enumeration_name(get_SymConst_enum(n)));
+ break;
}
fprintf(F, " type of value: %s \n", get_type_name_ex(get_SymConst_value_type(n), &bad));
} break;
* Modified by: Goetz Lindenmaier, Michael Beck
* Created:
* CVS-ID: $Id$
- * Copyright: (c) 1998-2003 Universität Karlsruhe
+ * Copyright: (c) 1998-2006 Universität Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
node->attr.symc.sym.entity_p = ent;
}
+ir_enum_const *get_SymConst_enum (ir_node *node) {
+ assert ( (node->op == op_SymConst)
+ && (get_SymConst_kind (node) == symconst_enum_const));
+ return node->attr.symc.sym.enum_p;
+}
+
+void set_SymConst_enum (ir_node *node, ir_enum_const *ec) {
+ assert ( (node->op == op_SymConst)
+ && (get_SymConst_kind(node) == symconst_enum_const));
+ node->attr.symc.sym.enum_p = ec;
+}
+
union symconst_symbol
get_SymConst_symbol (ir_node *node) {
assert (node->op == op_SymConst);
* Modified by: Goetz Lindenmaier, Michael Beck
* Created:
* CVS-ID: $Id$
- * Copyright: (c) 1998-2003 Universität Karlsruhe
+ * Copyright: (c) 1998-2006 Universität Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
#ifndef _FIRM_IR_IRNODE_H_
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.
symconst_symbol is entity *. */
+ symconst_enum_const /**< The SymConst is a enumeration constant of an
+ enumeration type. */
} symconst_kind;
/** Returns non-zero if s symconst kind has a type attribute */
/** Returns non-zero if s symconst kind has an entity attribute */
#define SYMCONST_HAS_ENT(kind) ((kind) == symconst_addr_ent)
+/** Returns non-zero if s symconst kind has an enum_const attribute */
+#define SYMCONST_HAS_ENUM(kind) ((kind) == symconst_enum_const)
+
/** SymConst attribute.
*
- * This union contains the symbolic information represented by the node. */
+ * This union contains the symbolic information represented by the node.
+ */
typedef union symconst_symbol {
- ir_type *type_p;
- ident *ident_p;
- entity *entity_p;
+ ir_type *type_p;
+ ident *ident_p;
+ entity *entity_p;
+ ir_enum_const *enum_p;
} symconst_symbol;
/** Get the kind of the SymConst. */
entity *get_SymConst_entity (ir_node *node);
void set_SymConst_entity (ir_node *node, entity *ent);
+/** Only to access SymConst of kind symconst_enum_const. Else assertion: */
+ir_enum_const *get_SymConst_enum (ir_node *node);
+void set_SymConst_enum (ir_node *node, ir_enum_const *ec);
+
/** Sets both: type and ptrinfo. Needed to treat the node independent of
its semantics. Does a memcpy for the memory sym points to. */
/* write 'union': firmjni then does not create a method... */
* Author: Sebastian Hack
* Created: 29.11.2004
* CVS-ID: $Id$
- * Copyright: (c) 1998-2004 Universität Karlsruhe
+ * Copyright: (c) 1998-2006 Universität Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
case symconst_addr_ent: /* entity name */
snprintf(tv_buf, sizeof(tv_buf), "<%s>", get_entity_name(get_SymConst_entity(X)));
break;
+ case symconst_enum_const: /* enumeration constant */
+ snprintf(tv_buf, sizeof(tv_buf), "<ENUM:%s>", get_enumeration_name(get_SymConst_enum(X)));
+ break;
default:
tv_buf[0] = '\0';
}