changed __functions into more comfrom _functions
[libfirm] / ir / tr / entity.h
index d5fab7e..e42a11d 100644 (file)
 *  - int offset:     Offset in bits for this entity.  Fixed when layout
 *                   of owner is determined.
 *  - ir_graph *irg:  If (type == method_type) this is the corresponding irg.
-*                The ir_graph constructor automatically sets this field.
+*                    The ir_graph constructor automatically sets this field.
 *                    If (type != method_type) access of this field will cause
 *                    an assertion.
 */
 
-/* $Id$ */
-
 # ifndef _ENTITY_H_
 # define _ENTITY_H_
 
@@ -63,6 +61,8 @@
 # include "type.h"
 # include "dbginfo.h"
 
+# include "tr_inheritance.h"
+
 /*-----------------------------------------------------------------*/
 /* general                                                         */
 /*-----------------------------------------------------------------*/
@@ -215,7 +215,7 @@ typedef enum {
   allocation_automatic, /**< The entity is allocated during runtime, implicitly
                  as component of a compound type.   This is the default. */
   allocation_parameter, /**< The entity is a parameter.  It is also automatic allocated.
-                 We distinguish the allocation of paramters from the allocation
+                 We distinguish the allocation of parameters from the allocation
                  of local variables as their placement depends on the calling
                  conventions. */
   allocation_dynamic,   /**< The entity is allocated during runtime, explicitly
@@ -376,6 +376,10 @@ void    set_compound_graph_path_node(compound_graph_path *gr, int pos, entity *n
 int     get_compound_graph_path_array_index(compound_graph_path *gr, int pos);
 void    set_compound_graph_path_array_index(compound_graph_path *gr, int pos, int index);
 
+/** Checks whether the path up to pos is correct. If the path contains a NULL,
+ *  assumes the path is not complete and returns 'true'. */
+int is_proper_compound_graph_path(compound_graph_path *gr, int pos);
+
 /* 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.  */
 void     add_compound_ent_value_w_path(entity *ent, ir_node *val, compound_graph_path *path);
@@ -385,8 +389,16 @@ void     set_compound_ent_value_w_path(entity *ent, ir_node *val, compound_graph
  *  Asserts if the entity has variability_uninitialized.
  * */
 int      get_compound_ent_n_values(entity *ent);
+/** Returns a constant value given the position. */
 ir_node *get_compound_ent_value(entity *ent, int pos);
+/** Returns the access path for value at position pos. */
 compound_graph_path *get_compound_ent_value_path(entity *ent, int pos);
+/** Returns the position of a value with the given path.
+ *  The path must contain array indicees for all array element entities. */
+int get_compound_ent_pos_by_path(entity *ent, compound_graph_path *path);
+/** Returns a constant value given the access path.
+ *  The path must contain array indicees for all array element entities. */
+ir_node *get_compound_ent_value_by_path(entity *ent, compound_graph_path *path);
 
 /** 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
@@ -505,7 +517,6 @@ int is_compound_entity(entity *ent);
 */
 bool equal_entity(entity *ent1, entity *ent2);
 
-
 /** Outputs a unique number for this entity if libfirm is compiled for
    debugging, (configure with --enable-debug) else returns 0. */
 long get_entity_nr(entity *ent);
@@ -525,9 +536,44 @@ bool        entity_visited(entity *ent);
 /** Returns true if this entity was not visited. */
 bool        entity_not_visited(entity *ent);
 
-/** Returns the dynamically referenced entity if the static entity and the
- *  dynamic type are given. */
-entity *resolve_ent_polymorphy(type *dynamic_class, entity* static_ent);
-
+/**
+ * @page unknown_entity
+ *
+ *  This entity is an auxiliary entity dedicated to support analyses.
+ *
+ *  The unknown entity represents that there could be an entity, but it is not
+ *  known.  This entity can be used to initialize fields before an analysis (not known
+ *  yet) or to represent the top of a lattice (could not be determined).  There exists
+ *  exactly one entity unknown. This entity has as owner and as type the unknown type. It is
+ *  allocated when initializing the entity module.
+ *
+ *  The entity can take the role of any entity, also methods.  It returns default
+ *  values in these cases.
+ *
+ *  The following values are set:
+ *    name          = "unknown_entity"
+ *    ld_name       = "unknown_entity"
+ *    owner         = unknown_type
+ *    type          = unknown_type
+ *    visibility    = visibility_external_allocated
+ *    offset        = -1
+ *    variability   = variability_uninitialized
+ *    value         = SymConst(unknown_entity)
+ *    values        = NULL
+ *    val_paths     = NULL
+ *    peculiarity   = peculiarity_existent
+ *    volatility    = volatility_non_volatile
+ *    stickyness    = stickyness_unsticky
+ *    ld_name       = NULL
+ *    overwrites    = NULL
+ *    overwrittenby = NULL
+ *    irg           = NULL
+ *    link          = NULL
+ *
+ */
+/* A variable that contains the only unknown entity. */
+extern entity *unknown_entity;
+/* Returns the unknown entity */
+entity *get_unknown_entity(void);
 
 # endif /* _ENTITY_H_ */