Remove compound path initializers.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 14 Jun 2012 13:25:08 +0000 (15:25 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 14 Jun 2012 16:09:10 +0000 (18:09 +0200)
27 files changed:
include/libfirm/Makefile.am
include/libfirm/compound_path.h [deleted file]
include/libfirm/firm_common.h
include/libfirm/irprintf.h
ir/Makefile.am
ir/ana/cgana.c
ir/ana/irmemory.c
ir/be/begnuas.c
ir/debug/debugger.c
ir/ir/irargs.c
ir/ir/irdump.c
ir/ir/irdumptxt.c
ir/ir/irgwalk.c
ir/ir/irio.c
ir/lower/lower_intrinsics.c
ir/opt/garbage_collect.c
ir/opt/ldstopt.c
ir/opt/opt_ldst.c
ir/tr/compound_path.c [deleted file]
ir/tr/compound_path_t.h [deleted file]
ir/tr/entity.c
ir/tr/entity_t.h
ir/tr/trverify.c
ir/tr/typewalk.c
win32/firmEvaluator/firm.c
win32/vc2010/firm.vcxproj
win32/vc2010/firm.vcxproj.filters

index 172895e..c27165b 100644 (file)
@@ -6,7 +6,6 @@ libfirminclude_HEADERS = \
        callgraph.h \
        cdep.h \
        cgana.h \
-       compound_path.h \
        dbginfo.h \
        end.h \
        execfreq.h \
diff --git a/include/libfirm/compound_path.h b/include/libfirm/compound_path.h
deleted file mode 100644 (file)
index 1661f52..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
- *
- * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
- */
-
-/**
- * @file
- * @brief Deprecated way to initialize compound entites! (use ir_initializer
- *        stuff instead)
- * Declarations for functions and datastructures to represent compound
- * type initializers.
- */
-#ifndef FIRM_COMPOUND_PATHS_H
-#define FIRM_COMPOUND_PATHS_H
-
-#include "firm_types.h"
-#include "begin.h"
-
-/**
- * path into compound types
- * @deprecated
- */
-typedef struct compound_graph_path  compound_graph_path;
-
-/**
- * @deprecated
- * Creates a new compound graph path of given length.
- */
-FIRM_API compound_graph_path *new_compound_graph_path(ir_type *tp, size_t length);
-
-/**
- * @deprecated
- * Returns non-zero if an object is a compound graph path
- */
-FIRM_API int is_compound_graph_path(const void *thing);
-
-/**
- * @deprecated
- * Frees a graph path object
- */
-FIRM_API void free_compound_graph_path(compound_graph_path *gr);
-
-/**
- * @deprecated
- * Returns the length of a graph path
- */
-FIRM_API size_t get_compound_graph_path_length(const compound_graph_path *gr);
-
-/**
- * @deprecated
- * Returns the entity node of an compound graph path at position pos.
- */
-ir_entity *get_compound_graph_path_node(const compound_graph_path *gr, size_t pos);
-
-/**
- * @deprecated
- * Sets the entity node of an compound graph path at position pos.
- */
-FIRM_API void set_compound_graph_path_node(compound_graph_path *gr, size_t pos,
-                                           ir_entity *node);
-
-/**
- * @deprecated
- * Returns the index of an compound graph path at position pos.
- */
-FIRM_API long get_compound_graph_path_array_index(const compound_graph_path *gr, size_t pos);
-
-/**
- * @deprecated
- * Sets the index of an compound graph path at position pos.
- */
-FIRM_API void set_compound_graph_path_array_index(compound_graph_path *gr, size_t pos, long index);
-
-/**
- * @deprecated
- * Returns the type of an compound graph path.
- */
-FIRM_API ir_type *get_compound_graph_path_type(const compound_graph_path *gr);
-
-/**
- * @deprecated
- * Checks whether the path up to pos is correct. If the path contains a NULL,
- *  assumes the path is not complete and returns non-zero.
- */
-FIRM_API int is_proper_compound_graph_path(compound_graph_path *gr, size_t pos);
-
-/**
- * @deprecated
- * A value of a compound entity is a pair of a value and the description of the
- * corresponding access path to the member of the compound.
- */
-FIRM_API void add_compound_ent_value_w_path(ir_entity *ent, ir_node *val, compound_graph_path *path);
-/**
- * @deprecated
- * Sets initializer value for a compound ent path
- */
-FIRM_API void set_compound_ent_value_w_path(ir_entity *ent, ir_node *val, compound_graph_path *path, size_t pos);
-
-/**
- * @deprecated
- * Returns the access path for value at position pos.
- */
-FIRM_API compound_graph_path *get_compound_ent_value_path(const ir_entity *ent, size_t pos);
-
-/**
- * @deprecated
- * Returns a constant value given the access path.
- *  The path must contain array indices for all array element entities.
- */
-FIRM_API ir_node *get_compound_ent_value_by_path(const ir_entity *ent,
-                                                 compound_graph_path *path);
-
-/**
- * @deprecated
- * Removes all constant entries where the path ends at value_ent. Does not
- * free the memory of the paths.  (The same path might be used for several
- * constant entities.
- */
-FIRM_API void remove_compound_ent_value(ir_entity *ent, ir_entity *value_ent);
-
-/**
- * @deprecated
- * Generates a Path with length 1.
- *  Beware: Has a bad runtime for array elements (O(|array|) and should be
- *  avoided there. Use add_compound_ent_value_w_path() instead and create
- *  the path manually.
- */
-FIRM_API void add_compound_ent_value(ir_entity *ent, ir_node *val, ir_entity *member);
-
-/**
- * @deprecated
- * Returns the last member in the path
- */
-FIRM_API ir_entity *get_compound_ent_value_member(const ir_entity *ent, size_t pos);
-
-/**
- * @deprecated
- * Sets the path at pos 0
- */
-FIRM_API void set_compound_ent_value(ir_entity *ent, ir_node *val,
-                                     ir_entity *member, size_t pos);
-
-/**
- * @deprecated
- * Initializes the entity ent which must be of a one dimensional
- * array type with the values given in the values array.
- * The array must have a lower and an upper bound.  Keeps the
- * order of values. Does not test whether the number of values
- * fits into the given array size.  Does not test whether the
- * values have the proper mode for the array.
- */
-FIRM_API void set_array_entity_values(ir_entity *ent, ir_tarval **values, size_t num_vals);
-
-/**
- * @deprecated
- * Returns the offset in bits from the last byte address.
- *
- * This requires that the layout of all concerned types is fixed.
- *
- * @param ent Any entity of compound type with at least pos initialization values.
- * @param pos The position of the value for which the offset is requested.
- */
-FIRM_API unsigned get_compound_ent_value_offset_bit_remainder(const ir_entity *ent, size_t pos);
-
-/**
- * @deprecated
- * Returns the overall offset of value at position pos in bytes.
- *
- * This requires that the layout of all concerned types is fixed.
- * Asserts if bit offset is not byte aligned.
- *
- * @param ent Any entity of compound type with at least pos initialization values.
- * @param pos The position of the value for which the offset is requested.
- */
-FIRM_API unsigned get_compound_ent_value_offset_bytes(const ir_entity *ent, size_t pos);
-
-/**
- * @deprecated
- * Returns the number of constant values needed to initialize the entity.
- * Asserts if the entity has variability_uninitialized.
- */
-FIRM_API size_t get_compound_ent_n_values(const ir_entity *ent);
-
-/**
- * @deprecated
- * Returns a constant value given the position.
- */
-FIRM_API ir_node *get_compound_ent_value(const ir_entity *ent, size_t pos);
-
-/**
- * @deprecated
- * return 1 if entity has a compound_graph-style initializer
- */
-FIRM_API int entity_has_compound_ent_values(const ir_entity *entity);
-
-#include "end.h"
-
-#endif
index 974b95e..52645b3 100644 (file)
@@ -64,7 +64,6 @@ typedef enum {
        k_ir_op,                  /**< An IR opcode. */
        k_tarval,                 /**< A tarval. */
        k_ir_loop,                /**< A loop. */
-       k_ir_compound_graph_path, /**< A compound graph path, see entity.h. */
        k_ir_prog,                /**< A program representation (irp). */
        k_ir_graph_pass,          /**< An ir_graph pass. */
        k_ir_prog_pass,           /**< An ir_prog pass. */
index 676018a..698bc76 100644 (file)
@@ -50,7 +50,6 @@ struct obstack;
  * - @%N The node number of an ir node.
  * - @%m The mode name of an ir mode.
  * - @%B The block node number of the nodes block.
- * - @%P A compound graph path.
  * - @%I An ident.
  * - @%D Print as many white spaces as given in the parameter.
  * - @%G A debug info (if available) from the given ir node.
index 5ff6dde..3ba0801 100644 (file)
@@ -232,7 +232,6 @@ libfirm_la_SOURCES = \
        stat/stat_dmp.c \
        stat/statev.c \
        stat/stat_timing.c \
-       tr/compound_path.c \
        tr/entity.c \
        tr/tpop.c \
        tr/tr_inheritance.c \
index 7cc59b2..8291fdf 100644 (file)
@@ -511,19 +511,6 @@ static void add_method_address(ir_entity *ent, pset *set)
 
        if (ent->initializer != NULL) {
                add_method_address_inititializer(get_entity_initializer(ent), set);
-       } else if (entity_has_compound_ent_values(ent)) {
-               size_t i, n;
-               for (i = 0, n = get_compound_ent_n_values(ent); i < n; ++i) {
-                       ir_node *irn = get_compound_ent_value(ent, i);
-
-                       /* let's check if it's the address of a function */
-                       if (is_SymConst_addr_ent(irn)) {
-                               ir_entity *ent2 = get_SymConst_entity(irn);
-
-                               if (is_Method_type(get_entity_type(ent2)))
-                                       pset_insert_ptr(set, ent2);
-                       }
-               }
        }
 }
 
index 95758d5..2e299c9 100644 (file)
@@ -1104,18 +1104,6 @@ static void check_initializer(ir_entity *ent)
 
        if (ent->initializer != NULL) {
                check_initializer_nodes(ent->initializer);
-       } else if (entity_has_compound_ent_values(ent)) {
-               size_t i, n;
-
-               for (i = 0, n = get_compound_ent_n_values(ent); i < n; ++i) {
-                       ir_node *irn = get_compound_ent_value(ent, i);
-
-                       /* let's check if it's an address */
-                       if (is_SymConst_addr_ent(irn)) {
-                               ir_entity *symconst_ent = get_SymConst_entity(irn);
-                               set_entity_usage(symconst_ent, ir_usage_unknown);
-                       }
-               }
        }
 }
 
index 6f86b11..9d927d7 100644 (file)
@@ -375,7 +375,6 @@ static int entity_is_string_const(const ir_entity *ent)
 {
        ir_type *type, *element_type;
        ir_mode *mode;
-       int i, c, n;
 
        type = get_entity_type(ent);
 
@@ -397,26 +396,6 @@ static int entity_is_string_const(const ir_entity *ent)
 
        if (ent->initializer != NULL) {
                return initializer_is_string_const(ent->initializer);
-       } else if (entity_has_compound_ent_values(ent)) {
-               int found_printable = 0;
-               /* if it contains only printable chars and a 0 at the end */
-               n = get_compound_ent_n_values(ent);
-               for (i = 0; i < n; ++i) {
-                       ir_node *irn = get_compound_ent_value(ent, i);
-                       if (! is_Const(irn))
-                               return 0;
-
-                       c = (int) get_tarval_long(get_Const_tarval(irn));
-
-                       if (isgraph(c) || isspace(c))
-                               found_printable = 1;
-                       else if (c != 0)
-                               return 0;
-
-                       if (i == n - 1 && c != '\0')
-                               return 0;
-               }
-               return found_printable;
        }
 
        return 0;
@@ -658,55 +637,6 @@ const char *be_gas_insn_label_prefix(void)
        return ".LE";
 }
 
-/**
- * Return the tarval of an atomic initializer.
- *
- * @param init  a node representing the initializer (on the const code irg)
- *
- * @return the tarval
- */
-static ir_tarval *get_atomic_init_tv(ir_node *init)
-{
-       for (;;) {
-               ir_mode *mode = get_irn_mode(init);
-
-               switch (get_irn_opcode(init)) {
-
-               case iro_Cast:
-                       init = get_Cast_op(init);
-                       continue;
-
-               case iro_Conv:
-                       init = get_Conv_op(init);
-                       continue;
-
-               case iro_Const:
-                       return get_Const_tarval(init);
-
-               case iro_SymConst:
-                       switch (get_SymConst_kind(init)) {
-                       case symconst_type_size:
-                               return new_tarval_from_long(get_type_size_bytes(get_SymConst_type(init)), mode);
-
-                       case symconst_type_align:
-                               return new_tarval_from_long(get_type_alignment_bytes(get_SymConst_type(init)), mode);
-
-                       case symconst_ofs_ent:
-                               return new_tarval_from_long(get_entity_offset(get_SymConst_entity(init)), mode);
-
-                       case symconst_enum_const:
-                               return get_enumeration_value(get_SymConst_enum(init));
-
-                       default:
-                               return NULL;
-                       }
-
-               default:
-                       return NULL;
-               }
-       }
-}
-
 /**
  * Dump an atomic value.
  *
@@ -822,62 +752,6 @@ static void emit_size_type(size_t size)
        }
 }
 
-/**
- * Dump a string constant.
- * No checks are made!!
- *
- * @param ent  The entity to dump.
- */
-static void emit_string_cst(const ir_entity *ent)
-{
-       int      i, len;
-       int      output_len;
-       ir_type *type;
-       int      type_size;
-       int      remaining_space;
-
-       len        = get_compound_ent_n_values(ent);
-       output_len = len;
-       if (be_gas_object_file_format == OBJECT_FILE_FORMAT_MACH_O) {
-               be_emit_cstring("\t.ascii \"");
-       } else {
-               be_emit_cstring("\t.string \"");
-               output_len -= 1;
-       }
-
-       for (i = 0; i < output_len; ++i) {
-               ir_node *irn;
-               int c;
-
-               irn = get_compound_ent_value(ent, i);
-               c = (int) get_tarval_long(get_Const_tarval(irn));
-
-               switch (c) {
-               case '"' : be_emit_cstring("\\\""); break;
-               case '\n': be_emit_cstring("\\n"); break;
-               case '\r': be_emit_cstring("\\r"); break;
-               case '\t': be_emit_cstring("\\t"); break;
-               case '\\': be_emit_cstring("\\\\"); break;
-               default  :
-                       if (isprint(c))
-                               be_emit_char(c);
-                       else
-                               be_emit_irprintf("\\%03o", c);
-                       break;
-               }
-       }
-       be_emit_cstring("\"\n");
-       be_emit_write_line();
-
-       type            = get_entity_type(ent);
-       type_size       = get_type_size_bytes(type);
-       remaining_space = type_size - len;
-       assert(remaining_space >= 0);
-       if (remaining_space > 0) {
-               be_emit_irprintf("\t.space\t%d, 0\n", remaining_space);
-       }
-}
-
 static size_t emit_string_initializer(const ir_initializer_t *initializer)
 {
        size_t i, len;
@@ -1329,117 +1203,6 @@ static void emit_initializer(be_gas_decl_env_t *env, const ir_entity *entity)
        xfree(vals);
 }
 
-static void emit_compound_graph_init(be_gas_decl_env_t *env,
-                                     const ir_entity *ent)
-{
-       normal_or_bitfield *vals;
-       int i, j, n;
-       unsigned k, last_ofs;
-
-       if (entity_is_string_const(ent)) {
-               emit_string_cst(ent);
-               return;
-       }
-
-       n = get_compound_ent_n_values(ent);
-
-       /* Find the initializer size. Sorrily gcc support a nasty feature:
-          The last field of a compound may be a flexible array. This allows
-          initializers bigger than the type size. */
-       last_ofs = get_type_size_bytes(get_entity_type(ent));
-       for (i = 0; i < n; ++i) {
-               unsigned offset         = get_compound_ent_value_offset_bytes(ent, i);
-               unsigned bits_remainder = get_compound_ent_value_offset_bit_remainder(ent, i);
-               ir_node  *value         = get_compound_ent_value(ent, i);
-               unsigned value_len      = get_mode_size_bits(get_irn_mode(value));
-
-               offset += (value_len + bits_remainder + 7) >> 3;
-
-               if (offset > last_ofs) {
-                       last_ofs = offset;
-               }
-       }
-
-       /*
-        * In the worst case, every initializer allocates one byte.
-        * Moreover, initializer might be big, do not allocate on stack.
-        */
-       vals = XMALLOCNZ(normal_or_bitfield, last_ofs);
-
-       /* collect the values and store them at the offsets */
-       for (i = 0; i < n; ++i) {
-               unsigned offset      = get_compound_ent_value_offset_bytes(ent, i);
-               int      offset_bits = get_compound_ent_value_offset_bit_remainder(ent, i);
-               ir_node  *value      = get_compound_ent_value(ent, i);
-               int      value_len   = get_mode_size_bits(get_irn_mode(value));
-
-               assert(offset_bits >= 0);
-
-               if (offset_bits != 0 ||
-                               (value_len != 8 && value_len != 16 && value_len != 32 && value_len != 64)) {
-                       ir_tarval *tv = get_atomic_init_tv(value);
-                       unsigned char curr_bits, last_bits = 0;
-                       if (tv == NULL) {
-                               panic("Couldn't get numeric value for bitfield initializer '%s'",
-                                               get_entity_ld_name(ent));
-                       }
-                       /* normalize offset */
-                       offset += offset_bits >> 3;
-                       offset_bits &= 7;
-
-                       for (j = 0; value_len + offset_bits > 0; ++j) {
-                               assert(offset + j < last_ofs);
-                               assert(vals[offset + j].kind == BITFIELD || vals[offset + j].v.value == NULL);
-                               vals[offset + j].kind = BITFIELD;
-                               curr_bits = get_tarval_sub_bits(tv, j);
-                               vals[offset + j].v.bf_val |= (last_bits >> (8 - offset_bits)) | (curr_bits << offset_bits);
-                               value_len -= 8;
-                               last_bits = curr_bits;
-                       }
-               } else {
-                       int i;
-
-                       assert(offset < last_ofs);
-                       assert(vals[offset].kind == NORMAL);
-                       for (i = 1; i < value_len / 8; ++i) {
-                               assert(vals[offset + i].v.value == NULL);
-                       }
-                       vals[offset].v.value = value;
-               }
-       }
-
-       /* now write them sorted */
-       for (k = 0; k < last_ofs; ) {
-               int space = 0, skip = 0;
-               if (vals[k].kind == NORMAL) {
-                       if (vals[k].v.value != NULL) {
-                               emit_node_data(env, vals[k].v.value, vals[k].type);
-                               skip = get_mode_size_bytes(get_irn_mode(vals[k].v.value)) - 1;
-                       } else {
-                               space = 1;
-                       }
-               } else {
-                       assert(vals[k].kind == BITFIELD);
-                       be_emit_irprintf("\t.byte\t%d\n", vals[k].v.bf_val);
-               }
-
-               ++k;
-               while (k < last_ofs && vals[k].kind == NORMAL && vals[k].v.value == NULL) {
-                       ++space;
-                       ++k;
-               }
-               space -= skip;
-               assert(space >= 0);
-
-               /* a gap */
-               if (space > 0) {
-                       be_emit_irprintf("\t.space\t%d, 0\n", space);
-                       be_emit_write_line();
-               }
-       }
-       xfree(vals);
-}
-
 static void emit_align(unsigned p2alignment)
 {
        be_emit_irprintf("\t.p2align\t%u\n", log2_floor(p2alignment));
@@ -1712,8 +1475,6 @@ static void emit_global(be_gas_decl_env_t *env, const ir_entity *entity)
                        be_emit_irprintf("\t.space %u, 0\n", get_type_size_bytes(type));
                        be_emit_write_line();
                }
-       } else if (entity_has_compound_ent_values(entity)) {
-               emit_compound_graph_init(env, entity);
        } else {
                assert(entity->initializer != NULL);
                emit_initializer(env, entity);
index 8f8339c..6ee1608 100644 (file)
@@ -689,7 +689,6 @@ static void show_firm_object(void *firm_thing)
        case k_ir_op:
        case k_tarval:
        case k_ir_loop:
-       case k_ir_compound_graph_path:
        case k_ir_prog:
                fprintf(f, "NIY\n");
                break;
index e3ea450..2432daa 100644 (file)
@@ -118,12 +118,10 @@ static int firm_emit(lc_appendable_t *app,
 
        void *X = (void*)arg->v_ptr;
        firm_kind *obj = (firm_kind*)X;
-       size_t i, n;
        ir_node *block;
        char add[64];
        char buf[256];
        char tv_buf[256];
-       ir_entity *ent;
 
        buf[0] = '\0';
        add[0] = '\0';
@@ -225,24 +223,6 @@ static int firm_emit(lc_appendable_t *app,
                snprintf(buf, sizeof(buf), "%s%s", A("op"), get_op_name(op));
                break;
        }
-       case k_ir_compound_graph_path: {
-               compound_graph_path *path = (compound_graph_path*)X;
-               n = get_compound_graph_path_length(path);
-
-               for (i = 0; i < n; ++i) {
-                       ent = get_compound_graph_path_node(path, i);
-
-                       strncat(buf, ".", sizeof(buf)-1);
-                       strncat(buf, get_entity_name(ent), sizeof(buf)-1);
-                       if (is_Array_type(get_entity_owner(ent))) {
-                               snprintf(add, sizeof(add), "[%ld]",
-                                       get_compound_graph_path_array_index(path, i));
-                               strncat(buf, add, sizeof(buf)-1);
-                       }
-               }
-               add[0] = '\0';
-               break;
-       }
 
        default:
                snprintf(buf, sizeof(buf), "UNKWN");
@@ -321,7 +301,6 @@ lc_arg_env_t *firm_get_arg_env(void)
                {"firm:irn_nr",    'N'},
                {"firm:mode",      'm'},
                {"firm:block",     'B'},
-               {"firm:cg_path",   'P'},
        };
 
        size_t i;
index 1f3494e..25e011c 100644 (file)
@@ -414,24 +414,6 @@ static void print_node_ent_edge(FILE *F, const ir_node *irn, const ir_entity *en
        va_end(ap);
 }
 
-/**
- * Prints the edge from an entity ent to a node irn with additional info fmt, ...
- * to the file F.
- */
-static void print_ent_node_edge(FILE *F, const ir_entity *ent, const ir_node *irn, const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       fprintf(F, "edge: { sourcename: ");
-       print_entityid(F, ent);
-       fprintf(F, "\" targetname: ");
-       print_nodeid(F, irn);
-       ir_vfprintf(F, fmt, ap);
-       fprintf(F,"}\n");
-       va_end(ap);
-}
-
 /**
  * Prints the edge from a type tp to an enumeration item item with additional info fmt, ...
  * to the file F.
@@ -1634,7 +1616,6 @@ static void dump_type_info(type_or_ent tore, void *env)
        switch (get_kind(tore.ent)) {
        case k_entity: {
                ir_entity *ent = tore.ent;
-               ir_node *value;
                /* The node */
                dump_entity_node(F, ent);
                /* The Edges */
@@ -1651,21 +1632,6 @@ static void dump_type_info(type_or_ent tore, void *env)
                        if (ent->initializer != NULL) {
                                /* new style initializers */
                                dump_entity_initializer(F, ent);
-                       } else if (entity_has_compound_ent_values(ent)) {
-                               /* old style compound entity values */
-                               for (i = get_compound_ent_n_values(ent); i > 0;) {
-                                       value = get_compound_ent_value(ent, --i);
-                                       if (value) {
-                                               print_ent_node_edge(F, ent, value, ENT_VALUE_EDGE_ATTR, i);
-                                               dump_const_expression(F, value);
-                                               print_ent_ent_edge(F, ent, get_compound_ent_value_member(ent, i), 0, ird_color_none, ENT_CORR_EDGE_ATTR, i);
-                                               /*
-                                               fprintf(F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
-                                               ENT_CORR_EDGE_ATTR  "}\n", GET_ENTID(ent),
-                                               get_compound_ent_value_member(ent, i), i);
-                                               */
-                                       }
-                               }
                        }
                }
                break;
index d61fe6c..f8842d0 100644 (file)
@@ -602,27 +602,6 @@ static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, const char *pref
                        need_nl = 1;
                        dump_ir_initializers_to_file(F, prefix, initializer, get_entity_type(ent));
                        fputc('\n', F);
-               } else if (entity_has_compound_ent_values(ent)) {
-                       size_t i;
-                       fprintf(F, "%s  compound values:", prefix);
-                       for (i = 0; i < get_compound_ent_n_values(ent); ++i) {
-                               size_t j;
-                               compound_graph_path *path = get_compound_ent_value_path(ent, i);
-                               ir_entity *ent0 = get_compound_graph_path_node(path, 0);
-                               fprintf(F, "\n%s    %3d:%d ", prefix, get_entity_offset(ent0), get_entity_offset_bits_remainder(ent0));
-                               if (get_type_state(type) == layout_fixed)
-                                       fprintf(F, "(%3u:%u) ",   get_compound_ent_value_offset_bytes(ent, i), get_compound_ent_value_offset_bit_remainder(ent, i));
-                               fprintf(F, "%s", get_entity_name(ent));
-                               for (j = 0; j < get_compound_graph_path_length(path); ++j) {
-                                       ir_entity *node = get_compound_graph_path_node(path, j);
-                                       fprintf(F, ".%s", get_entity_name(node));
-                                       if (is_Array_type(get_entity_owner(node)))
-                                               fprintf(F, "[%ld]", get_compound_graph_path_array_index(path, j));
-                               }
-                               fprintf(F, "\t = ");
-                               dump_node_opcode(F, get_compound_ent_value(ent, i));
-                       }
-                       fputc('\n', F);
                }
        }
 
index 48b8165..376e2ea 100644 (file)
@@ -438,11 +438,6 @@ static void walk_entity(ir_entity *ent, void *env)
 
        if (ent->initializer != NULL) {
                walk_initializer(ent->initializer, my_env);
-       } else if (entity_has_compound_ent_values(ent)) {
-               size_t i, n_vals = get_compound_ent_n_values(ent);
-
-               for (i = 0; i < n_vals; i++)
-                       irg_walk(get_compound_ent_value(ent, i), my_env->pre, my_env->post, my_env->env);
        }
 }
 
index ea90cad..19aee19 100644 (file)
@@ -819,9 +819,6 @@ static void write_entity(write_env_t *env, ir_entity *ent)
                if (ent->initializer != NULL) {
                        write_symbol(env, "initializer");
                        write_initializer(env, get_entity_initializer(ent));
-               } else if (entity_has_compound_ent_values(ent)) {
-                       /* compound graph API is deprecated */
-                       panic("exporting compound_graph initializers not supported");
                } else {
                        write_symbol(env, "none");
                }
index 8a5d2fd..47f7936 100644 (file)
@@ -689,25 +689,6 @@ static ir_node *eval_strlen(ir_graph *irg, ir_entity *ent, ir_type *res_tp)
        if (!mode_is_int(mode) || get_mode_size_bits(mode) != 8)
                return NULL;
 
-       if (!has_entity_initializer(ent)) {
-               size_t i, n;
-
-               n = get_compound_ent_n_values(ent);
-               for (i = 0; i < n; ++i) {
-                       ir_node *irn = get_compound_ent_value(ent, i);
-
-                       if (! is_Const(irn))
-                               return NULL;
-
-                       if (is_Const_null(irn)) {
-                               /* found the length */
-                               ir_tarval *tv = new_tarval_from_long(i, get_type_mode(res_tp));
-                               return new_r_Const(irg, tv);
-                       }
-               }
-               return NULL;
-       }
-
        initializer = get_entity_initializer(ent);
        if (get_initializer_kind(initializer) != IR_INITIALIZER_COMPOUND)
                return NULL;
@@ -796,54 +777,6 @@ static ir_node *eval_strcmp(ir_graph *irg, ir_entity *left, ir_entity *right,
        if (!mode_is_int(mode) || get_mode_size_bits(mode) != 8)
                return NULL;
 
-       if (!has_entity_initializer(left) && !has_entity_initializer(right)) {
-               /* code that uses deprecated compound_graph_path stuff */
-               size_t n   = get_compound_ent_n_values(left);
-               size_t n_r = get_compound_ent_n_values(right);
-               size_t i;
-               int    res = 0;
-
-               if (n_r < n)
-                       n = n_r;
-               for (i = 0; i < n; ++i) {
-                       ir_node *irn;
-                       long v_l, v_r;
-                       ir_tarval *tv;
-
-                       irn = get_compound_ent_value(left, i);
-                       if (! is_Const(irn))
-                               return NULL;
-                       tv = get_Const_tarval(irn);
-                       v_l = get_tarval_long(tv);
-
-                       irn = get_compound_ent_value(right, i);
-                       if (! is_Const(irn))
-                               return NULL;
-                       tv = get_Const_tarval(irn);
-                       v_r = get_tarval_long(tv);
-
-                       if (v_l < v_r) {
-                               res = -1;
-                               break;
-                       }
-                       if (v_l > v_r) {
-                               res = +1;
-                               break;
-                       }
-
-                       if (v_l == 0) {
-                               res = 0;
-                               break;
-                       }
-               }
-               if (i < n) {
-                       /* we found an end */
-                       ir_tarval *tv = new_tarval_from_long(res, get_type_mode(res_tp));
-                       return new_r_Const(irg, tv);
-               }
-               return NULL;
-       }
-
        init_l = get_entity_initializer(left);
        init_r = get_entity_initializer(right);
        if (get_initializer_kind(init_l) != IR_INITIALIZER_COMPOUND ||
@@ -891,7 +824,6 @@ static int is_empty_string(ir_entity *ent)
 {
        ir_type          *tp = get_entity_type(ent);
        ir_mode          *mode;
-       ir_node          *irn;
        ir_initializer_t *initializer;
        ir_initializer_t *init0;
 
@@ -906,16 +838,6 @@ static int is_empty_string(ir_entity *ent)
        if (!mode_is_int(mode) || get_mode_size_bits(mode) != 8)
                return 0;
 
-       if (!has_entity_initializer(ent)) {
-               /* code for deprecated compound_graph_path stuff */
-               size_t n = get_compound_ent_n_values(ent);
-               if (n < 1)
-                       return 0;
-               irn = get_compound_ent_value(ent, 0);
-
-               return is_Const(irn) && is_Const_null(irn);
-       }
-
        initializer = get_entity_initializer(ent);
        if (get_initializer_kind(initializer) != IR_INITIALIZER_COMPOUND)
                return 0;
index 08cc9a7..ddaf9fd 100644 (file)
@@ -100,13 +100,6 @@ static void visit_entity(ir_entity *entity)
 
        if (entity->initializer != NULL) {
                visit_initializer(entity->initializer);
-       }  else if (entity_has_compound_ent_values(entity)) {
-               size_t i;
-               size_t n_members = get_compound_ent_n_values(entity);
-               for (i = 0; i < n_members; ++i) {
-                       ir_node *node = get_compound_ent_value(entity, i);
-                       start_visit_node(node);
-               }
        }
 
        irg = get_entity_irg(entity);
index be0a1ba..7aca233 100644 (file)
@@ -338,170 +338,6 @@ static long get_Sel_array_index_long(ir_node *n, int dim)
        return get_tarval_long(get_Const_tarval(index));
 }  /* get_Sel_array_index_long */
 
-/**
- * Returns the accessed component graph path for an
- * node computing an address.
- *
- * @param ptr    the node computing the address
- * @param depth  current depth in steps upward from the root
- *               of the address
- */
-static compound_graph_path *rec_get_accessed_path(ir_node *ptr, size_t depth)
-{
-       compound_graph_path *res = NULL;
-       ir_entity           *root, *field, *ent;
-       size_t              path_len, pos, idx;
-       ir_tarval           *tv;
-       ir_type             *tp;
-
-       if (is_SymConst(ptr)) {
-               /* a SymConst. If the depth is 0, this is an access to a global
-                * entity and we don't need a component path, else we know
-                * at least its length.
-                */
-               assert(get_SymConst_kind(ptr) == symconst_addr_ent);
-               root = get_SymConst_entity(ptr);
-               res = (depth == 0) ? NULL : new_compound_graph_path(get_entity_type(root), depth);
-       } else if (is_Sel(ptr)) {
-               /* it's a Sel, go up until we find the root */
-               res = rec_get_accessed_path(get_Sel_ptr(ptr), depth+1);
-               if (res == NULL)
-                       return NULL;
-
-               /* fill up the step in the path at the current position */
-               field    = get_Sel_entity(ptr);
-               path_len = get_compound_graph_path_length(res);
-               pos      = path_len - depth - 1;
-               set_compound_graph_path_node(res, pos, field);
-
-               if (is_Array_type(get_entity_owner(field))) {
-                       assert(get_Sel_n_indexs(ptr) == 1 && "multi dim arrays not implemented");
-                       set_compound_graph_path_array_index(res, pos, get_Sel_array_index_long(ptr, 0));
-               }
-       } else if (is_Add(ptr)) {
-               ir_mode   *mode;
-               ir_tarval *tmp;
-
-               {
-                       ir_node   *l    = get_Add_left(ptr);
-                       ir_node   *r    = get_Add_right(ptr);
-                       if (is_Const(r) && get_irn_mode(l) == get_irn_mode(ptr)) {
-                               ptr = l;
-                               tv  = get_Const_tarval(r);
-                       } else {
-                               ptr = r;
-                               tv  = get_Const_tarval(l);
-                       }
-               }
-ptr_arith:
-               mode = get_tarval_mode(tv);
-               tmp  = tv;
-
-               /* ptr must be a Sel or a SymConst, this was checked in find_constant_entity() */
-               if (is_Sel(ptr)) {
-                       field = get_Sel_entity(ptr);
-               } else {
-                       field = get_SymConst_entity(ptr);
-               }
-               idx = 0;
-               for (ent = field;;) {
-                       unsigned   size;
-                       ir_tarval *sz, *tv_index, *tlower, *tupper;
-                       ir_node   *bound;
-
-                       tp = get_entity_type(ent);
-                       if (! is_Array_type(tp))
-                               break;
-                       ent = get_array_element_entity(tp);
-                       size = get_type_size_bytes(get_entity_type(ent));
-                       sz   = new_tarval_from_long(size, mode);
-
-                       tv_index = tarval_div(tmp, sz);
-                       tmp      = tarval_mod(tmp, sz);
-
-                       if (tv_index == tarval_bad || tmp == tarval_bad)
-                               return NULL;
-
-                       assert(get_array_n_dimensions(tp) == 1 && "multiarrays not implemented");
-                       bound  = get_array_lower_bound(tp, 0);
-                       tlower = computed_value(bound);
-                       bound  = get_array_upper_bound(tp, 0);
-                       tupper = computed_value(bound);
-
-                       if (tlower == tarval_bad || tupper == tarval_bad)
-                               return NULL;
-
-                       if (tarval_cmp(tv_index, tlower) == ir_relation_less)
-                               return NULL;
-                       if (tarval_cmp(tupper, tv_index) == ir_relation_less)
-                               return NULL;
-
-                       /* ok, bounds check finished */
-                       ++idx;
-               }
-               if (! tarval_is_null(tmp)) {
-                       /* access to some struct/union member */
-                       return NULL;
-               }
-
-               /* should be at least ONE array */
-               if (idx == 0)
-                       return NULL;
-
-               res = rec_get_accessed_path(ptr, depth + idx);
-               if (res == NULL)
-                       return NULL;
-
-               path_len = get_compound_graph_path_length(res);
-               pos      = path_len - depth - idx;
-
-               for (ent = field;;) {
-                       unsigned   size;
-                       ir_tarval *sz, *tv_index;
-                       long       index;
-
-                       tp = get_entity_type(ent);
-                       if (! is_Array_type(tp))
-                               break;
-                       ent = get_array_element_entity(tp);
-                       set_compound_graph_path_node(res, pos, ent);
-
-                       size = get_type_size_bytes(get_entity_type(ent));
-                       sz   = new_tarval_from_long(size, mode);
-
-                       tv_index = tarval_div(tv, sz);
-                       tv       = tarval_mod(tv, sz);
-
-                       /* worked above, should work again */
-                       assert(tv_index != tarval_bad && tv != tarval_bad);
-
-                       /* bounds already checked above */
-                       index = get_tarval_long(tv_index);
-                       set_compound_graph_path_array_index(res, pos, index);
-                       ++pos;
-               }
-       } else if (is_Sub(ptr)) {
-               ir_node *l = get_Sub_left(ptr);
-               ir_node *r = get_Sub_right(ptr);
-
-               ptr = l;
-               tv  = get_Const_tarval(r);
-               tv  = tarval_neg(tv);
-               goto ptr_arith;
-       }
-       return res;
-}  /* rec_get_accessed_path */
-
-/**
- * Returns an access path or NULL.  The access path is only
- * valid, if the graph is in phase_high and _no_ address computation is used.
- */
-static compound_graph_path *get_accessed_path(ir_node *ptr)
-{
-       compound_graph_path *gr = rec_get_accessed_path(ptr, 0);
-       return gr;
-}  /* get_accessed_path */
-
 typedef struct path_entry {
        ir_entity         *ent;
        struct path_entry *next;
@@ -1167,17 +1003,6 @@ static unsigned optimize_load(ir_node *load)
                        if (has_entity_initializer(ent)) {
                                /* new style initializer */
                                value = find_compound_ent_value(ptr);
-                       } else if (entity_has_compound_ent_values(ent)) {
-                               /* old style initializer */
-                               compound_graph_path *path = get_accessed_path(ptr);
-
-                               if (path != NULL) {
-                                       assert(is_proper_compound_graph_path(path, get_compound_graph_path_length(path)-1));
-
-                                       value = get_compound_ent_value_by_path(ent, path);
-                                       DB((dbg, LEVEL_1, "  Constant access at %F%F resulted in %+F\n", ent, path, value));
-                                       free_compound_graph_path(path);
-                               }
                        }
                        if (value != NULL) {
                                ir_graph *irg = get_irn_irg(load);
index fb7ff96..c389544 100644 (file)
@@ -631,170 +631,6 @@ static long get_Sel_array_index_long(ir_node *n, int dim)
        return get_tarval_long(get_Const_tarval(index));
 }  /* get_Sel_array_index_long */
 
-/**
- * Returns the accessed component graph path for an
- * node computing an address.
- *
- * @param ptr    the node computing the address
- * @param depth  current depth in steps upward from the root
- *               of the address
- */
-static compound_graph_path *rec_get_accessed_path(ir_node *ptr, size_t depth)
-{
-       compound_graph_path *res = NULL;
-       ir_entity           *root, *field, *ent;
-       size_t              path_len, pos, idx;
-       ir_tarval           *tv;
-       ir_type             *tp;
-
-       if (is_SymConst(ptr)) {
-               /* a SymConst. If the depth is 0, this is an access to a global
-                * entity and we don't need a component path, else we know
-                * at least its length.
-                */
-               assert(get_SymConst_kind(ptr) == symconst_addr_ent);
-               root = get_SymConst_entity(ptr);
-               res = (depth == 0) ? NULL : new_compound_graph_path(get_entity_type(root), depth);
-       } else if (is_Sel(ptr)) {
-               /* it's a Sel, go up until we find the root */
-               res = rec_get_accessed_path(get_Sel_ptr(ptr), depth+1);
-               if (res == NULL)
-                       return NULL;
-
-               /* fill up the step in the path at the current position */
-               field    = get_Sel_entity(ptr);
-               path_len = get_compound_graph_path_length(res);
-               pos      = path_len - depth - 1;
-               set_compound_graph_path_node(res, pos, field);
-
-               if (is_Array_type(get_entity_owner(field))) {
-                       assert(get_Sel_n_indexs(ptr) == 1 && "multi dim arrays not implemented");
-                       set_compound_graph_path_array_index(res, pos, get_Sel_array_index_long(ptr, 0));
-               }
-       } else if (is_Add(ptr)) {
-               ir_mode   *mode;
-               ir_tarval *tmp;
-
-               {
-                       ir_node *l = get_Add_left(ptr);
-                       ir_node *r = get_Add_right(ptr);
-                       if (is_Const(r) && get_irn_mode(l) == get_irn_mode(ptr)) {
-                               ptr = l;
-                               tv  = get_Const_tarval(r);
-                       } else {
-                               ptr = r;
-                               tv  = get_Const_tarval(l);
-                       }
-               }
-ptr_arith:
-               mode = get_tarval_mode(tv);
-               tmp  = tv;
-
-               /* ptr must be a Sel or a SymConst, this was checked in find_constant_entity() */
-               if (is_Sel(ptr)) {
-                       field = get_Sel_entity(ptr);
-               } else {
-                       field = get_SymConst_entity(ptr);
-               }
-               idx = 0;
-               for (ent = field;;) {
-                       unsigned  size;
-                       ir_tarval *sz, *tv_index, *tlower, *tupper;
-                       ir_node   *bound;
-
-                       tp = get_entity_type(ent);
-                       if (! is_Array_type(tp))
-                               break;
-                       ent = get_array_element_entity(tp);
-                       size = get_type_size_bytes(get_entity_type(ent));
-                       sz   = new_tarval_from_long(size, mode);
-
-                       tv_index = tarval_div(tmp, sz);
-                       tmp      = tarval_mod(tmp, sz);
-
-                       if (tv_index == tarval_bad || tmp == tarval_bad)
-                               return NULL;
-
-                       assert(get_array_n_dimensions(tp) == 1 && "multiarrays not implemented");
-                       bound  = get_array_lower_bound(tp, 0);
-                       tlower = computed_value(bound);
-                       bound  = get_array_upper_bound(tp, 0);
-                       tupper = computed_value(bound);
-
-                       if (tlower == tarval_bad || tupper == tarval_bad)
-                               return NULL;
-
-                       if (tarval_cmp(tv_index, tlower) == ir_relation_less)
-                               return NULL;
-                       if (tarval_cmp(tupper, tv_index) == ir_relation_less)
-                               return NULL;
-
-                       /* ok, bounds check finished */
-                       ++idx;
-               }
-               if (! tarval_is_null(tmp)) {
-                       /* access to some struct/union member */
-                       return NULL;
-               }
-
-               /* should be at least ONE array */
-               if (idx == 0)
-                       return NULL;
-
-               res = rec_get_accessed_path(ptr, depth + idx);
-               if (res == NULL)
-                       return NULL;
-
-               path_len = get_compound_graph_path_length(res);
-               pos      = path_len - depth - idx;
-
-               for (ent = field;;) {
-                       unsigned   size;
-                       ir_tarval *sz, *tv_index;
-                       long       index;
-
-                       tp = get_entity_type(ent);
-                       if (! is_Array_type(tp))
-                               break;
-                       ent = get_array_element_entity(tp);
-                       set_compound_graph_path_node(res, pos, ent);
-
-                       size = get_type_size_bytes(get_entity_type(ent));
-                       sz   = new_tarval_from_long(size, mode);
-
-                       tv_index = tarval_div(tv, sz);
-                       tv       = tarval_mod(tv, sz);
-
-                       /* worked above, should work again */
-                       assert(tv_index != tarval_bad && tv != tarval_bad);
-
-                       /* bounds already checked above */
-                       index = get_tarval_long(tv_index);
-                       set_compound_graph_path_array_index(res, pos, index);
-                       ++pos;
-               }
-       } else if (is_Sub(ptr)) {
-               ir_node *l = get_Sub_left(ptr);
-               ir_node *r = get_Sub_right(ptr);
-
-               ptr = l;
-               tv  = get_Const_tarval(r);
-               tv  = tarval_neg(tv);
-               goto ptr_arith;
-       }
-       return res;
-}  /* rec_get_accessed_path */
-
-/**
- * Returns an access path or NULL.  The access path is only
- * valid, if the graph is in phase_high and _no_ address computation is used.
- */
-static compound_graph_path *get_accessed_path(ir_node *ptr)
-{
-       compound_graph_path *gr = rec_get_accessed_path(ptr, 0);
-       return gr;
-}  /* get_accessed_path */
-
 typedef struct path_entry {
        ir_entity         *ent;
        struct path_entry *next;
@@ -1079,17 +915,6 @@ static void update_Load_memop(memop_t *m)
                        if (ent->initializer) {
                                /* new style initializer */
                                value = find_compound_ent_value(ptr);
-                       } else if (entity_has_compound_ent_values(ent)) {
-                               /* old style initializer */
-                               compound_graph_path *path = get_accessed_path(ptr);
-
-                               if (path != NULL) {
-                                       assert(is_proper_compound_graph_path(path, get_compound_graph_path_length(path)-1));
-
-                                       value = get_compound_ent_value_by_path(ent, path);
-                                       DB((dbg, LEVEL_1, "  Constant access at %F%F resulted in %+F\n", ent, path, value));
-                                       free_compound_graph_path(path);
-                               }
                        }
                        if (value != NULL)
                                value = can_replace_load_by_const(load, value);
diff --git a/ir/tr/compound_path.c b/ir/tr/compound_path.c
deleted file mode 100644 (file)
index 1ed2286..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
- *
- * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
- */
-
-/**
- * @file
- * @author  Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
- */
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdbool.h>
-#include <assert.h>
-
-#include "firm_types.h"
-#include "typerep.h"
-#include "compound_path_t.h"
-#include "xmalloc.h"
-#include "type_t.h"
-#include "entity_t.h"
-#include "irgraph_t.h"
-#include "ircons.h"
-
-compound_graph_path *new_compound_graph_path(ir_type *tp, size_t length)
-{
-       compound_graph_path *res;
-
-       assert(is_compound_type(tp) || is_Array_type(tp));
-       assert(length > 0);
-
-       res = XMALLOCFZ(compound_graph_path, list, length);
-       res->kind = k_ir_compound_graph_path;
-       res->tp   = tp;
-       res->len  = length;
-
-       return res;
-}
-
-void free_compound_graph_path(compound_graph_path *gr)
-{
-       assert(gr && is_compound_graph_path(gr));
-       gr->kind = k_BAD;
-       free(gr);
-}
-
-int is_compound_graph_path(const void *thing)
-{
-       return get_kind(thing) == k_ir_compound_graph_path;
-}
-
-int is_proper_compound_graph_path(compound_graph_path *gr, size_t pos)
-{
-       size_t i;
-       ir_entity *node;
-       ir_type *owner = gr->tp;
-
-       for (i = 0; i <= pos; i++) {
-               node = get_compound_graph_path_node(gr, i);
-               if (node == NULL)
-                       /* Path not yet complete. */
-                       return 1;
-               if (get_entity_owner(node) != owner)
-                       return 0;
-               owner = get_entity_type(node);
-       }
-       if (pos == get_compound_graph_path_length(gr))
-               if (!is_atomic_type(owner))
-                       return 0;
-               return 1;
-}
-
-size_t get_compound_graph_path_length(const compound_graph_path *gr)
-{
-       assert(gr && is_compound_graph_path(gr));
-       return gr->len;
-}
-
-ir_entity *get_compound_graph_path_node(const compound_graph_path *gr,
-                                        size_t pos)
-{
-       assert(gr && is_compound_graph_path(gr));
-       assert(pos < gr->len);
-       return gr->list[pos].node;
-}
-
-void set_compound_graph_path_node(compound_graph_path *gr, size_t pos,
-                                  ir_entity *node)
-{
-       assert(gr && is_compound_graph_path(gr));
-       assert(pos < gr->len);
-       assert(is_entity(node));
-       gr->list[pos].node = node;
-       assert(is_proper_compound_graph_path(gr, pos));
-}
-
-long get_compound_graph_path_array_index(const compound_graph_path *gr, size_t pos)
-{
-       assert(gr && is_compound_graph_path(gr));
-       assert(pos < gr->len);
-       return gr->list[pos].index;
-}
-
-void set_compound_graph_path_array_index(compound_graph_path *gr, size_t pos,
-                                         long index)
-{
-       assert(gr && is_compound_graph_path(gr));
-       assert(pos < gr->len);
-       gr->list[pos].index = index;
-}
-
-ir_type *get_compound_graph_path_type(const compound_graph_path *gr)
-{
-       assert(gr && is_compound_graph_path(gr));
-       return gr->tp;
-}
-
-static void allocate_values(ir_entity *ent)
-{
-       if (ent->attr.cmpd_attr.values == NULL) {
-               ent->attr.cmpd_attr.values = NEW_ARR_F(ir_node*, 0);
-               assert(ent->attr.cmpd_attr.val_paths == NULL);
-               ent->attr.cmpd_attr.val_paths = NEW_ARR_F(compound_graph_path*, 0);
-       }
-}
-
-void add_compound_ent_value_w_path(ir_entity *ent, ir_node *val,
-                                   compound_graph_path *path)
-{
-       assert(is_compound_entity(ent));
-       assert(is_compound_graph_path(path));
-       allocate_values(ent);
-       ARR_APP1(ir_node *, ent->attr.cmpd_attr.values, val);
-       ARR_APP1(compound_graph_path *, ent->attr.cmpd_attr.val_paths, path);
-}
-
-void set_compound_ent_value_w_path(ir_entity *ent, ir_node *val,
-                                   compound_graph_path *path, size_t pos)
-{
-       assert(is_compound_entity(ent));
-       assert(is_compound_graph_path(path));
-       assert(pos < ARR_LEN(ent->attr.cmpd_attr.values));
-       ent->attr.cmpd_attr.values[pos]    = val;
-       ent->attr.cmpd_attr.val_paths[pos] = path;
-}
-
-compound_graph_path *get_compound_ent_value_path(const ir_entity *ent,
-                                                 size_t pos)
-{
-       assert(is_compound_entity(ent));
-       assert(ent->initializer == NULL);
-       assert(pos < ARR_LEN(ent->attr.cmpd_attr.val_paths));
-       return ent->attr.cmpd_attr.val_paths[pos];
-}
-
-/**
- * Returns non-zero, if two compound_graph_pathes are equal
- *
- * @param path1            the first path
- * @param path2            the second path
- */
-static bool equal_paths(compound_graph_path *path1, compound_graph_path *path2)
-{
-       size_t i;
-       size_t len1 = get_compound_graph_path_length(path1);
-       size_t len2 = get_compound_graph_path_length(path2);
-
-       if (len2 != len1) return false;
-
-       for (i = 0; i < len1; i++) {
-               ir_type *tp;
-               ir_entity *node1 = get_compound_graph_path_node(path1, i);
-               ir_entity *node2 = get_compound_graph_path_node(path2, i);
-
-               if (node1 != node2) return false;
-
-               tp = get_entity_owner(node1);
-               if (is_Array_type(tp)) {
-                       size_t index1 = get_compound_graph_path_array_index(path1, i);
-                       size_t index2 = get_compound_graph_path_array_index(path2, i);
-                       if (index1 != index2)
-                               return false;
-               }
-       }
-       return true;
-}
-
-/**
- * Returns the position of a value with the given path.
- * The path must contain array indices for all array element entities.
- *
- * @todo  This implementation is very slow (O(number of initializers * |path|)
- *        and should be replaced when the new tree oriented
- *        value representation is finally implemented.
- */
-static size_t get_compound_ent_pos_by_path(const ir_entity *ent,
-                                           compound_graph_path *path)
-{
-       size_t i, n_paths = get_compound_ent_n_values(ent);
-
-       for (i = 0; i < n_paths; i ++) {
-               compound_graph_path *gr = get_compound_ent_value_path(ent, i);
-               if (equal_paths(gr, path))
-                       return i;
-       }
-       return (size_t)-1;
-}
-
-ir_node *get_compound_ent_value_by_path(const ir_entity *ent,
-                                        compound_graph_path *path)
-{
-       size_t pos = get_compound_ent_pos_by_path(ent, path);
-       if (pos != (size_t)-1)
-               return get_compound_ent_value(ent, pos);
-       return NULL;
-}
-
-void remove_compound_ent_value(ir_entity *ent, ir_entity *value_ent)
-{
-       size_t i, n;
-       assert(is_compound_entity(ent));
-
-       n = ARR_LEN(ent->attr.cmpd_attr.val_paths);
-       for (i = 0; i < n; ++i) {
-               compound_graph_path *path = ent->attr.cmpd_attr.val_paths[i];
-               if (path->list[path->len-1].node == value_ent) {
-                       for (; i < n - 1; ++i) {
-                               ent->attr.cmpd_attr.val_paths[i] = ent->attr.cmpd_attr.val_paths[i+1];
-                               ent->attr.cmpd_attr.values[i]    = ent->attr.cmpd_attr.values[i+1];
-                       }
-                       ARR_SETLEN(compound_graph_path*, ent->attr.cmpd_attr.val_paths, n - 1);
-                       ARR_SETLEN(ir_node*,             ent->attr.cmpd_attr.values,    n - 1);
-                       break;
-               }
-       }
-}
-
-void add_compound_ent_value(ir_entity *ent, ir_node *val, ir_entity *member)
-{
-       compound_graph_path *path;
-       ir_type *owner_tp = get_entity_owner(member);
-       assert(is_compound_entity(ent));
-       allocate_values(ent);
-       path = new_compound_graph_path(get_entity_type(ent), 1);
-       path->list[0].node = member;
-       if (is_Array_type(owner_tp)) {
-               long max;
-               size_t i, n;
-
-               assert(get_array_n_dimensions(owner_tp) == 1 && has_array_lower_bound(owner_tp, 0));
-               max = get_array_lower_bound_int(owner_tp, 0) -1;
-               for (i = 0, n = get_compound_ent_n_values(ent); i < n; ++i) {
-                       long index = get_compound_graph_path_array_index(get_compound_ent_value_path(ent, i), 0);
-                       if (index > max) {
-                               max = index;
-                       }
-               }
-               path->list[0].index = max + 1;
-       }
-       add_compound_ent_value_w_path(ent, val, path);
-}
-
-ir_entity *get_compound_ent_value_member(const ir_entity *ent, size_t pos)
-{
-       compound_graph_path *path;
-       assert(is_compound_entity(ent));
-       path = get_compound_ent_value_path(ent, pos);
-
-       return get_compound_graph_path_node(path, get_compound_graph_path_length(path)-1);
-}
-
-void set_compound_ent_value(ir_entity *ent, ir_node *val, ir_entity *member,
-                            size_t pos)
-{
-       compound_graph_path *path;
-       assert(is_compound_entity(ent));
-       path = get_compound_ent_value_path(ent, pos);
-       set_compound_graph_path_node(path, 0, member);
-       set_compound_ent_value_w_path(ent, val, path, pos);
-}
-
-void set_array_entity_values(ir_entity *ent, ir_tarval **values, size_t num_vals)
-{
-       size_t i;
-       ir_type  *arrtp = get_entity_type(ent);
-       ir_node  *val;
-       ir_graph *irg = get_const_code_irg();
-
-       assert(is_Array_type(arrtp));
-       assert(get_array_n_dimensions(arrtp) == 1);
-       /* One bound is sufficient, the number of constant fields makes the
-          size. */
-       assert(get_array_lower_bound (arrtp, 0) || get_array_upper_bound (arrtp, 0));
-
-       for (i = 0; i < num_vals; i++) {
-               val = new_r_Const(irg, values[i]);
-               add_compound_ent_value(ent, val, get_array_element_entity(arrtp));
-               set_compound_graph_path_array_index(get_compound_ent_value_path(ent, i), 0, i);
-       }
-}
-
-unsigned get_compound_ent_value_offset_bytes(const ir_entity *ent, size_t pos)
-{
-       compound_graph_path *path;
-       size_t path_len, i;
-       unsigned offset = 0;
-       ir_type *curr_tp;
-
-       assert(get_type_state(get_entity_type(ent)) == layout_fixed);
-
-       path     = get_compound_ent_value_path(ent, pos);
-       path_len = get_compound_graph_path_length(path);
-       curr_tp  = path->tp;
-
-       for (i = 0; i < path_len; ++i) {
-               if (is_Array_type(curr_tp)) {
-                       ir_type *elem_type = get_array_element_type(curr_tp);
-                       unsigned size      = get_type_size_bytes(elem_type);
-                       unsigned align     = get_type_alignment_bytes(elem_type);
-                       size_t   idx;
-
-                       assert(size > 0);
-                       if (size % align > 0) {
-                               size += align - (size % align);
-                       }
-                       idx = get_compound_graph_path_array_index(path, i);
-                       assert(idx != (size_t)-1);
-                       offset += size * idx;
-                       curr_tp = elem_type;
-               } else {
-                       ir_entity *node = get_compound_graph_path_node(path, i);
-                       offset += get_entity_offset(node);
-                       curr_tp = get_entity_type(node);
-               }
-       }
-
-       return offset;
-}
-
-unsigned get_compound_ent_value_offset_bit_remainder(const ir_entity *ent,
-                                                     size_t pos)
-{
-       compound_graph_path *path;
-       size_t path_len;
-       ir_entity *last_node;
-
-       assert(get_type_state(get_entity_type(ent)) == layout_fixed);
-
-       path      = get_compound_ent_value_path(ent, pos);
-       path_len  = get_compound_graph_path_length(path);
-       last_node = get_compound_graph_path_node(path, path_len - 1);
-
-       if (last_node == NULL)
-               return 0;
-
-       return get_entity_offset_bits_remainder(last_node);
-}
-
-size_t get_compound_ent_n_values(const ir_entity *ent)
-{
-       assert(ent->initializer == NULL);
-       assert(is_compound_entity(ent));
-       allocate_values((ir_entity*) ent);
-       return ARR_LEN(ent->attr.cmpd_attr.values);
-}
-
-ir_node *get_compound_ent_value(const ir_entity *ent, size_t pos)
-{
-       assert(is_compound_entity(ent));
-       assert(ent->initializer == NULL);
-       assert(pos < ARR_LEN(ent->attr.cmpd_attr.values));
-       return skip_Id(ent->attr.cmpd_attr.values[pos]);
-}
-
-int entity_has_compound_ent_values(const ir_entity *entity)
-{
-       if (!is_compound_entity(entity))
-               return 0;
-
-       return entity->attr.cmpd_attr.values != NULL;
-}
diff --git a/ir/tr/compound_path_t.h b/ir/tr/compound_path_t.h
deleted file mode 100644 (file)
index 65df252..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
- *
- * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
- */
-
-/*
- * @file
- */
-#ifndef FIRM_TR_COMPOUND_PATH_T_H
-#define FIRM_TR_COMPOUND_PATH_T_H
-
-#include "firm_types.h"
-#include "firm_common.h"
-#include "compound_path.h"
-
-/** A path in a compound graph. */
-struct compound_graph_path {
-       firm_kind kind;       /**< The dynamic type tag for compound graph path. */
-       ir_type  *tp;          /**< The type this path belongs to. */
-       size_t    len;              /**< The length of the path. */
-       struct tuple {
-               long       index;    /**< Array index.  To compute position of array elements */
-               ir_entity *node;    /**< The accessed entity. */
-       } list[1];            /**< List of entity/index tuple of length len to express the
-                                  access path. */
-};
-
-#endif
index 943ad6b..69a59e6 100644 (file)
@@ -42,7 +42,6 @@
 #include "irgraph_t.h"
 #include "callgraph.h"
 #include "error.h"
-#include "compound_path.h"
 
 /** The name of the unknown entity. */
 #define UNKNOWN_ENTITY_NAME "unknown_entity"
@@ -113,8 +112,6 @@ ir_entity *new_d_entity(ir_type *owner, ident *name, ir_type *type,
        } else if (owner != NULL
                   && (is_compound_type(owner) && !(owner->flags & tf_segment))) {
                res = intern_new_entity(owner, IR_ENTITY_COMPOUND_MEMBER, name, type, db);
-               res->attr.cmpd_attr.values    = NULL;
-               res->attr.cmpd_attr.val_paths = NULL;
        } else {
                res = intern_new_entity(owner, IR_ENTITY_NORMAL, name, type, db);
        }
@@ -186,14 +183,8 @@ static void free_entity_attrs(ir_entity *ent)
 
        if (ent->initializer != NULL) {
                /* TODO: free initializers */
-       } else if (entity_has_compound_ent_values(ent)) {
-               /* can't free compound graph path as it might be used
-                * multiple times */
-               ent->attr.cmpd_attr.val_paths = NULL;
        }
-       if (ent->entity_kind == IR_ENTITY_COMPOUND_MEMBER) {
-               ent->attr.cmpd_attr.values = NULL;
-       } else if (ent->entity_kind == IR_ENTITY_METHOD) {
+       if (ent->entity_kind == IR_ENTITY_METHOD) {
                if (ent->attr.mtd_attr.param_access) {
                        DEL_ARR_F(ent->attr.mtd_attr.param_access);
                        ent->attr.mtd_attr.param_access = NULL;
@@ -215,15 +206,6 @@ static ir_entity *deep_entity_copy(ir_entity *old)
        *newe = *old;
        if (old->initializer != NULL) {
                /* FIXME: the initializers are NOT copied */
-       } else if (entity_has_compound_ent_values(old)) {
-               newe->attr.cmpd_attr.values    = NULL;
-               newe->attr.cmpd_attr.val_paths = NULL;
-               if (old->attr.cmpd_attr.values)
-                       newe->attr.cmpd_attr.values = DUP_ARR_F(ir_node *, old->attr.cmpd_attr.values);
-
-               /* FIXME: the compound graph paths are NOT copied */
-               if (old->attr.cmpd_attr.val_paths)
-                       newe->attr.cmpd_attr.val_paths = DUP_ARR_F(compound_graph_path *, old->attr.cmpd_attr.val_paths);
        } else if (is_method_entity(old)) {
                /* do NOT copy them, reanalyze. This might be the best solution */
                newe->attr.mtd_attr.param_access = NULL;
@@ -1066,8 +1048,7 @@ int entity_has_definition(const ir_entity *entity)
                return get_entity_irg(entity) != NULL
                    && (get_entity_linkage(entity) & IR_LINKAGE_NO_CODEGEN) == 0;
        } else {
-               return entity->initializer != NULL
-                   || entity_has_compound_ent_values(entity);
+               return entity->initializer != NULL;
        }
 }
 
index e8b6d9d..c17d9f7 100644 (file)
@@ -31,7 +31,6 @@
 #include "typerep.h"
 #include "type_t.h"
 #include "ident.h"
-#include "compound_path.h"
 
 typedef struct ir_initializer_base_t {
        ir_initializer_kind_t kind;
@@ -70,13 +69,6 @@ union ir_initializer_t {
        ir_initializer_tarval_t    tarval;
 };
 
-/** The attributes for compound entities. */
-typedef struct compound_ent_attr {
-       ir_node **values;     /**< constant values of compound entities. */
-       compound_graph_path **val_paths;
-                            /**< paths corresponding to constant values. */
-} compound_ent_attr;
-
 /** The attributes for methods. */
 typedef struct method_ent_attr {
        ir_graph *irg;                 /**< The corresponding irg if known.
@@ -98,9 +90,6 @@ typedef struct code_ent_attr {
 } code_ent_attr;
 
 typedef struct parameter_ent_attr {
-       /**< parameters might be compounds too */
-       compound_ent_attr  cmpd_attr;
-
        size_t   number; /**< corresponding parameter number */
        ir_mode *doubleword_low_mode;/**< entity is a lowered doubleword parameter,
                                                                so additional stores because of calling
@@ -169,8 +158,6 @@ struct ir_entity {
 #endif
 
        union {
-               /* ------------- fields for compound entities -------------- */
-               compound_ent_attr  cmpd_attr;
                /* ------------- fields for method entities ---------------- */
                method_ent_attr    mtd_attr;
                /* fields for code entities */
index 1034943..997299f 100644 (file)
@@ -200,14 +200,6 @@ static bool constants_on_wrong_irg(const ir_entity *ent)
 {
        if (ent->initializer != NULL) {
                return initializer_constant_on_wrong_irg(ent->initializer);
-       } else if (entity_has_compound_ent_values(ent)) {
-               bool   fine = true;
-               size_t n    = get_compound_ent_n_values(ent);
-               size_t i;
-               for (i = 0; i < n; ++i) {
-                       fine &= constant_on_wrong_irg(get_compound_ent_value(ent, i));
-               }
-               return fine;
        }
        return true;
 }
index 4040995..dbef3f2 100644 (file)
@@ -93,7 +93,6 @@ static void do_type_walk(type_or_ent tore,
        size_t      i, n_types, n_mem;
        ir_entity   *ent = NULL;
        ir_type     *tp = NULL;
-       ir_node     *n;
        type_or_ent cont;
 
        /* marked? */
@@ -129,12 +128,6 @@ static void do_type_walk(type_or_ent tore,
                /* walk over the value types */
                if (ent->initializer != NULL) {
                        walk_initializer(ent->initializer, pre, post, env);
-               } else if (entity_has_compound_ent_values(ent)) {
-                       size_t i, n_mem = get_compound_ent_n_values(ent);
-                       for (i = 0; i < n_mem; ++i) {
-                               n = get_compound_ent_value(ent, i);
-                               irn_type_walker(n, pre, post, env);
-                       }
                }
                break;
        case k_type:
index 8422d8d..3460126 100644 (file)
@@ -77,8 +77,6 @@ int get_firm_object_size(firm_kind kind)
     return sizeof(tarval);
   case k_ir_loop:    /* a loop */
     return sizeof(ir_loop);
-  case k_ir_compound_graph_path: /* a compound graph path, see entity.h */
-    return sizeof(compound_graph_path);
   case k_ir_prog:    /* a program representation (irp) */
     return sizeof(ir_prog);
   default:
@@ -716,8 +714,6 @@ HRESULT FormatFirmObject(DEBUGHELPER *pHelper, int nBase, firm_kind kind, const
     return format_tarval(pHelper, nBase, addr, pResult, max);
   case k_ir_loop:    /* a loop */
     return format_loop(pHelper, addr, pResult, max);
-  case k_ir_compound_graph_path: /* a compound graph path, see entity.h */
-    return E_FAIL;
   case k_ir_prog:    /* a program representation (irp) */
     return format_prog(pHelper, nBase, addr, pResult, max);
   default:
index f778e55..ca8a0ce 100644 (file)
     <ClInclude Include="$(FirmRoot)\ir\stat\stat_dmp.h"/>
     <ClInclude Include="$(FirmRoot)\ir\stat\stat_timing.h"/>
     <ClInclude Include="$(FirmRoot)\ir\stat\statev.h"/>
-    <ClCompile Include="$(FirmRoot)\ir\tr\compound_path.c"/>
     <ClCompile Include="$(FirmRoot)\ir\tr\entity.c"/>
     <ClCompile Include="$(FirmRoot)\ir\tr\tpop.c"/>
     <ClCompile Include="$(FirmRoot)\ir\tr\tr_inheritance.c"/>
     <ClInclude Include="$(FirmRoot)\include\libfirm\callgraph.h"/>
     <ClInclude Include="$(FirmRoot)\include\libfirm\cdep.h"/>
     <ClInclude Include="$(FirmRoot)\include\libfirm\cgana.h"/>
-    <ClInclude Include="$(FirmRoot)\include\libfirm\compound_path.h"/>
     <ClInclude Include="$(FirmRoot)\include\libfirm\dbginfo.h"/>
     <ClInclude Include="$(FirmRoot)\include\libfirm\execfreq.h"/>
     <ClInclude Include="$(FirmRoot)\include\libfirm\execution_frequency.h"/>
index 3b3164d..427b175 100644 (file)
     <ClInclude Include="$(FirmRoot)\ir\stat\stat_timing.h">
       <Filter>ir\stat</Filter>
     </ClInclude>
-    <ClCompile Include="$(FirmRoot)\ir\tr\compound_path.c">
-      <Filter>ir\tr</Filter>
-    </ClCompile>
     <ClCompile Include="$(FirmRoot)\ir\tr\entity.c">
       <Filter>ir\tr</Filter>
     </ClCompile>
     <ClInclude Include="$(FirmRoot)\include\libfirm\cgana.h">
       <Filter>include\libfirm</Filter>
     </ClInclude>
-    <ClInclude Include="$(FirmRoot)\include\libfirm\compound_path.h">
-      <Filter>include\libfirm</Filter>
-    </ClInclude>
     <ClInclude Include="$(FirmRoot)\include\libfirm\dbginfo.h">
       <Filter>include\libfirm</Filter>
     </ClInclude>
     <ClInclude Include="$(FirmRoot)\ir\stat\statev.h">
       <Filter>ir\stat</Filter>
     </ClInclude>
-    <ClCompile Include="$(FirmRoot)\ir\tr\compound_path.c">
-      <Filter>ir\tr</Filter>
-    </ClCompile>
     <ClCompile Include="$(FirmRoot)\ir\tr\entity.c">
       <Filter>ir\tr</Filter>
     </ClCompile>
     <ClInclude Include="$(FirmRoot)\ir\stat\statev.h">
       <Filter>ir\stat</Filter>
     </ClInclude>
-    <ClCompile Include="$(FirmRoot)\ir\tr\compound_path.c">
-      <Filter>ir\tr</Filter>
-    </ClCompile>
     <ClCompile Include="$(FirmRoot)\ir\tr\entity.c">
       <Filter>ir\tr</Filter>
     </ClCompile>
     <ClInclude Include="$(FirmRoot)\ir\stat\statev.h">
       <Filter>ir\stat</Filter>
     </ClInclude>
-    <ClCompile Include="$(FirmRoot)\ir\tr\compound_path.c">
-      <Filter>ir\tr</Filter>
-    </ClCompile>
     <ClCompile Include="$(FirmRoot)\ir\tr\entity.c">
       <Filter>ir\tr</Filter>
     </ClCompile>
     <ClInclude Include="$(FirmRoot)\include\libfirm\cgana.h">
       <Filter>include\libfirm</Filter>
     </ClInclude>
-    <ClInclude Include="$(FirmRoot)\include\libfirm\compound_path.h">
-      <Filter>include\libfirm</Filter>
-    </ClInclude>
     <ClInclude Include="$(FirmRoot)\include\libfirm\dbginfo.h">
       <Filter>include\libfirm</Filter>
     </ClInclude>