use set_nodes_block() instead of set_irn_n(*,-1,*)
[libfirm] / ir / tr / entity_t.h
index 963a0f5..0f306b1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
 #include "ident.h"
 #include "pseudo_irg.h"
 
+typedef struct ir_initializer_base_t {
+       ir_initializer_kind_t kind;
+} ir_initializer_base_t;
+
+typedef struct ir_initializer_compound_t {
+       ir_initializer_base_t  base;
+       unsigned               n_initializers;
+       ir_initializer_t      *initializers[1];
+} ir_initializer_compound_t;
+
+typedef struct ir_initializer_const_t {
+       ir_initializer_base_t  base;
+       ir_node               *value;
+} ir_initializer_const_t ;
+
+typedef struct ir_initializer_tarval_t {
+       ir_initializer_base_t  base;
+       tarval                *value;
+} ir_initializer_tarval_t ;
+
+union ir_initializer_t {
+       ir_initializer_kind_t      kind;
+       ir_initializer_base_t      base;
+       ir_initializer_compound_t  compound;
+       ir_initializer_const_t     consti;
+       ir_initializer_tarval_t    tarval;
+};
+
 /** A path in a compound graph. */
 struct compound_graph_path {
        firm_kind kind;       /**< The dynamic type tag for compound graph path. */
@@ -112,6 +140,7 @@ struct ir_entity {
        unsigned final:1;              /**< If set, this entity cannot be overridden. */
        unsigned compiler_gen:1;       /**< If set, this entity was compiler generated. */
        unsigned backend_marked:1;     /**< If set, this entity was marked by the backend for emission. */
+       unsigned has_initializer:1;
        int offset;                    /**< Offset in bytes for this entity.  Fixed when layout
                                            of owner is determined. */
        unsigned char offset_bit_remainder;
@@ -136,6 +165,8 @@ struct ir_entity {
                compound_ent_attr cmpd_attr;
                /* ------------- fields for method entities ---------------- */
                method_ent_attr   mtd_attr;
+               /* entity initializer */
+               ir_initializer_t *initializer;
        } attr; /**< type specific attributes */
 
        /* ------------- fields for analyses ---------------*/
@@ -383,12 +414,13 @@ _set_entity_link(ir_entity *ent, void *l) {
 
 static INLINE ir_graph *
 _get_entity_irg(const ir_entity *ent) {
+       ir_graph *irg;
        assert(ent && ent->kind == k_entity);
        assert(ent == unknown_entity || is_Method_type(ent->type));
-       if (!get_visit_pseudo_irgs() && ent->attr.mtd_attr.irg
-               && is_pseudo_ir_graph(ent->attr.mtd_attr.irg))
+       irg = ent->attr.mtd_attr.irg;
+       if (irg != NULL && !get_visit_pseudo_irgs()     && is_pseudo_ir_graph(irg))
                return NULL;
-       return ent->attr.mtd_attr.irg;
+       return irg;
 }
 
 static INLINE unsigned long