Commit ea75e9d3 authored by Matthias Braun's avatar Matthias Braun
Browse files

make firm (mostly) -Wmissing-prototypes clean

[r27277]
parent 6b5dba40
......@@ -1270,7 +1270,8 @@ ir_node *new_rd_Const_type(dbg_info *db, ir_graph *irg,
*/
ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, tarval *con);
/** Constructor for a Const node.
/**
* Constructor for a Const node.
*
* Adds the node to the start block.
*
......@@ -2902,6 +2903,15 @@ ir_node *new_d_Const_type(dbg_info *db, tarval *con, ir_type *tp);
*/
ir_node *new_d_Const(dbg_info *db, tarval *con);
/**
* @see new_rd_Const_long()
*
* @param *db A pointer for debug information.
* @param *mode The mode of the operands and results.
* @param value A value from which the tarval is made.
*/
ir_node *new_d_Const_long(dbg_info *db, ir_mode *mode, long value);
/** Constructor for a SymConst_type node.
*
* This is the constructor for a symbolic constant.
......@@ -4343,15 +4353,41 @@ ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
int n_outs, ir_asm_constraint *outputs,
int n_clobber, ident *clobber[], ident *asm_text);
/** Constructor for a Dummy node.
/**
* @brief Constructor for a Dummy node.
*
* @param *db debug info for the node
* @param *mode The mode of the node.
* @param *irg the graph to put the node into
* @returns the newly created note
*/
ir_node *new_Dummy(ir_mode *mode);
ir_node *new_rd_Dummy(dbg_info *db, ir_graph *irg, ir_mode *mode);
/**
* @copybrief new_rd_Dummy()
*
* @param *mode The mode of the node.
* @param *irg the graph to put the node into
* @returns the newly created note
*/
ir_node *new_r_Dummy(ir_graph *irg, ir_mode *mode);
ir_node *new_rd_Dummy(dbg_info *db, ir_graph *irg, ir_mode *mode);
/**
* @copybrief new_rd_Dummy()
*
* @param *db debug info for the node
* @param *mode The mode of the node.
* @returns the newly created note
*/
ir_node *new_d_Dummy(dbg_info *db, ir_mode *mode);
/**
* @copybrief new_rd_Dummy()
*
* @param *mode The mode of the node.
* @returns the newly created note
*/
ir_node *new_Dummy(ir_mode *mode);
/*---------------------------------------------------------------------*/
/* The comfortable interface. */
......
......@@ -270,6 +270,13 @@ void dump_ir_graph_w_types_file(ir_graph *irg, FILE *out);
*/
void dump_ir_block_graph_w_types(ir_graph *irg, const char *suffix);
/**
* same as @see dump_ir_block_graph_w_types() but dumps to a stream
* @param irg the graph to dump
* @param out stream to dump to
*/
void dump_ir_block_graph_w_types_file(ir_graph *irg, FILE *out);
/** The type of a dump function that is called for each graph.
*
* @param irg current visited graph
......
......@@ -161,6 +161,12 @@ void edges_reroute_kind(ir_node *old, ir_node *nw, ir_edge_kind_t kind, ir_graph
*/
int edges_verify(ir_graph *irg);
/**
* veriy a certrain kind of out edges of graph @p irg.
* @returns 1 if a problem was found, 0 otherwise
*/
int edges_verify_kind(ir_graph *irg, ir_edge_kind_t kind);
/**
* Set edge verification flag.
*/
......
......@@ -40,7 +40,6 @@
#define get_irg_params get_irg_n_locs
#define get_irg_n_loc get_irg_n_locs
#define set_irg_ent(X, Y) set_irg_entity(X, Y)
#define set_irg_params set_irg_n_loc
#define no_dom dom_none
#define no_outs outs_none
......
......@@ -43,10 +43,12 @@ int is_pseudo_ir_graph(ir_graph *irg);
/** Returns the number of pseudo graphs in the program. */
int get_irp_n_pseudo_irgs(void);
/** Add a graph as pseudo irg */
void add_irp_pseudo_irg(ir_graph *irg);
/** Returns the pos'th pseudo graph in the program. */
ir_graph *get_irp_pseudo_irg(int pos);
/** If set, get_irp_n_irgs() and get_irp_irg() behave as if all pseudo
graphs are in the irg list. If not set, get_entity_irg() returns
NULL if the entity refers to a pseudo irg. */
......
......@@ -207,6 +207,7 @@ void *ir_arr_resize(void *elts, int nelts, size_t eltsize)
* Do NOT use is in code, use ARR_LEN() macro!
* This function is intended to be called from a debugger.
*/
int array_len(const void *arr);
int array_len(const void *arr)
{
return ARR_LEN(arr);
......@@ -217,6 +218,7 @@ int array_len(const void *arr)
* Do NOT use is in code!.
* This function is intended to be called from a debugger.
*/
ir_arr_descr *array_descr(const void *arr);
ir_arr_descr *array_descr(const void *arr)
{
if (! arr)
......
......@@ -41,8 +41,10 @@
#define SCALAR_RETURN
#define SetRangeEmpty(ptr,size) memset(ptr, 0, (size) * sizeof(cpset_hashset_entry_t))
#define hashset_init _cpset_init
#define hashset_init_size _cpset_init_size
void cpset_init_(cpset_t *self);
#define hashset_init cpset_init_
void cpset_init_size_(cpset_t *self, size_t expected_elems);
#define hashset_init_size cpset_init_size_
#define hashset_destroy cpset_destroy
#define hashset_insert cpset_insert
#define hashset_remove cpset_remove
......@@ -59,7 +61,7 @@ void cpset_init(cpset_t *this, cpset_hash_function hash_function,
{
this->hash_function = hash_function;
this->cmp_function = cmp_function;
_cpset_init(this);
cpset_init_(this);
}
void cpset_init_size(cpset_t *this, cpset_hash_function hash_function,
......@@ -67,5 +69,5 @@ void cpset_init_size(cpset_t *this, cpset_hash_function hash_function,
{
this->hash_function = hash_function;
this->cmp_function = cmp_function;
_cpset_init_size(this, expected_elems);
cpset_init_size_(this, expected_elems);
}
......@@ -38,6 +38,8 @@
#include <stdlib.h>
#include "xmalloc.h"
#include "gaussjordan.h"
#define SMALL 0.00001
int firm_gaussjordansolve(double *A, double *vec, int nsize)
......
......@@ -325,18 +325,3 @@ void gs_matrix_dump(const gs_matrix_t *m, int a, int b, FILE *out)
xfree(elems);
}
void gs_matrix_self_test(int d)
{
int i, o;
gs_matrix_t *m = gs_new_matrix(10, 10);
for (i=0; i<d; ++i)
for (o=0; o<d; ++o)
gs_matrix_set(m, i, o, i*o);
for (i=0; i<d; ++i)
for (o=0; o<d; ++o)
assert(gs_matrix_get(m, i, o) == i*o);
gs_delete_matrix(m);
}
......@@ -42,15 +42,10 @@
#define hashset_destroy pset_new_destroy
#define hashset_insert pset_new_insert
#define hashset_remove pset_new_remove
#define hashset_find pset_new_find
#define hashset_find pset_new_contains
#define hashset_size pset_new_size
#define hashset_iterator_init pset_new_iterator_init
#define hashset_iterator_next pset_new_iterator_next
#define hashset_remove_iterator pset_new_remove_iterator
#include "hashset.c"
int pset_new_contains(const pset_new_t *pset_new, const ValueType val)
{
return pset_new_find(pset_new, val);
}
......@@ -204,8 +204,7 @@ int get_irg_callee_loop_depth(const ir_graph *irg, int pos)
return -1;
}
double get_irg_callee_execution_frequency(const ir_graph *irg, int pos)
static double get_irg_callee_execution_frequency(const ir_graph *irg, int pos)
{
ir_node **arr = irg->callees[pos]->call_list;
int i, n_Calls = ARR_LEN(arr);
......@@ -217,15 +216,16 @@ double get_irg_callee_execution_frequency(const ir_graph *irg, int pos)
return freq;
}
double get_irg_callee_method_execution_frequency(const ir_graph *irg, int pos)
static double get_irg_callee_method_execution_frequency(const ir_graph *irg,
int pos)
{
double call_freq = get_irg_callee_execution_frequency(irg, pos);
double meth_freq = get_irg_method_execution_frequency(irg);
return call_freq * meth_freq;
}
double get_irg_caller_method_execution_frequency(const ir_graph *irg, int pos)
static double get_irg_caller_method_execution_frequency(const ir_graph *irg,
int pos)
{
ir_graph *caller = get_irg_caller(irg, pos);
int pos_callee = reverse_pos(irg, pos);
......@@ -234,7 +234,6 @@ double get_irg_caller_method_execution_frequency(const ir_graph *irg, int pos)
}
/* --------------------- Compute the callgraph ------------------------ */
/**
......
......@@ -130,7 +130,7 @@ static int just_passed_a_Raise = 0;
static ir_node *Cond_list = NULL;
/* We do not use an extra set, as Projs are not yet in the existing one. */
void set_ProjX_probability(ir_node *n, Cond_prob prob)
static void set_ProjX_probability(ir_node *n, Cond_prob prob)
{
reg_exec_freq ef;
ef.reg = n;
......@@ -138,7 +138,7 @@ void set_ProjX_probability(ir_node *n, Cond_prob prob)
set_insert(exec_freq_set, &ef, sizeof(ef), exec_freq_hash(&ef));
}
Cond_prob get_ProjX_probability(ir_node *n)
static Cond_prob get_ProjX_probability(ir_node *n)
{
reg_exec_freq ef, *found;
ef.reg = n;
......@@ -245,7 +245,7 @@ static void walk_post(ir_node *n, void *env)
/** Precompute which Conds test for an exception.
*
* Operates on current_ir_graph. */
void precompute_cond_evaluation(void)
static void precompute_cond_evaluation(void)
{
ir_node *c;
......
......@@ -26,19 +26,18 @@
*/
#include "config.h"
#include "height.h"
#include <stdlib.h>
#include <stdio.h>
#include "list.h"
#include "irdump.h"
#include "irgwalk.h"
#include "irtools.h"
#include "irphase_t.h"
#include "iredges_t.h"
typedef struct _heights_t heights_t;
struct _heights_t {
ir_phase ph;
unsigned visited;
......
......@@ -131,7 +131,7 @@ int get_region_n_exc_outs(void *region)
return get_region_attr(region)->n_exc_outs;
}
void inc_region_n_exc_outs(void *region)
static void inc_region_n_exc_outs(void *region)
{
(get_region_attr(region)->n_exc_outs)++;
}
......@@ -463,7 +463,7 @@ void free_intervals(void)
/* */
/*------------------------------------------------------------------*/
void dump_region_edges(FILE *F, void *reg)
static void dump_region_edges(FILE *F, void *reg)
{
int i, n_ins = get_region_n_ins(reg);
......
......@@ -788,6 +788,7 @@ int construct_ip_cf_backedges (void)
}
#endif
#if 0
/**
* Clear the intra- and the interprocedural
* backedge information pf a block.
......@@ -828,7 +829,7 @@ static void loop_reset_backedges(ir_loop *l)
/* Removes all cfloop information.
Resets all backedges */
void free_cfloop_information(ir_graph *irg)
static void free_cfloop_information(ir_graph *irg)
{
ir_loop *loop = get_irg_loop(irg);
if (loop != NULL) {
......@@ -854,3 +855,5 @@ void free_all_cfloop_information(void)
set_interprocedural_view(rem);
#endif
}
#endif
......@@ -26,6 +26,8 @@
*/
#include "config.h"
#include "irconsconfirm.h"
#include "irgraph_t.h"
#include "irnode_t.h"
#include "ircons_t.h"
......
......@@ -314,6 +314,7 @@ void lv_chk_free(lv_chk_t *lv)
xfree(lv);
}
#if 0
/**
* Check if a node is live at the end of a block.
* This function is for internal use as its code is shared between
......@@ -483,6 +484,7 @@ unsigned lv_chk_bl_end_mask(const lv_chk_t *lv, const ir_node *bl, const ir_node
end:
return res;
}
#endif
/**
* Check a nodes liveness situation of a block.
......
......@@ -659,48 +659,3 @@ void free_irg_outs(ir_graph *irg)
irg_walk_graph (irg, reset_outs, NULL, NULL);
#endif /* defined DEBUG_libfirm */
}
static void check_out_edges(ir_node *irn, void *env)
{
int i, j, pos;
int *pError = env;
int error = *pError;
int last = is_Block(irn) ? 0 : -1;
/* check forward: every input must have an out edge */
for (i = get_irn_arity(irn) - 1; i >= last; --i) {
ir_node *pred = get_irn_n(irn, i);
for (j = get_irn_n_outs(pred) - 1; j >= 0; --j) {
ir_node *user = get_irn_out_ex(pred, j, &pos);
if (user == irn && pos == i) {
break;
}
}
if (j < 0) {
ir_fprintf(stderr, "Missing out edge from %+F input %d to %+F", irn, i, pred);
++error;
}
}
/* checking backward */
for (i = get_irn_n_outs(irn) - 1; i >= 0; --i) {
ir_node *user = get_irn_out_ex(irn, i, &pos);
if (get_irn_n(user, pos) != irn) {
ir_fprintf(stderr, "Spurious out edge from %+F output %d to %+F", irn, i, user);
++error;
}
}
*pError = error;
}
/* verify outs edges. */
void verify_outs(ir_graph *irg)
{
int errors = 0;
irg_walk_graph(irg, NULL, check_out_edges, &errors);
if (errors > 0)
panic("Out edges are corrupt");
}
......@@ -1196,79 +1196,11 @@ void free_all_loop_information(void)
#endif
}
/* Debug stuff *************************************************/
static int test_loop_node(ir_loop *l)
{
int i, has_node = 0, found_problem = 0;
loop_element le;
assert(l && l->kind == k_ir_loop);
if (get_loop_n_elements(l) == 0) {
found_problem = 1;
dump_loop(l, "-ha");
}
le = get_loop_element(l, 0);
if (*(le.kind) != k_ir_node) {
assert(le.kind && *(le.kind) == k_ir_loop);
found_problem = 1;
dump_loop(l, "-ha");
}
if ((*(le.kind) == k_ir_node) && !is_possible_loop_head(le.node)) {
found_problem = 1;
dump_loop(l, "-ha");
}
if ((get_loop_depth(l) != 0) &&
(*(le.kind) == k_ir_node) && !has_backedges(le.node)) {
found_problem = 1;
dump_loop(l, "-ha");
}
/* Recur */
has_node = 0;
for (i = 0; i < get_loop_n_elements(l); ++i) {
le = get_loop_element(l, i);
if (*(le.kind) == k_ir_node)
has_node++;
else
if (test_loop_node(le.son)) found_problem = 1;
}
if (has_node == 0) {
found_problem = 1;
dump_loop(l, "-ha");
}
return found_problem;
}
/** Prints all loop nodes that
* - do not have any firm nodes, only loop sons
* - the header is not a Phi, Block or Filter.
*/
void find_strange_loop_nodes(ir_loop *l)
{
int found_problem = 0;
found_problem = test_loop_node(l);
printf("Finished Test\n\n");
if (found_problem) exit(0);
}
/* ------------------------------------------------------------------- */
/* Simple analyses based on the loop information */
/* ------------------------------------------------------------------- */
int is_loop_variant(ir_loop *l, ir_loop *b)
static int is_loop_variant(ir_loop *l, ir_loop *b)
{
int i, n_elems;
......
......@@ -26,12 +26,12 @@
*/
#include "config.h"
#include "irnode.h"
#include "trouts.h"
#include "array.h"
#include "pmap.h"
#include "irnode_t.h"
#include "irprog_t.h"
#include "irgwalk.h"
#include "irnode.h"
......@@ -196,7 +196,7 @@ static ir_type **get_type_arraytype_array(const ir_type *tp)
return res;
}
void set_type_arraytype_array(const ir_type *tp, ir_type **pts)
static void set_type_arraytype_array(const ir_type *tp, ir_type **pts)
{
ir_type **old = pmap_get(type_arraytype_map, tp);
if (old != pts)
......@@ -245,6 +245,7 @@ static void add_entity_access(const ir_entity *ent, ir_node *n)
set_entity_access_array(ent, accs);
}
#if 0
void set_entity_access(const ir_entity *ent, int pos, ir_node *n)
{
ir_node ** accs;
......@@ -255,6 +256,7 @@ void set_entity_access(const ir_entity *ent, int pos, ir_node *n)
accs = get_entity_access_array(ent);
accs[pos] = n;
}
#endif
/*------------------------------------------------------------------*/
......@@ -290,6 +292,7 @@ static void add_entity_reference(const ir_entity *ent, ir_node *n)
set_entity_reference_array(ent, refs);
}
#if 0
void set_entity_reference(const ir_entity *ent, int pos, ir_node *n)
{
ir_node ** refs;
......@@ -300,7 +303,7 @@ void set_entity_reference(const ir_entity *ent, int pos, ir_node *n)
refs = get_entity_reference_array(ent);
refs[pos] = n;
}
#endif
/**------------------------------------------------------------------*/
/* Access routines for types */
......@@ -339,6 +342,7 @@ static void add_type_alloc(const ir_type *tp, ir_node *n)
set_type_alloc_array(tp, allocs);
}
#if 0
void set_type_alloc(const ir_type *tp, int pos, ir_node *n)
{
ir_node **allocs;
......@@ -349,6 +353,7 @@ void set_type_alloc(const ir_type *tp, int pos, ir_node *n)
allocs = get_type_alloc_array(tp);
allocs[pos] = n;
}
#endif
/* Number of Cast nodes that create an instance of this type */
int get_type_n_casts(const ir_type *tp)
......@@ -408,6 +413,7 @@ void add_type_cast(const ir_type *tp, ir_node *n)
set_type_cast_array(tp, casts);
}
#if 0
void set_type_cast(const ir_type *tp, int pos, ir_node *n)
{
ir_node **casts;
......@@ -418,6 +424,7 @@ void set_type_cast(const ir_type *tp, int pos, ir_node *n)
casts = get_type_cast_array(tp);
casts[pos] = n;
}
#endif
/*------------------------------------------------------------------*/
......@@ -453,6 +460,7 @@ void add_type_pointertype_to(const ir_type *tp, ir_type *ptp)
set_type_pointertype_array(tp, pts);
}
#if 0
void set_type_pointertype_to(const ir_type *tp, int pos, ir_type *ptp)
{
ir_type ** pts;
......@@ -463,7 +471,7 @@ void set_type_pointertype_to(const ir_type *tp, int pos, ir_type *ptp)
pts = get_type_pointertype_array(tp);
pts[pos] = ptp;
}
#endif
/*------------------------------------------------------------------*/
......@@ -499,6 +507,7 @@ void add_type_arraytype_of(const ir_type *tp, ir_type *atp)
set_type_arraytype_array(tp, pts);
}
#if 0
void set_type_arraytype_of(const ir_type *tp, int pos, ir_type *atp)
{
ir_type ** pts;
......@@ -509,6 +518,7 @@ void set_type_arraytype_of(const ir_type *tp, int pos, ir_type *atp)
pts = get_type_arraytype_array(tp);
pts[pos] = atp;
}
#endif
/*------------------------------------------------------------------*/
/* Building and Removing the out datastructure */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment