*** empty log message ***
authorBoris Boesler <boesler@ipd.info.uni-karlsruhe.de>
Tue, 18 Jun 2002 13:43:17 +0000 (13:43 +0000)
committerBoris Boesler <boesler@ipd.info.uni-karlsruhe.de>
Tue, 18 Jun 2002 13:43:17 +0000 (13:43 +0000)
[r407]

ir/st/Makefile.in
ir/tr/entity.c
ir/tr/entity.h

index 8431d6d..d67e179 100644 (file)
@@ -20,9 +20,9 @@ SOURCES += Makefile.in st.c  exc.c
 include $(topdir)/MakeRules
 
 CPPFLAGS += -I$(top_srcdir)/ir/common -I$(top_srcdir)/ir/tr \
-                       -I$(top_srcdir)/ir/ident  -I$(top_srcdir)/ir/adt \
-                       -I$(top_srcdir)/ir/ir     -I$(top_srcdir)/ir/tv  \
-                       -I$(top_srcdir)/ir/ana    -I$(top_srcdir)/ir/debug
+           -I$(top_srcdir)/ir/ident  -I$(top_srcdir)/ir/adt \
+           -I$(top_srcdir)/ir/ir     -I$(top_srcdir)/ir/tv  \
+           -I$(top_srcdir)/ir/ana    -I$(top_srcdir)/ir/debug
 
 include $(top_srcdir)/MakeTargets
 
index 85b7452..8f1e303 100644 (file)
@@ -291,7 +291,8 @@ set_atomic_ent_value(entity *ent, ir_node *val) {
   ent->value = val;
 }
 
-ir_node *copy_value(ir_node *n) {
+
+ir_node *copy_const_value(ir_node *n) {
   ir_node *nn;
   ir_mode *m;
 
@@ -302,7 +303,7 @@ ir_node *copy_value(ir_node *n) {
   case iro_SymConst:
     nn = new_SymConst(get_SymConst_type_or_id(n), get_SymConst_kind(n)); break;
   case iro_Add:
-    nn = new_Add(copy_value(get_Add_left(n)), copy_value(get_Add_right(n)), m); break;
+    nn = new_Add(copy_const_value(get_Add_left(n)), copy_const_value(get_Add_right(n)), m); break;
   default:
     assert(0 && "opdope invalid or not implemented"); break;
   }
@@ -313,7 +314,7 @@ ir_node *copy_value(ir_node *n) {
    in current_ir_graph. */
 ir_node *copy_atomic_ent_value(entity *ent) {
   assert(ent && is_atomic_entity(ent) && (ent->variability != uninitialized));
-  return copy_value(ent->value);
+  return copy_const_value(ent->value);
 }
 
 /* A value of a compound entity is a pair of value and the corresponding member of
@@ -325,6 +326,21 @@ add_compound_ent_value(entity *ent, ir_node *val, entity *member) {
   ARR_APP1 (entity *, ent->val_ents, member);
 }
 
+/* Copies the firm subgraph referenced by val to const_code_irg and adds
+   the node as constant initialization to ent.
+   The subgraph may not contain control flow operations. */
+inline void
+copy_and_add_compound_ent_value(entity *ent, ir_node *val, entity *member) {
+  ir_graph *rem = current_ir_graph;
+
+  assert(get_entity_variability(ent) != uninitialized);
+  current_ir_graph = get_const_code_irg();
+
+  val = copy_const_value(val);
+  add_compound_ent_value(ent, val, member);
+  current_ir_graph = rem;
+}
+
 inline int
 get_compound_ent_n_values(entity *ent) {
   assert(ent && is_compound_entity(ent) && (ent->variability != uninitialized));
@@ -340,7 +356,7 @@ get_compound_ent_value(entity *ent, int pos) {
 /* Copies the value i of the entity to current_block in current_ir_graph. */
 ir_node *copy_compound_ent_value(entity *ent, int pos) {
   assert(ent && is_compound_entity(ent) && (ent->variability != uninitialized));
-  return copy_value(ent->values[pos+1]);
+  return copy_const_value(ent->values[pos+1]);
 }
 
 inline entity   *
index 83835f9..7a9c4d5 100644 (file)
@@ -210,16 +210,22 @@ void           set_entity_volatility (entity *ent, ent_volatility vol);
 peculiarity get_entity_peculiarity (entity *ent);
 void        set_entity_peculiarity (entity *ent, peculiarity pec);
 
+/* Copies a firm subgraph that complies to the restrictions for
+   constant expressions to current_block in current_ir_graph. */
+ir_node *copy_const_value(ir_node *n);
+
 /* Set has no effect for entities of type method. */
 ir_node *get_atomic_ent_value(entity *ent);
 void     set_atomic_ent_value(entity *ent, ir_node *val);
 /* Copies the value represented by the entity to current_block
-   in current_ir_graph. */
+   in current_ir_graph. @@@ oblivious, use copy_const_vallue */
 ir_node *copy_atomic_ent_value(entity *ent);
 
 /* A value of a compound entity is a pair of value and the corresponding
    member of the compound. */
 void     add_compound_ent_value(entity *ent, ir_node *val, entity *member);
+/* oblivious, use copy_const_value @@@ */
+void     copy_and_add_compound_ent_value(entity *ent, ir_node *val, entity *member);
 int      get_compound_ent_n_values(entity *ent);
 ir_node *get_compound_ent_value(entity *ent, int pos);
 entity  *get_compound_ent_value_member(entity *ent, int pos);