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 ...@@ -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. */ /* Else search for set bits in the next units. */
while (1) { for (;;) {
elem_pos++; elem_pos++;
elem = bitset[elem_pos] ^ mask; elem = bitset[elem_pos] ^ mask;
......
...@@ -45,7 +45,7 @@ bipartite_t *bipartite_new(int n_left, int n_right) ...@@ -45,7 +45,7 @@ bipartite_t *bipartite_new(int n_left, int n_right)
gr->n_left = n_left; gr->n_left = n_left;
gr->n_right = n_right; 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); gr->adj[i] = bitset_malloc(n_right);
return gr; return gr;
...@@ -54,7 +54,7 @@ bipartite_t *bipartite_new(int n_left, int n_right) ...@@ -54,7 +54,7 @@ bipartite_t *bipartite_new(int n_left, int n_right)
void bipartite_free(bipartite_t *gr) void bipartite_free(bipartite_t *gr)
{ {
int i; int i;
for(i = 0; i < gr->n_left; ++i) for (i = 0; i < gr->n_left; ++i)
bitset_free(gr->adj[i]); bitset_free(gr->adj[i]);
free(gr); free(gr);
} }
...@@ -84,18 +84,18 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching, ...@@ -84,18 +84,18 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching,
int done_something = 0; int done_something = 0;
bitset_t *tmp = bitset_alloca(gr->n_right); 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]; bitset_t *left_adj = gr->adj[left];
int i; int i;
bitset_copy(tmp, left_adj); bitset_copy(tmp, left_adj);
if(matching[left] >= 0) { if (matching[left] >= 0) {
int old_right = matching[left]; int old_right = matching[left];
/* Check of all neighbors of the left node are already matched. /* Check of all neighbors of the left node are already matched.
* We cannot improve this edge then. */ * We cannot improve this edge then. */
if(bitset_contains(left_adj, matched_right)) if (bitset_contains(left_adj, matched_right))
continue; continue;
bitset_andnot(tmp, matched_right); bitset_andnot(tmp, matched_right);
...@@ -107,12 +107,12 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching, ...@@ -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. 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 This node must not be part of a matching
*/ */
for(i = 0; i < gr->n_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)) if (i != left && bitset_is_set(gr->adj[i], old_right) && !bitset_is_set(matched_left, i))
break; break;
/* If no such node can be found, exit. */ /* If no such node can be found, exit. */
if(i >= gr->n_left) if (i >= gr->n_left)
continue; continue;
/* Else, we can improve this edge. */ /* Else, we can improve this edge. */
...@@ -129,7 +129,7 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching, ...@@ -129,7 +129,7 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching,
assert(!bitset_is_set(matched_left, left)); assert(!bitset_is_set(matched_left, left));
bitset_andnot(tmp, matched_right); bitset_andnot(tmp, matched_right);
if(bitset_is_empty(tmp)) if (bitset_is_empty(tmp))
continue; continue;
right = bitset_next_set(tmp, 0); right = bitset_next_set(tmp, 0);
...@@ -150,14 +150,14 @@ void bipartite_matching(const bipartite_t *gr, int *matching) ...@@ -150,14 +150,14 @@ void bipartite_matching(const bipartite_t *gr, int *matching)
bitset_t *matched_right = bitset_alloca(gr->n_right); bitset_t *matched_right = bitset_alloca(gr->n_right);
memset(matching, -1, gr->n_left * sizeof(int)); 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) void bipartite_dump_f(FILE *f, const bipartite_t *gr)
{ {
int i; int i;
for(i = 0; i < gr->n_left; ++i) { for (i = 0; i < gr->n_left; ++i) {
fprintf(f, "%d: ", i); fprintf(f, "%d: ", i);
bitset_fprint(f, gr->adj[i]); bitset_fprint(f, gr->adj[i]);
fprintf(f, "\n"); fprintf(f, "\n");
......
...@@ -74,7 +74,7 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize) ...@@ -74,7 +74,7 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize)
} }
/* swap rows */ /* swap rows */
for(i=0;i<nsize;i++) { for (i=0;i<nsize;i++) {
temp = _A(col,i); temp = _A(col,i);
_A(col,i) = _A(biggest_r,i); _A(col,i) = _A(biggest_r,i);
_A(biggest_r,i) = temp; _A(biggest_r,i) = temp;
...@@ -85,7 +85,7 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize) ...@@ -85,7 +85,7 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize)
vec[biggest_r] = temp; vec[biggest_r] = temp;
/* swap columns */ /* swap columns */
for(i=0;i<nsize;i++) { for (i=0;i<nsize;i++) {
temp = _A(i,col); temp = _A(i,col);
_A(i,col) = _A(i,biggest_c); _A(i,col) = _A(i,biggest_c);
_A(i,biggest_c) = temp; _A(i,biggest_c) = temp;
...@@ -97,13 +97,13 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize) ...@@ -97,13 +97,13 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize)
/* partially annihilate this col */ /* partially annihilate this col */
/* zero columns below diag */ /* zero columns below diag */
for(row=col+1;row<nsize;row++) { for (row=col+1;row<nsize;row++) {
/* changes during calc */ /* changes during calc */
temp = _A(row,col) / _A(col,col); temp = _A(row,col) / _A(col,col);
/* annihilates A[][] */ /* annihilates A[][] */
for(i=col;i<nsize;i++) for (i=col;i<nsize;i++)
_A(row,i) = _A(row,i) - temp * _A(col,i); _A(row,i) = _A(row,i) - temp * _A(col,i);
/* same op on vec */ /* same op on vec */
...@@ -115,14 +115,14 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize) ...@@ -115,14 +115,14 @@ int firm_gaussjordansolve(double *A, double *vec, int nsize)
scramvec[nsize - 1] = vec[nsize - 1] / _A(nsize - 1,nsize - 1); scramvec[nsize - 1] = vec[nsize - 1] / _A(nsize - 1,nsize - 1);
/* answer needs sorting */ /* answer needs sorting */
for(i=nsize-2;i>=0;i--) { for (i=nsize-2;i>=0;i--) {
sum = 0; sum = 0;
for(j=i+1;j<nsize;j++) for (j=i+1;j<nsize;j++)
sum = sum + _A(i,j) * scramvec[j]; sum = sum + _A(i,j) * scramvec[j];
scramvec[i] = (vec[i] - sum) / _A(i,i); scramvec[i] = (vec[i] - sum) / _A(i,i);
} }
/* reorder unknowns--return in vec */ /* reorder unknowns--return in vec */
for(i=0;i<nsize;i++) { for (i=0;i<nsize;i++) {
j = x[i]; j = x[i];
vec[j] = scramvec[i]; vec[j] = scramvec[i];
} }
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
size_t _i; \ size_t _i; \
size_t _size = (size); \ size_t _size = (size); \
HashSetEntry *entries = (ptr); \ HashSetEntry *entries = (ptr); \
for(_i = 0; _i < _size; ++_i) { \ for (_i = 0; _i < _size; ++_i) { \
HashSetEntry *entry = & entries[_i]; \ HashSetEntry *entry = & entries[_i]; \
EntrySetEmpty(*entry); \ EntrySetEmpty(*entry); \
} \ } \
...@@ -231,14 +231,14 @@ InsertReturnValue insert_nogrow(HashSet *self, KeyType key) ...@@ -231,14 +231,14 @@ InsertReturnValue insert_nogrow(HashSet *self, KeyType key)
assert((num_buckets & (num_buckets - 1)) == 0); assert((num_buckets & (num_buckets - 1)) == 0);
while(1) { for (;;) {
HashSetEntry *entry = & self->entries[bucknum]; HashSetEntry *entry = & self->entries[bucknum];
if(EntryIsEmpty(*entry)) { if (EntryIsEmpty(*entry)) {
size_t p; size_t p;
HashSetEntry *nentry; HashSetEntry *nentry;
if(insert_pos != ILLEGAL_POS) { if (insert_pos != ILLEGAL_POS) {
p = insert_pos; p = insert_pos;
} else { } else {
p = bucknum; p = bucknum;
...@@ -250,11 +250,11 @@ InsertReturnValue insert_nogrow(HashSet *self, KeyType key) ...@@ -250,11 +250,11 @@ InsertReturnValue insert_nogrow(HashSet *self, KeyType key)
self->num_elements++; self->num_elements++;
return GetInsertReturnValue(*nentry, 0); return GetInsertReturnValue(*nentry, 0);
} }
if(EntryIsDeleted(*entry)) { if (EntryIsDeleted(*entry)) {
if(insert_pos == ILLEGAL_POS) if (insert_pos == ILLEGAL_POS)
insert_pos = bucknum; insert_pos = bucknum;
} else if(EntryGetHash(self, *entry) == hash) { } else if (EntryGetHash(self, *entry) == hash) {
if(KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) { if (KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
// Value already in the set, return it // Value already in the set, return it
return GetInsertReturnValue(*entry, 1); return GetInsertReturnValue(*entry, 1);
} }
...@@ -295,14 +295,14 @@ void insert_new(HashSet *self, unsigned hash, ValueType value) ...@@ -295,14 +295,14 @@ void insert_new(HashSet *self, unsigned hash, ValueType value)
//assert(value != NullValue); //assert(value != NullValue);
while(1) { for (;;) {
HashSetEntry *entry = & self->entries[bucknum]; HashSetEntry *entry = & self->entries[bucknum];
if(EntryIsEmpty(*entry)) { if (EntryIsEmpty(*entry)) {
size_t p; size_t p;
HashSetEntry *nentry; HashSetEntry *nentry;
if(insert_pos != ILLEGAL_POS) { if (insert_pos != ILLEGAL_POS) {
p = insert_pos; p = insert_pos;
} else { } else {
p = bucknum; p = bucknum;
...@@ -349,9 +349,9 @@ void resize(HashSet *self, size_t new_size) ...@@ -349,9 +349,9 @@ void resize(HashSet *self, size_t new_size)
reset_thresholds(self); reset_thresholds(self);
/* reinsert all elements */ /* reinsert all elements */
for(i = 0; i < num_buckets; ++i) { for (i = 0; i < num_buckets; ++i) {
HashSetEntry *entry = & old_entries[i]; HashSetEntry *entry = & old_entries[i];
if(EntryIsEmpty(*entry) || EntryIsDeleted(*entry)) if (EntryIsEmpty(*entry) || EntryIsDeleted(*entry))
continue; continue;
insert_new(self, EntryGetHash(self, *entry), EntryGetValue(*entry)); insert_new(self, EntryGetHash(self, *entry), EntryGetValue(*entry));
...@@ -376,7 +376,7 @@ void maybe_grow(HashSet *self) ...@@ -376,7 +376,7 @@ void maybe_grow(HashSet *self)
{ {
size_t resize_to; size_t resize_to;
if(LIKELY(self->num_elements + 1 <= self->enlarge_threshold)) if (LIKELY(self->num_elements + 1 <= self->enlarge_threshold))
return; return;
/* double table size */ /* double table size */
...@@ -394,20 +394,20 @@ void maybe_shrink(HashSet *self) ...@@ -394,20 +394,20 @@ void maybe_shrink(HashSet *self)
size_t size; size_t size;
size_t resize_to; size_t resize_to;
if(!self->consider_shrink) if (!self->consider_shrink)
return; return;
self->consider_shrink = 0; self->consider_shrink = 0;
size = hashset_size(self); size = hashset_size(self);
if(size <= HT_MIN_BUCKETS) if (size <= HT_MIN_BUCKETS)
return; return;
if(LIKELY(size > self->shrink_threshold)) if (LIKELY(size > self->shrink_threshold))
return; return;
resize_to = ceil_po2(size); resize_to = ceil_po2(size);
if(resize_to < 4) if (resize_to < 4)
resize_to = 4; resize_to = 4;
resize(self, resize_to); resize(self, resize_to);
...@@ -449,16 +449,16 @@ InsertReturnValue hashset_find(const HashSet *self, ConstKeyType key) ...@@ -449,16 +449,16 @@ InsertReturnValue hashset_find(const HashSet *self, ConstKeyType key)
unsigned hash = Hash(self, key); unsigned hash = Hash(self, key);
size_t bucknum = hash & hashmask; size_t bucknum = hash & hashmask;
while(1) { for (;;) {
HashSetEntry *entry = & self->entries[bucknum]; HashSetEntry *entry = & self->entries[bucknum];
if(EntryIsEmpty(*entry)) { if (EntryIsEmpty(*entry)) {
return NullReturnValue; return NullReturnValue;
} }
if(EntryIsDeleted(*entry)) { if (EntryIsDeleted(*entry)) {
// value is deleted // value is deleted
} else if(EntryGetHash(self, *entry) == hash) { } else if (EntryGetHash(self, *entry) == hash) {
if(KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) { if (KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
// found the value // found the value
return GetInsertReturnValue(*entry, 1); return GetInsertReturnValue(*entry, 1);
} }
...@@ -489,16 +489,16 @@ void hashset_remove(HashSet *self, ConstKeyType key) ...@@ -489,16 +489,16 @@ void hashset_remove(HashSet *self, ConstKeyType key)
self->entries_version++; self->entries_version++;
#endif #endif
while(1) { for (;;) {
HashSetEntry *entry = & self->entries[bucknum]; HashSetEntry *entry = & self->entries[bucknum];
if(EntryIsEmpty(*entry)) { if (EntryIsEmpty(*entry)) {
return; return;
} }
if(EntryIsDeleted(*entry)) { if (EntryIsDeleted(*entry)) {
// entry is deleted // entry is deleted
} else if(EntryGetHash(self, *entry) == hash) { } else if (EntryGetHash(self, *entry) == hash) {
if(KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) { if (KeysEqual(self, GetKey(EntryGetValue(*entry)), key)) {
EntrySetDeleted(*entry); EntrySetDeleted(*entry);
self->num_deleted++; self->num_deleted++;
self->consider_shrink = 1; self->consider_shrink = 1;
...@@ -519,7 +519,7 @@ void hashset_remove(HashSet *self, ConstKeyType key) ...@@ -519,7 +519,7 @@ void hashset_remove(HashSet *self, ConstKeyType key)
static inline static inline
void init_size(HashSet *self, size_t initial_size) void init_size(HashSet *self, size_t initial_size)
{ {
if(initial_size < 4) if (initial_size < 4)
initial_size = 4; initial_size = 4;
self->entries = Alloc(initial_size); self->entries = Alloc(initial_size);
...@@ -570,7 +570,7 @@ void hashset_init_size(HashSet *self, size_t expected_elements) ...@@ -570,7 +570,7 @@ void hashset_init_size(HashSet *self, size_t expected_elements)
size_t needed_size; size_t needed_size;
size_t po2size; size_t po2size;
if(expected_elements >= UINT_MAX/2) { if (expected_elements >= UINT_MAX/2) {
abort(); abort();
} }
...@@ -610,9 +610,9 @@ ValueType hashset_iterator_next(HashSetIterator *self) ...@@ -610,9 +610,9 @@ ValueType hashset_iterator_next(HashSetIterator *self)
do { do {
current_bucket++; current_bucket++;
if(current_bucket >= end) if (current_bucket >= end)
return NullValue; return NullValue;
} while(EntryIsEmpty(*current_bucket) || EntryIsDeleted(*current_bucket)); } while (EntryIsEmpty(*current_bucket) || EntryIsDeleted(*current_bucket));
self->current_bucket = current_bucket; self->current_bucket = current_bucket;
return EntryGetValue(*current_bucket); return EntryGetValue(*current_bucket);
...@@ -631,7 +631,7 @@ void hashset_remove_iterator(HashSet *self, const HashSetIterator *iter) ...@@ -631,7 +631,7 @@ void hashset_remove_iterator(HashSet *self, const HashSetIterator *iter)
/* needs to be on a valid element */ /* needs to be on a valid element */
assert(entry < self->entries + self->num_buckets); assert(entry < self->entries + self->num_buckets);
if(EntryIsDeleted(*entry)) if (EntryIsDeleted(*entry))
return; return;
EntrySetDeleted(*entry); EntrySetDeleted(*entry);
......
...@@ -275,11 +275,11 @@ row_done: ; ...@@ -275,11 +275,11 @@ row_done: ;
goto done; goto done;
unmatched = t; unmatched = t;
while (1) { for (;;) {
DBG((p->dbg, LEVEL_1, "Matched %d rows.\n", m - t)); DBG((p->dbg, LEVEL_1, "Matched %d rows.\n", m - t));
q = 0; q = 0;
while (1) { for (;;) {
while (q < t) { while (q < t) {
/* Begin explore node q of the forest 19 */ /* Begin explore node q of the forest 19 */
k = unchosen_row[q]; k = unchosen_row[q];
...@@ -351,7 +351,7 @@ row_done: ; ...@@ -351,7 +351,7 @@ row_done: ;
breakthru: breakthru:
/* Begin update the matching 20 */ /* Begin update the matching 20 */
DBG((p->dbg, LEVEL_1, "Breakthrough at node %d of %d.\n", q, t)); DBG((p->dbg, LEVEL_1, "Breakthrough at node %d of %d.\n", q, t));
while (1) { for (;;) {
j = col_mate[k]; j = col_mate[k];
col_mate[k] = l; col_mate[k] = l;
row_mate[l] = k; row_mate[l] = k;
......
...@@ -91,7 +91,7 @@ static void pqueue_heapify(pqueue_t *q, unsigned pos) ...@@ -91,7 +91,7 @@ static void pqueue_heapify(pqueue_t *q, unsigned pos)
*/ */
static void pqueue_sift_up(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; pqueue_el_t tmp;
tmp = q->elems[pos]; tmp = q->elems[pos];
...@@ -129,7 +129,7 @@ void pqueue_put(pqueue_t *q, void *data, int priority) ...@@ -129,7 +129,7 @@ void pqueue_put(pqueue_t *q, void *data, int priority)
void *pqueue_pop_front(pqueue_t *q) void *pqueue_pop_front(pqueue_t *q)
{ {
switch(ARR_LEN(q->elems)) { switch (ARR_LEN(q->elems)) {
case 0: case 0:
assert(0 && "Attempt to retrieve element from empty priority queue."); assert(0 && "Attempt to retrieve element from empty priority queue.");
return NULL; return NULL;
......
...@@ -597,7 +597,7 @@ static inline void pop_scc_to_loop(ir_graph *irg) ...@@ -597,7 +597,7 @@ static inline void pop_scc_to_loop(ir_graph *irg)
add_loop_irg(current_loop, m); add_loop_irg(current_loop, m);
m->l = current_loop; m->l = current_loop;
//m->callgraph_loop_depth = current_loop->depth; //m->callgraph_loop_depth = current_loop->depth;
} while(m != irg); } while (m != irg);
} }
/* GL ??? my last son is my grandson??? Removes cfloops with no /* GL ??? my last son is my grandson??? Removes cfloops with no
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#define MAX_INT_FREQ 1000000 #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 { typedef struct _freq_t {
const ir_node *irn; const ir_node *irn;
...@@ -117,7 +117,7 @@ set_insert_freq(set * set, const ir_node * irn) ...@@ -117,7 +117,7 @@ set_insert_freq(set * set, const ir_node * irn)
double double
get_block_execfreq(const ir_exec_freq *ef, const ir_node * irn) get_block_execfreq(const ir_exec_freq *ef, const ir_node * irn)
{ {
if(!ef->infeasible) { if (!ef->infeasible) {
set *freqs = ef->set; set *freqs = ef->set;
freq_t *freq; freq_t *freq;
assert(is_Block(irn)); assert(is_Block(irn));
...@@ -155,7 +155,7 @@ solve_lgs(gs_matrix_t *mat, double *x, int size) ...@@ -155,7 +155,7 @@ solve_lgs(gs_matrix_t *mat, double *x, int size)
do { do {
++iter; ++iter;
dev = gs_matrix_gauss_seidel(mat, x, size); 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_tim_pop("execfreq_seidel_time");
stat_ev_dbl("execfreq_seidel_iter", iter); stat_ev_dbl("execfreq_seidel_iter", iter);
...@@ -224,7 +224,7 @@ get_cf_probability(ir_node *bb, int pos, double loop_weight) ...@@ -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) 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; ir_exec_freq *ef = ctx;
fprintf(f, "execution frequency: %g/%lu\n", get_block_execfreq(ef, irn), get_block_execfreq_ulong(ef, irn)); 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) ...@@ -309,7 +309,7 @@ compute_execfreq(ir_graph * irg, double loop_weight)
freq->idx = idx; freq->idx = idx;