Commit 1a26f485 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Put a space after if/for/switch/while.

[r27153]
parent 14b4e9b3
......@@ -274,7 +274,7 @@ static inline unsigned rbitset_next(const unsigned *bitset, unsigned pos, int se
}
/* Else search for set bits in the next units. */
while (1) {
for (;;) {
elem_pos++;
elem = bitset[elem_pos] ^ mask;
......
......@@ -45,7 +45,7 @@ bipartite_t *bipartite_new(int n_left, int n_right)
gr->n_left = n_left;
gr->n_right = n_right;
for(i = 0; i < n_left; ++i)
for (i = 0; i < n_left; ++i)
gr->adj[i] = bitset_malloc(n_right);
return gr;
......@@ -54,7 +54,7 @@ bipartite_t *bipartite_new(int n_left, int n_right)
void bipartite_free(bipartite_t *gr)
{
int i;
for(i = 0; i < gr->n_left; ++i)
for (i = 0; i < gr->n_left; ++i)
bitset_free(gr->adj[i]);
free(gr);
}
......@@ -84,18 +84,18 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching,
int done_something = 0;
bitset_t *tmp = bitset_alloca(gr->n_right);
for(left = 0; left < gr->n_left; ++left) {
for (left = 0; left < gr->n_left; ++left) {
bitset_t *left_adj = gr->adj[left];
int i;
bitset_copy(tmp, left_adj);
if(matching[left] >= 0) {
if (matching[left] >= 0) {
int old_right = matching[left];
/* Check of all neighbors of the left node are already matched.
* We cannot improve this edge then. */
if(bitset_contains(left_adj, matched_right))
if (bitset_contains(left_adj, matched_right))
continue;
bitset_andnot(tmp, matched_right);
......@@ -107,12 +107,12 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching,
We have to find another left node which has the old right one as a neighbor.
This node must not be part of a matching
*/
for(i = 0; i < gr->n_left; ++i)
if(i != left && bitset_is_set(gr->adj[i], old_right) && !bitset_is_set(matched_left, i))
for (i = 0; i < gr->n_left; ++i)
if (i != left && bitset_is_set(gr->adj[i], old_right) && !bitset_is_set(matched_left, i))
break;
/* If no such node can be found, exit. */
if(i >= gr->n_left)
if (i >= gr->n_left)
continue;
/* Else, we can improve this edge. */
......@@ -129,7 +129,7 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching,
assert(!bitset_is_set(matched_left, left));
bitset_andnot(tmp, matched_right);
if(bitset_is_empty(tmp))
if (bitset_is_empty(tmp))
continue;
right = bitset_next_set(tmp, 0);
......@@ -150,14 +150,14 @@ void bipartite_matching(const bipartite_t *gr, int *matching)
bitset_t *matched_right = bitset_alloca(gr->n_right);
memset(matching, -1, gr->n_left * sizeof(int));
while(apply_alternating_path(gr, matching, matched_left, matched_right));
while (apply_alternating_path(gr, matching, matched_left, matched_right));
}
void bipartite_dump_f(FILE *f, const bipartite_t *gr)
{
int i;
for(i = 0; i < gr->n_left; ++i) {
for (i = 0; i < gr->n_left; ++i) {
fprintf(f, "%d: ", i);
bitset_fprint(f, gr->adj[i]);
fprintf(f, "\n");
......
......@@ -74,7 +74,7 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize)
}
/* swap rows */
for(i=0;i<nsize;i++) {
for (i=0;i<nsize;i++) {
temp = _A(col,i);
_A(col,i) = _A(biggest_r,i);
_A(biggest_r,i) = temp;
......@@ -85,7 +85,7 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize)
vec[biggest_r] = temp;
/* swap columns */
for(i=0;i<nsize;i++) {
for (i=0;i<nsize;i++) {
temp = _A(i,col);
_A(i,col) = _A(i,biggest_c);
_A(i,biggest_c) = temp;
......@@ -97,13 +97,13 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize)
/* partially annihilate this col */
/* zero columns below diag */
for(row=col+1;row<nsize;row++) {
for (row=col+1;row<nsize;row++) {
/* changes during calc */
temp = _A(row,col) / _A(col,col);
/* annihilates A[][] */
for(i=col;i<nsize;i++)
for (i=col;i<nsize;i++)
_A(row,i) = _A(row,i) - temp * _A(col,i);
/* same op on vec */
......@@ -115,14 +115,14 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize)
scramvec[nsize - 1] = vec[nsize - 1] / _A(nsize - 1,nsize - 1);
/* answer needs sorting */
for(i=nsize-2;i>=0;i--) {
for (i=nsize-2;i>=0;i--) {
sum = 0;
for(j=i+1;j<nsize;j++)
for (j=i+1;j<nsize;j++)
sum = sum + _A(i,j) * scramvec[j];
scramvec[i] = (vec[i] - sum) / _A(i,i);
}
/* reorder unknowns--return in vec */
for(i=0;i<nsize;i++) {
for (i=0;i<nsize;i++) {
j = x[i];
vec[j] = scramvec[i];
}
......
......@@ -143,7 +143,7 @@
size_t _i; \
size_t _size = (size); \
HashSetEntry *entries = (ptr); \
for(_i = 0; _i < _size; ++_i) { \
for (_i = 0; _i < _size; ++_i) { \
HashSetEntry *entry = & entries[_i]; \
EntrySetEmpty(*entry); \
} \
......@@ -231,14 +231,14 @@ InsertReturnValue insert_nogrow(HashSet *self, KeyType key)
assert((num_buckets & (num_buckets - 1)) == 0);
while(1) {
for (;;) {
HashSetEntry *entry = & self->entries[bucknum];
if(EntryIsEmpty(*entry)) {
if (EntryIsEmpty(*entry)) {
size_t p;
HashSetEntry *nentry;
if(insert_pos != ILLEGAL_POS) {
if (insert_pos != ILLEGAL_POS) {
p = insert_pos;
} else {
p = bucknum;
......@@ -250,11 +250,11 @@ InsertReturnValue insert_nogrow(HashSet *self, KeyType key)
self->num_elements++;
return GetInsertReturnValue(*nentry, 0);
}
if(EntryIsDeleted(*entry)) {
if(insert_pos == ILLEGAL_POS)
if (EntryIsDeleted(*entry)) {
if (insert_pos == ILLEGAL_POS)
insert_pos = bucknum;
} else if(EntryGetHash(self, *entry) == hash) {
if(KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
} else if (EntryGetHash(self, *entry) == hash) {
if (KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
// Value already in the set, return it
return GetInsertReturnValue(*entry, 1);
}
......@@ -295,14 +295,14 @@ void insert_new(HashSet *self, unsigned hash, ValueType value)
//assert(value != NullValue);
while(1) {
for (;;) {
HashSetEntry *entry = & self->entries[bucknum];
if(EntryIsEmpty(*entry)) {
if (EntryIsEmpty(*entry)) {
size_t p;
HashSetEntry *nentry;
if(insert_pos != ILLEGAL_POS) {
if (insert_pos != ILLEGAL_POS) {
p = insert_pos;
} else {
p = bucknum;
......@@ -349,9 +349,9 @@ void resize(HashSet *self, size_t new_size)
reset_thresholds(self);
/* reinsert all elements */
for(i = 0; i < num_buckets; ++i) {
for (i = 0; i < num_buckets; ++i) {
HashSetEntry *entry = & old_entries[i];
if(EntryIsEmpty(*entry) || EntryIsDeleted(*entry))
if (EntryIsEmpty(*entry) || EntryIsDeleted(*entry))
continue;
insert_new(self, EntryGetHash(self, *entry), EntryGetValue(*entry));
......@@ -376,7 +376,7 @@ void maybe_grow(HashSet *self)
{
size_t resize_to;
if(LIKELY(self->num_elements + 1 <= self->enlarge_threshold))
if (LIKELY(self->num_elements + 1 <= self->enlarge_threshold))
return;
/* double table size */
......@@ -394,20 +394,20 @@ void maybe_shrink(HashSet *self)
size_t size;
size_t resize_to;
if(!self->consider_shrink)
if (!self->consider_shrink)
return;
self->consider_shrink = 0;
size = hashset_size(self);
if(size <= HT_MIN_BUCKETS)
if (size <= HT_MIN_BUCKETS)
return;
if(LIKELY(size > self->shrink_threshold))
if (LIKELY(size > self->shrink_threshold))
return;
resize_to = ceil_po2(size);
if(resize_to < 4)
if (resize_to < 4)
resize_to = 4;
resize(self, resize_to);
......@@ -449,16 +449,16 @@ InsertReturnValue hashset_find(const HashSet *self, ConstKeyType key)
unsigned hash = Hash(self, key);
size_t bucknum = hash & hashmask;
while(1) {
for (;;) {
HashSetEntry *entry = & self->entries[bucknum];
if(EntryIsEmpty(*entry)) {
if (EntryIsEmpty(*entry)) {
return NullReturnValue;
}
if(EntryIsDeleted(*entry)) {
if (EntryIsDeleted(*entry)) {
// value is deleted
} else if(EntryGetHash(self, *entry) == hash) {
if(KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
} else if (EntryGetHash(self, *entry) == hash) {
if (KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
// found the value
return GetInsertReturnValue(*entry, 1);
}
......@@ -489,16 +489,16 @@ void hashset_remove(HashSet *self, ConstKeyType key)
self->entries_version++;
#endif
while(1) {
for (;;) {
HashSetEntry *entry = & self->entries[bucknum];
if(EntryIsEmpty(*entry)) {
if (EntryIsEmpty(*entry)) {
return;
}
if(EntryIsDeleted(*entry)) {
if (EntryIsDeleted(*entry)) {
// entry is deleted
} else if(EntryGetHash(self, *entry) == hash) {
if(KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
} else if (EntryGetHash(self, *entry) == hash) {
if (KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
EntrySetDeleted(*entry);
self->num_deleted++;
self->consider_shrink = 1;
......@@ -519,7 +519,7 @@ void hashset_remove(HashSet *self, ConstKeyType key)
static inline
void init_size(HashSet *self, size_t initial_size)
{
if(initial_size < 4)
if (initial_size < 4)
initial_size = 4;
self->entries = Alloc(initial_size);
......@@ -570,7 +570,7 @@ void hashset_init_size(HashSet *self, size_t expected_elements)
size_t needed_size;
size_t po2size;
if(expected_elements >= UINT_MAX/2) {
if (expected_elements >= UINT_MAX/2) {
abort();
}
......@@ -610,9 +610,9 @@ ValueType hashset_iterator_next(HashSetIterator *self)
do {
current_bucket++;
if(current_bucket >= end)
if (current_bucket >= end)
return NullValue;
} while(EntryIsEmpty(*current_bucket) || EntryIsDeleted(*current_bucket));
} while (EntryIsEmpty(*current_bucket) || EntryIsDeleted(*current_bucket));
self->current_bucket = current_bucket;
return EntryGetValue(*current_bucket);
......@@ -631,7 +631,7 @@ void hashset_remove_iterator(HashSet *self, const HashSetIterator *iter)
/* needs to be on a valid element */
assert(entry < self->entries + self->num_buckets);
if(EntryIsDeleted(*entry))
if (EntryIsDeleted(*entry))
return;
EntrySetDeleted(*entry);
......
......@@ -275,11 +275,11 @@ row_done: ;
goto done;
unmatched = t;
while (1) {
for (;;) {
DBG((p->dbg, LEVEL_1, "Matched %d rows.\n", m - t));
q = 0;
while (1) {
for (;;) {
while (q < t) {
/* Begin explore node q of the forest 19 */
k = unchosen_row[q];
......@@ -351,7 +351,7 @@ row_done: ;
breakthru:
/* Begin update the matching 20 */
DBG((p->dbg, LEVEL_1, "Breakthrough at node %d of %d.\n", q, t));
while (1) {
for (;;) {
j = col_mate[k];
col_mate[k] = l;
row_mate[l] = k;
......
......@@ -91,7 +91,7 @@ static void pqueue_heapify(pqueue_t *q, unsigned pos)
*/
static void pqueue_sift_up(pqueue_t *q, unsigned pos)
{
while(q->elems[pos].priority > q->elems[pos / 2].priority) {
while (q->elems[pos].priority > q->elems[pos / 2].priority) {
pqueue_el_t tmp;
tmp = q->elems[pos];
......@@ -129,7 +129,7 @@ void pqueue_put(pqueue_t *q, void *data, int priority)
void *pqueue_pop_front(pqueue_t *q)
{
switch(ARR_LEN(q->elems)) {
switch (ARR_LEN(q->elems)) {
case 0:
assert(0 && "Attempt to retrieve element from empty priority queue.");
return NULL;
......
......@@ -597,7 +597,7 @@ static inline void pop_scc_to_loop(ir_graph *irg)
add_loop_irg(current_loop, m);
m->l = current_loop;
//m->callgraph_loop_depth = current_loop->depth;
} while(m != irg);
} while (m != irg);
}
/* GL ??? my last son is my grandson??? Removes cfloops with no
......
......@@ -67,7 +67,7 @@
#define MAX_INT_FREQ 1000000
#define set_foreach(s,i) for((i)=set_first((s)); (i); (i)=set_next((s)))
#define set_foreach(s,i) for ((i)=set_first((s)); (i); (i)=set_next((s)))
typedef struct _freq_t {
const ir_node *irn;
......@@ -117,7 +117,7 @@ set_insert_freq(set * set, const ir_node * irn)
double
get_block_execfreq(const ir_exec_freq *ef, const ir_node * irn)
{
if(!ef->infeasible) {
if (!ef->infeasible) {
set *freqs = ef->set;
freq_t *freq;
assert(is_Block(irn));
......@@ -155,7 +155,7 @@ solve_lgs(gs_matrix_t *mat, double *x, int size)
do {
++iter;
dev = gs_matrix_gauss_seidel(mat, x, size);
} while(fabs(dev) > SEIDEL_TOLERANCE);
} while (fabs(dev) > SEIDEL_TOLERANCE);
stat_ev_tim_pop("execfreq_seidel_time");
stat_ev_dbl("execfreq_seidel_iter", iter);
......@@ -224,7 +224,7 @@ get_cf_probability(ir_node *bb, int pos, double loop_weight)
static void exec_freq_node_info(void *ctx, FILE *f, const ir_node *irn)
{
if(is_Block(irn)) {
if (is_Block(irn)) {
ir_exec_freq *ef = ctx;
fprintf(f, "execution frequency: %g/%lu\n", get_block_execfreq(ef, irn), get_block_execfreq_ulong(ef, irn));
}
......@@ -309,7 +309,7 @@ compute_execfreq(ir_graph * irg, double loop_weight)
freq->idx = idx;
/* Sum of (execution frequency of predecessor * probability of cf edge) ... */
for(i = get_Block_n_cfgpreds(bb) - 1; i >= 0; --i) {
for (i = get_Block_n_cfgpreds(bb) - 1; i >= 0; --i) {
ir_node *pred = get_Block_cfgpred_block(bb, i);
int pred_idx = size - dfs_get_post_num(dfs, pred) - 1;
......@@ -370,7 +370,7 @@ compute_execfreq(ir_graph * irg, double loop_weight)
ef->max = MAX(ef->max, freq->freq);
/* Get the minimum non-zero execution frequency. */
if(freq->freq > 0.0)
if (freq->freq > 0.0)
ef->min_non_zero = MIN(ef->min_non_zero, freq->freq);
}
......@@ -393,14 +393,14 @@ compute_execfreq(ir_graph * irg, double loop_weight)
* find the smallest difference of the execution frequencies
* we try to ressolve it with 1 integer.
*/
for(i = 0; i < n; ++i) {
if(fs[i] <= 0.0)
for (i = 0; i < n; ++i) {
if (fs[i] <= 0.0)
continue;
for(j = i + 1; j < n; ++j) {
for (j = i + 1; j < n; ++j) {
double diff = fabs(fs[i] - fs[j]);
if(!UNDEF(diff))
if (!UNDEF(diff))
smallest_diff = MIN(diff, smallest_diff);
}
}
......@@ -415,7 +415,7 @@ compute_execfreq(ir_graph * irg, double loop_weight)
* if the slope is so high that the largest integer would be larger than MAX_INT_FREQ
* set the largest int freq to that upper limit and recompute the translation function
*/
if(ef->m * h2 + ef->b > MAX_INT_FREQ) {
if (ef->m * h2 + ef->b > MAX_INT_FREQ) {
ef->m = (h1 - l1) / (h2 - l2);
ef->b = l1 - ef->m * l2;
}
......
......@@ -155,7 +155,7 @@ double get_type_estimated_mem_consumption_bytes(ir_type *tp)
int get_type_estimated_n_fields(ir_type *tp)
{
int s = 0;
switch(get_type_tpop_code(tp)) {
switch (get_type_tpop_code(tp)) {
case tpo_primitive:
case tpo_pointer:
......@@ -197,7 +197,7 @@ int get_type_estimated_size_bytes(ir_type *tp)
{
int s = 0;
switch(get_type_tpop_code(tp)) {
switch (get_type_tpop_code(tp)) {
case tpo_primitive:
case tpo_pointer:
......
......@@ -63,7 +63,7 @@ static void height_dump_cb(void *data, FILE *f, const ir_node *irn)
heights_t *heights = data;
irn_height_t *h = phase_get_irn_data(&heights->ph, irn);
if(h)
if (h)
fprintf(f, "height: %u\n", h->height);
}
......@@ -81,32 +81,32 @@ static int search(heights_t *h, const ir_node *curr, const ir_node *tgt)
int i, n;
/* if the current node is the one we were looking for, we're done. */
if(curr == tgt)
if (curr == tgt)
return 1;
/* If we are in another block or at a phi we won't find our target. */
if(get_nodes_block(curr) != get_nodes_block(tgt))
if (get_nodes_block(curr) != get_nodes_block(tgt))
return 0;
if(is_Phi(curr))
if (is_Phi(curr))
return 0;
/* Check, if we have already been here. Coming more often won't help :-) */
h_curr = phase_get_irn_data(&h->ph, curr);
if(h_curr->visited >= h->visited)
if (h_curr->visited >= h->visited)
return 0;
/* If we are too deep into the DAG we won't find the target either. */
h_tgt = phase_get_irn_data(&h->ph, tgt);
if(h_curr->height > h_tgt->height)
if (h_curr->height > h_tgt->height)
return 0;
/* Mark this place as visited. */
h_curr->visited = h->visited;
/* Start a search from this node. */
for(i = 0, n = get_irn_ins_or_deps(curr); i < n; ++i) {
for (i = 0, n = get_irn_ins_or_deps(curr); i < n; ++i) {
ir_node *op = get_irn_in_or_dep(curr, i);
if(search(h, op, tgt))
if (search(h, op, tgt))
return 1;
}
......@@ -125,7 +125,7 @@ int heights_reachable_in_block(heights_t *h, const ir_node *n, const ir_node *m)
assert(get_nodes_block(n) == get_nodes_block(m));
assert(hn != NULL && hm != NULL);
if(hn->height <= hm->height) {
if (hn->height <= hm->height) {
h->visited++;
res = search(h, n, m);
}
......@@ -146,7 +146,7 @@ static unsigned compute_height(heights_t *h, ir_node *irn, const ir_node *bl)
const ir_edge_t *edge;
/* bail out if we already visited that node. */
if(ih->visited >= h->visited)
if (ih->visited >= h->visited)
return ih->height;
ih->visited = h->visited;
......@@ -155,7 +155,7 @@ static unsigned compute_height(heights_t *h, ir_node *irn, const ir_node *bl)
foreach_out_edge(irn, edge) {
ir_node *dep = get_edge_src_irn(edge);
if(!is_Block(dep) && !is_Phi(dep) && get_nodes_block(dep) == bl) {
if (!is_Block(dep) && !is_Phi(dep) && get_nodes_block(dep) == bl) {
unsigned dep_height = compute_height(h, dep, bl);
ih->height = MAX(ih->height, dep_height);
}
......@@ -167,7 +167,7 @@ static unsigned compute_height(heights_t *h, ir_node *irn, const ir_node *bl)
ir_node *dep = get_edge_src_irn(edge);
assert(!is_Phi(dep));
if(!is_Block(dep) && get_nodes_block(dep) == bl) {
if (!is_Block(dep) && get_nodes_block(dep) == bl) {
unsigned dep_height = compute_height(h, dep, bl);
ih->height = MAX(ih->height, dep_height);
}
......
......@@ -70,7 +70,7 @@ void set_Block_idom(ir_node *bl, ir_node *n)
* If we don't set the root of the dominator tree
* Append bl to the dominates queue of n.
*/
if(n != NULL) {
if (n != NULL) {
ir_dom_info *ni = get_dom_info(n);
bli->next = ni->first;
......@@ -101,7 +101,7 @@ void set_Block_ipostdom(ir_node *bl, ir_node *n)
* If we don't set the root of the post dominator tree
* Append bl to the post dominates queue of n.
*/
if(n != NULL) {
if (n != NULL) {
ir_dom_info *ni = get_pdom_info(n);
bli->next = ni->first;
......@@ -347,14 +347,14 @@ void dom_tree_walk(ir_node *bl, irg_walk_func *pre,
{
ir_node *p;
if(pre)
if (pre)
pre(bl, env);
dominates_for_each(bl, p) {
dom_tree_walk(p, pre, post, env);
}
if(post)
if (post)
post(bl, env);
}
......@@ -364,14 +364,14 @@ void postdom_tree_walk(ir_node *bl, irg_walk_func *pre,
{
ir_node *p;
if(pre)
if (pre)
pre(bl, env);
postdominates_for_each(bl, p) {
postdom_tree_walk(p, pre, post, env);
}
if(post)
if (post)
post(bl, env);
}
......@@ -422,7 +422,7 @@ static void assign_tree_dom_pre_order_max(ir_node *bl, void *data)
unsigned children = 0;
(void) data;
for(p = bi->first; p; p = get_dom_info(p)->next) {
for (p = bi->first; p; p = get_dom_info(p)->next) {
unsigned max_p = get_dom_info(p)->max_subtree_pre_num;
max = max > max_p ? max : max_p;
children++;
......@@ -448,7 +448,7 @@ static void assign_tree_postdom_pre_order_max(ir_node *bl, void *data)
unsigned children = 0;
(void) data;
for(p = bi->first; p; p = get_pdom_info(p)->next) {
for (p = bi->first; p; p = get_pdom_info(p)->next) {