diff --git a/include/QF/set.h b/include/QF/set.h index b1fe5665a..baa5b1699 100644 --- a/include/QF/set.h +++ b/include/QF/set.h @@ -65,18 +65,18 @@ typedef struct set_s { create_and_populate (set); for (iter = set_first (set); iter; iter = set_next (iter)) - do_something (iter->value); + do_something (iter->element); \endcode */ typedef struct set_iter_s { struct set_iter_s *next; ///< private. for ALLOC const set_t *set; ///< the set to which this iterator belongs /** The result of set_first() or set_next(). set_next() will start at the - following value. + following element. \note For inverted sets, indicates a non-member. */ - unsigned value; + unsigned element; } set_iter_t; /** Delete a set iterator that is no longer needed. @@ -99,26 +99,26 @@ set_t *set_new (void); */ void set_delete (set_t *set); -/** Add a value to a set. +/** Add an element to a set. - It is not an error to add a value that is already a member of the set. + It is not an error to add an element that is already a member of the set. \note \a set is modified. - \param set The set to which the value will be added. - \param x The value to be added. + \param set The set to which the element will be added. + \param x The element to be added. \return The modified set. */ set_t *set_add (set_t *set, unsigned x); -/** Remove a value from a set. +/** Remove an element from a set. - It is not an error to remove a value that is not a member of the set. + It is not an error to remove an element that is not a member of the set. \note \a set is modified. - \param set The set from which the value will be removed. - \param x The value to be removed. + \param set The set from which the element will be removed. + \param x The element to be removed. \return The modified set. */ set_t *set_remove (set_t *set, unsigned x); @@ -263,11 +263,11 @@ int set_is_equivalent (const set_t *s1, const set_t *s2); */ int set_is_subset (const set_t *set, const set_t *sub); -/** Test a value for membership in a set. +/** Test an element for membership in a set. \param set The set to test. - \param x The value to test. - \return 1 if the value is a member of the set, otherwise 0. + \param x The element to test. + \return 1 if the element is a member of the set, otherwise 0. */ int set_is_member (const set_t *set, unsigned x); diff --git a/libs/ruamoko/rua_set.c b/libs/ruamoko/rua_set.c index cc007c4bb..0fdd964e7 100644 --- a/libs/ruamoko/rua_set.c +++ b/libs/ruamoko/rua_set.c @@ -424,7 +424,7 @@ bi_i_SetIterator__element (progs_t *pr) pr_set_iter_t *iter_obj = &P_STRUCT (pr, pr_set_iter_t, 0); bi_set_iter_t *set_iter = get_set_iter (pr, __FUNCTION__, iter_obj->iter); - R_INT (pr) = set_iter->iter->value; + R_INT (pr) = set_iter->iter->element; } static void diff --git a/libs/util/set.c b/libs/util/set.c index f2444075e..da1893147 100644 --- a/libs/util/set.c +++ b/libs/util/set.c @@ -534,7 +534,7 @@ set_first (const set_t *set) if (_set_is_member (set, x)) { set_iter = new_setiter (); set_iter->set = set; - set_iter->value = x; + set_iter->element = x; return set_iter; } } @@ -546,9 +546,9 @@ set_next (set_iter_t *set_iter) { unsigned x; - for (x = set_iter->value + 1; x < set_iter->set->size; x++) { + for (x = set_iter->element + 1; x < set_iter->set->size; x++) { if (_set_is_member (set_iter->set, x)) { - set_iter->value = x; + set_iter->element = x; return set_iter; } } diff --git a/tools/qfcc/source/dags.c b/tools/qfcc/source/dags.c index 3aa46c19c..959c27e95 100644 --- a/tools/qfcc/source/dags.c +++ b/tools/qfcc/source/dags.c @@ -379,7 +379,7 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n) set_iter_t *lab_i; for (lab_i = set_first (n->children[0]->identifiers); lab_i; lab_i = set_next (lab_i)) { - label = dag->labels[lab_i->value]; + label = dag->labels[lab_i->element]; } } label->live = 1; @@ -534,7 +534,7 @@ dag_sort_visit (dag_t *dag, set_t *visited, int node_index, int *topo) node = dag->nodes[node_index]; for (node_iter = set_first (node->edges); node_iter; node_iter = set_next (node_iter)) - dag_sort_visit (dag, visited, node_iter->value, topo); + dag_sort_visit (dag, visited, node_iter->element, topo); node->topo = *topo; dag->topo[(*topo)++] = node_index; } @@ -549,7 +549,7 @@ dag_sort_nodes (dag_t *dag) dag->topo = malloc (dag->num_nodes * sizeof (int)); for (root_iter = set_first (dag->roots); root_iter; root_iter = set_next (root_iter)) - dag_sort_visit (dag, visited, root_iter->value, &topo); + dag_sort_visit (dag, visited, root_iter->element, &topo); set_delete (visited); } @@ -750,7 +750,7 @@ generate_moves (dag_t *dag, sblock_t *block, dagnode_t *dagnode) dst = operands[0]; for (var_iter = set_first (dagnode->identifiers); var_iter; var_iter = set_next (var_iter)) { - var = dag->labels[var_iter->value]; + var = dag->labels[var_iter->element]; operands[2] = var->op; dst = operands[2]; st = build_statement ("", operands, var->expr); @@ -772,7 +772,7 @@ generate_moveps (dag_t *dag, sblock_t *block, dagnode_t *dagnode) operands[1] = make_operand (dag, block, dagnode, 1); for (var_iter = set_first (dagnode->identifiers); var_iter; var_iter = set_next (var_iter)) { - var = dag->labels[var_iter->value]; + var = dag->labels[var_iter->element]; dst = var->op; operands[2] = value_operand (new_pointer_val (0, 0, dst->o.def)); st = build_statement ("", operands, var->expr); @@ -792,7 +792,7 @@ generate_assignments (dag_t *dag, sblock_t *block, operand_t *src, operands[0] = fix_op_type (src, type); for ( ; var_iter; var_iter = set_next (var_iter)) { - var = dag->labels[var_iter->value]; + var = dag->labels[var_iter->element]; operands[1] = fix_op_type (var->op, type); if (!dst) dst = operands[1]; @@ -831,7 +831,7 @@ dag_gencode (dag_t *dag, sblock_t *block, dagnode_t *dagnode) if (!(var_iter = set_first (dagnode->identifiers))) { operands[2] = temp_operand (get_type (dagnode->label->expr)); } else { - daglabel_t *var = dag->labels[var_iter->value]; + daglabel_t *var = dag->labels[var_iter->element]; operands[2] = fix_op_type (var->op, type); var_iter = set_next (var_iter); diff --git a/tools/qfcc/source/dot_dag.c b/tools/qfcc/source/dot_dag.c index cbfca3782..2c3f88386 100644 --- a/tools/qfcc/source/dot_dag.c +++ b/tools/qfcc/source/dot_dag.c @@ -63,7 +63,7 @@ print_node_def (dstring_t *dstr, dag_t *dag, dagnode_t *node) node->topo); for (id_iter = set_first (node->identifiers); id_iter; id_iter = set_next (id_iter)) { - id = dag->labels[id_iter->value]; + id = dag->labels[id_iter->element]; dasprintf (dstr, "\\n%s", daglabel_string(id)); } dasprintf (dstr, "\"];\n"); @@ -77,7 +77,7 @@ print_root_nodes (dstring_t *dstr, dag_t *dag) // dasprintf (dstr, " rank=same;"); for (node_iter = set_first (dag->roots); node_iter; node_iter = set_next (node_iter)) { - dagnode_t *node = dag->nodes[node_iter->value]; + dagnode_t *node = dag->nodes[node_iter->element]; print_node_def (dstr, dag, node); dasprintf (dstr, " dag_enter_%p ->dagnode_%p [style=invis];\n", dag, node); @@ -118,7 +118,7 @@ print_node (dstring_t *dstr, dag_t *dag, dagnode_t *node) edge_iter = set_next (edge_iter)) { dasprintf (dstr, " \"dagnode_%p\" -> \"dagnode_%p\" [style=dashed];\n", - node, dag->nodes[edge_iter->value]); + node, dag->nodes[edge_iter->element]); } set_delete (edges); if (0 && !set_is_empty (node->identifiers)) { @@ -134,7 +134,7 @@ print_node (dstring_t *dstr, dag_t *dag, dagnode_t *node) dasprintf (dstr, " "); for (id_iter = set_first (node->identifiers); id_iter; id_iter = set_next (id_iter)) { - id = dag->labels[id_iter->value]; + id = dag->labels[id_iter->element]; dasprintf (dstr, " %s", html_string (daglabel_string(id))); } dasprintf (dstr, " "); diff --git a/tools/qfcc/source/dot_flow.c b/tools/qfcc/source/dot_flow.c index d75bbc7e5..95bf0712a 100644 --- a/tools/qfcc/source/dot_flow.c +++ b/tools/qfcc/source/dot_flow.c @@ -190,7 +190,7 @@ print_flow_node_live (dstring_t *dstr, flowgraph_t *graph, flownode_t *node, node->id, node->dfn); for (var_iter = set_first (node->live_vars.out); var_iter; var_iter = set_next (var_iter)) { - var = graph->func->vars[var_iter->value]; + var = graph->func->vars[var_iter->element]; dasprintf (dstr, "%*s(%d) %s\n", indent + 4, "", var->number, html_string(operand_string (var->op))); } diff --git a/tools/qfcc/source/flow.c b/tools/qfcc/source/flow.c index 093c9406b..0806cd79d 100644 --- a/tools/qfcc/source/flow.c +++ b/tools/qfcc/source/flow.c @@ -362,11 +362,11 @@ flow_build_vars (function_t *func) flow_analyze_statement (s, stuse, stdef, 0, 0); for (var_i = set_first (stdef); var_i; var_i = set_next (var_i)) { - var = func->vars[var_i->value]; + var = func->vars[var_i->element]; set_add (var->define, i); } for (var_i = set_first (stuse); var_i; var_i = set_next (var_i)) { - var = func->vars[var_i->value]; + var = func->vars[var_i->element]; set_add (var->use, i); } } @@ -481,7 +481,7 @@ flow_reaching_defs (flowgraph_t *graph) set_empty (stgen); set_empty (stkill); for (var_i = set_first (stdef); var_i; var_i = set_next (var_i)) { - var = graph->func->vars[var_i->value]; + var = graph->func->vars[var_i->element]; flow_kill_aliases (stkill, var, uninit); set_remove (stkill, st->number); set_add (stgen, st->number); @@ -511,7 +511,7 @@ flow_reaching_defs (flowgraph_t *graph) kill = node->reaching_defs.kill; for (pred_i = set_first (node->predecessors); pred_i; pred_i = set_next (pred_i)) { - flownode_t *pred = graph->nodes[pred_i->value]; + flownode_t *pred = graph->nodes[pred_i->element]; set_union (in, pred->reaching_defs.out); } set_assign (oldout, out); @@ -593,7 +593,7 @@ flow_live_vars (flowgraph_t *graph) set_empty (tmp); for (succ = set_first (node->successors); succ; succ = set_next (succ)) - set_union (tmp, graph->nodes[succ->value]->live_vars.in); + set_union (tmp, graph->nodes[succ->element]->live_vars.in); if (!set_is_equivalent (node->live_vars.out, tmp)) { changed = 1; set_assign (node->live_vars.out, tmp); @@ -626,7 +626,7 @@ flow_uninit_scan_statements (flownode_t *node, set_t *defs, set_t *uninit) for (st = node->sblock->statements; st; st = st->next) { flow_analyze_statement (st, stuse, stdef, 0, 0); for (var_i = set_first (stuse); var_i; var_i = set_next (var_i)) { - var = node->graph->func->vars[var_i->value]; + var = node->graph->func->vars[var_i->element]; if (set_is_intersecting (defs, var->define)) { def_t *def = flowvar_get_def (var); if (def) { @@ -641,7 +641,7 @@ flow_uninit_scan_statements (flownode_t *node, set_t *defs, set_t *uninit) set_difference (defs, var->define); } for (var_i = set_first (stdef); var_i; var_i = set_next (var_i)) { - var = node->graph->func->vars[var_i->value]; + var = node->graph->func->vars[var_i->element]; // kill any reaching uninitialized definitions for this variable set_difference (defs, var->define); if (var->op->op_type == op_temp) { @@ -683,7 +683,7 @@ flow_uninitialized (flowgraph_t *graph) // the live vars analysis is perfect for the job for (var_i = set_first (node->live_vars.use); var_i; var_i = set_next (var_i)) { - var = graph->func->vars[var_i->value]; + var = graph->func->vars[var_i->element]; set_union (defs, var->define); } // interested in only those defintions that actually reach this node @@ -971,7 +971,7 @@ flow_make_edges (flowgraph_t *graph) succ = set_next (succ), j++) { set_add (node->edges, j); graph->edges[j].tail = i; - graph->edges[j].head = succ->value; + graph->edges[j].head = succ->element; } } } @@ -987,7 +987,7 @@ flow_find_predecessors (flowgraph_t *graph) node = graph->nodes[i]; for (succ = set_first (node->successors); succ; succ = set_next (succ)) { - set_add (graph->nodes[succ->value]->predecessors, i); + set_add (graph->nodes[succ->element]->predecessors, i); } } } @@ -1024,7 +1024,7 @@ flow_find_dominators (flowgraph_t *graph) set_empty (work); for (pred = set_first (node->predecessors); pred; pred = set_next (pred)) - set_intersection (work, graph->nodes[pred->value]->dom); + set_intersection (work, graph->nodes[pred->element]->dom); set_add (work, i); if (!set_is_equivalent (work, node->dom)) changed = 1; @@ -1056,13 +1056,13 @@ make_loop (flowgraph_t *graph, unsigned n, unsigned d) insert_loop_node (loop, n, stack); while (!set_is_empty (stack)) { set_iter_t *ss = set_first (stack); - unsigned m = ss->value; + unsigned m = ss->element; set_del_iter (ss); set_remove (stack, m); node = graph->nodes[m]; for (pred = set_first (node->predecessors); pred; pred = set_next (pred)) - insert_loop_node (loop, pred->value, stack); + insert_loop_node (loop, pred->element, stack); } set_delete (stack); return loop; @@ -1081,8 +1081,8 @@ flow_find_loops (flowgraph_t *graph) node = graph->nodes[i]; for (succ = set_first (node->successors); succ; succ = set_next (succ)) { - if (set_is_member (node->dom, succ->value)) { - loop = make_loop (graph, node->id, succ->value); + if (set_is_member (node->dom, succ->element)) { + loop = make_loop (graph, node->id, succ->element); for (l = loop_list; l; l = l->next) { if (l->head == loop->head && !set_is_subset (l->nodes, loop->nodes) @@ -1113,9 +1113,9 @@ df_search (flowgraph_t *graph, set_t *visited, int *i, int n) set_add (visited, n); node = graph->nodes[n]; for (edge = set_first (node->edges); edge; edge = set_next (edge)) { - succ = graph->edges[edge->value].head; + succ = graph->edges[edge->element].head; if (!set_is_member (visited, succ)) { - set_add (graph->dfst, edge->value); + set_add (graph->dfst, edge->element); df_search (graph, visited, i, succ); } }