- return res;
-} /* new_compound_graph_path */
-
-/* Frees an graph path object */
-void free_compound_graph_path (compound_graph_path *gr) {
- assert(gr && is_compound_graph_path(gr));
- gr->kind = k_BAD;
- free(gr);
-} /* free_compound_graph_path */
-
-/* Returns non-zero if an object is a compound graph path */
-int is_compound_graph_path(const void *thing) {
- return (get_kind(thing) == k_ir_compound_graph_path);
-} /* is_compound_graph_path */
-
-/* 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) {
- int 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;
-} /* is_proper_compound_graph_path */
-
-/* Returns the length of a graph path */
-int get_compound_graph_path_length(const compound_graph_path *gr) {
- assert(gr && is_compound_graph_path(gr));
- return gr->len;
-} /* get_compound_graph_path_length */
-
-ir_entity *
-get_compound_graph_path_node(const compound_graph_path *gr, int pos) {
- assert(gr && is_compound_graph_path(gr));
- assert(pos >= 0 && pos < gr->len);
- return gr->list[pos].node;
-} /* get_compound_graph_path_node */
-
-void
-set_compound_graph_path_node(compound_graph_path *gr, int pos, ir_entity *node) {
- assert(gr && is_compound_graph_path(gr));
- assert(pos >= 0 && pos < gr->len);
- assert(is_entity(node));
- gr->list[pos].node = node;
- assert(is_proper_compound_graph_path(gr, pos));
-} /* set_compound_graph_path_node */
-
-int
-get_compound_graph_path_array_index(const compound_graph_path *gr, int pos) {
- assert(gr && is_compound_graph_path(gr));
- assert(pos >= 0 && pos < gr->len);
- return gr->list[pos].index;
-} /* get_compound_graph_path_array_index */
-
-void
-set_compound_graph_path_array_index(compound_graph_path *gr, int pos, int index) {
- assert(gr && is_compound_graph_path(gr));
- assert(pos >= 0 && pos < gr->len);
- gr->list[pos].index = index;
-} /* set_compound_graph_path_array_index */
-
-/* A value of a compound entity is a pair of value and the corresponding path to a member of
- the compound. */
-void
-add_compound_ent_value_w_path(ir_entity *ent, ir_node *val, compound_graph_path *path) {
- assert(is_compound_entity(ent) && (ent->variability != variability_uninitialized));
- assert(is_compound_graph_path(path));
- ARR_APP1(ir_node *, ent->attr.cmpd_attr.values, val);
- ARR_APP1(compound_graph_path *, ent->attr.cmpd_attr.val_paths, path);
-} /* add_compound_ent_value_w_path */
-
-void
-set_compound_ent_value_w_path(ir_entity *ent, ir_node *val, compound_graph_path *path, int pos) {
- assert(is_compound_entity(ent) && (ent->variability != variability_uninitialized));
- assert(is_compound_graph_path(path));
- assert(0 <= pos && pos < ARR_LEN(ent->attr.cmpd_attr.values));
- ent->attr.cmpd_attr.values[pos] = val;
- ent->attr.cmpd_attr.val_paths[pos] = path;
-} /* set_compound_ent_value_w_path */
-
-int
-get_compound_ent_n_values(ir_entity *ent) {
- assert(is_compound_entity(ent) && (ent->variability != variability_uninitialized));
- return ARR_LEN(ent->attr.cmpd_attr.values);
-} /* get_compound_ent_n_values */
-
-ir_node *
-get_compound_ent_value(ir_entity *ent, int pos) {
- assert(is_compound_entity(ent) && (ent->variability != variability_uninitialized));
- assert(0 <= pos && pos < ARR_LEN(ent->attr.cmpd_attr.values));
- return ent->attr.cmpd_attr.values[pos];
-} /* get_compound_ent_value */
-
-compound_graph_path *
-get_compound_ent_value_path(ir_entity *ent, int pos) {
- assert(is_compound_entity(ent) && (ent->variability != variability_uninitialized));
- assert(0 <= pos && pos < ARR_LEN(ent->attr.cmpd_attr.val_paths));
- return ent->attr.cmpd_attr.val_paths[pos];
-} /* get_compound_ent_value_path */