*/
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.
*
*/
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.
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. */
*/
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
*/
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.
*/
#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
/** 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. */
* 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);
* 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)
#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
{
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,
{
this->hash_function = hash_function;
this->cmp_function = cmp_function;
- _cpset_init_size(this, expected_elems);
+ cpset_init_size_(this, expected_elems);
}
#include <stdlib.h>
#include "xmalloc.h"
+#include "gaussjordan.h"
+
#define SMALL 0.00001
int firm_gaussjordansolve(double *A, double *vec, int nsize)
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);
-}
#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);
-}
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);
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);
}
-
/* --------------------- Compute the callgraph ------------------------ */
/**
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;
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;
/** 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;
*/
#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;
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)++;
}
/* */
/*------------------------------------------------------------------*/
-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);
}
#endif
+#if 0
/**
* Clear the intra- and the interprocedural
* backedge information pf a block.
/* 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) {
set_interprocedural_view(rem);
#endif
}
+
+#endif
*/
#include "config.h"
+#include "irconsconfirm.h"
+
#include "irgraph_t.h"
#include "irnode_t.h"
#include "ircons_t.h"
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
end:
return res;
}
+#endif
/**
* Check a nodes liveness situation of a block.
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");
-}
#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;
*/
#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"
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)
set_entity_access_array(ent, accs);
}
+#if 0
void set_entity_access(const ir_entity *ent, int pos, ir_node *n)
{
ir_node ** accs;
accs = get_entity_access_array(ent);
accs[pos] = n;
}
+#endif
/*------------------------------------------------------------------*/
set_entity_reference_array(ent, refs);
}
+#if 0
void set_entity_reference(const ir_entity *ent, int pos, ir_node *n)
{
ir_node ** refs;
refs = get_entity_reference_array(ent);
refs[pos] = n;
}
-
+#endif
/**------------------------------------------------------------------*/
/* Access routines for types */
set_type_alloc_array(tp, allocs);
}
+#if 0
void set_type_alloc(const ir_type *tp, int pos, ir_node *n)
{
ir_node **allocs;
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)
set_type_cast_array(tp, casts);
}
+#if 0
void set_type_cast(const ir_type *tp, int pos, ir_node *n)
{
ir_node **casts;
casts = get_type_cast_array(tp);
casts[pos] = n;
}
+#endif
/*------------------------------------------------------------------*/
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;
pts = get_type_pointertype_array(tp);
pts[pos] = ptp;
}
-
+#endif
/*------------------------------------------------------------------*/
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;
pts = get_type_arraytype_array(tp);
pts[pos] = atp;
}
+#endif
/*------------------------------------------------------------------*/
/* Building and Removing the out datastructure */
/**
* Emits code for a node.
*/
-void TEMPLATE_emit_node(const ir_node *node)
+static void TEMPLATE_emit_node(const ir_node *node)
{
ir_op *op = get_irn_op(node);
* Walks over the nodes in a block connected by scheduling edges
* and emits code for each node.
*/
-void TEMPLATE_gen_block(ir_node *block, void *data)
+static void TEMPLATE_gen_block(ir_node *block, void *data)
{
ir_node *node;
(void) data;
/**
* Emits code for function start.
*/
-void TEMPLATE_emit_func_prolog(ir_graph *irg)
+static void TEMPLATE_emit_func_prolog(ir_graph *irg)
{
const char *irg_name = get_entity_name(get_irg_entity(irg));
/**
* Emits code for function end
*/
-void TEMPLATE_emit_func_epilog(ir_graph *irg)
+static void TEMPLATE_emit_func_epilog(ir_graph *irg)
{
const char *irg_name = get_entity_name(get_irg_entity(irg));
/**
* Sets labels for control flow nodes (jump target)
- * TODO: Jump optimization
*/
-void TEMPLATE_gen_labels(ir_node *block, void *env)
+static void TEMPLATE_gen_labels(ir_node *block, void *env)
{
ir_node *pred;
int n = get_Block_n_cfgpreds(block);
/**
* Initializes the nodes attributes.
*/
-void init_TEMPLATE_attributes(ir_node *node, arch_irn_flags_t flags,
- const arch_register_req_t **in_reqs,
- const be_execution_unit_t ***execution_units,
- int n_res)
+static void init_TEMPLATE_attributes(ir_node *node, arch_irn_flags_t flags,
+ const arch_register_req_t **in_reqs,
+ const be_execution_unit_t ***execution_units,
+ int n_res)
{
ir_graph *irg = get_irn_irg(node);
struct obstack *obst = get_irg_obstack(irg);
* @param mode The mode in question.
* @return A register class which can hold values of the given mode.
*/
-const arch_register_class_t *TEMPLATE_get_reg_class_for_mode(const ir_mode *mode)
+static const arch_register_class_t *TEMPLATE_get_reg_class_for_mode(const ir_mode *mode)
{
if (mode_is_float(mode))
return &TEMPLATE_reg_classes[CLASS_TEMPLATE_fp];
* @param method_type The type of the method (procedure) in question.
* @param abi The abi object to be modified
*/
-void TEMPLATE_get_call_abi(const void *self, ir_type *method_type,
- be_abi_call_t *abi)
+static void TEMPLATE_get_call_abi(const void *self, ir_type *method_type,
+ be_abi_call_t *abi)
{
ir_type *tp;
ir_mode *mode;
}
}
-int TEMPLATE_to_appear_in_schedule(void *block_env, const ir_node *irn)
+static int TEMPLATE_to_appear_in_schedule(void *block_env, const ir_node *irn)
{
(void) block_env;
TEMPLATE_is_valid_clobber
};
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_TEMPLATE);
void be_init_arch_TEMPLATE(void)
{
be_register_isa_if("TEMPLATE", &TEMPLATE_isa_if);
FIRM_DBG_REGISTER(dbg, "firm.be.TEMPLATE.cg");
TEMPLATE_init_transform();
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_TEMPLATE);
arm_emit_fpa_postfix(mode);
}
-/**
- * Emit a const or SymConst value.
- */
-void arm_emit_immediate(const ir_node *node)
-{
- const arm_attr_t *attr = get_arm_attr_const(node);
-
- if (ARM_GET_FPA_IMM(attr)) {
- /* TODO */
- //be_emit_irprintf("#%s", arm_get_fpa_imm_name(get_arm_imm_value(node)));
- } else {
- assert(!"not a Constant");
- }
-}
-
void arm_emit_load_mode(const ir_node *node)
{
const arm_load_store_attr_t *attr = get_arm_load_store_attr_const(node);
arm_load_store_attr_t *get_arm_load_store_attr(ir_node *node);
const arm_load_store_attr_t *get_arm_load_store_attr_const(const ir_node *node);
+arm_shifter_operand_t *get_arm_shifter_operand_attr(ir_node *node);
+
/**
* Returns the argument register requirements of an arm node.
*/
* @param mode The mode in question.
* @return A register class which can hold values of the given mode.
*/
-const arch_register_class_t *arm_get_reg_class_for_mode(const ir_mode *mode)
+static const arch_register_class_t *arm_get_reg_class_for_mode(const ir_mode *mode)
{
if (mode_is_float(mode))
return &arm_reg_classes[CLASS_arm_fpa];
* @param method_type The type of the method (procedure) in question.
* @param abi The abi object to be modified
*/
-void arm_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *abi)
+static void arm_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *abi)
{
ir_type *tp;
ir_mode *mode;
}
}
-int arm_to_appear_in_schedule(void *block_env, const ir_node *irn)
+static int arm_to_appear_in_schedule(void *block_env, const ir_node *irn)
{
(void) block_env;
if (!is_arm_irn(irn))
arm_is_valid_clobber
};
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_arm);
void be_init_arch_arm(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
arm_init_transform();
arm_init_emitter();
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_arm);
#ifndef FIRM_BE_BE_DBGOUT_T_H
#define FIRM_BE_BE_DBGOUT_T_H
+#include "be_dbgout.h"
#include "obst.h"
#include "firm_types.h"
#include "be_types.h"
void (*main_program)(dbg_handle *handle);
/** dumps the stabs for a method begin */
- void (*method_begin)(dbg_handle *handle, ir_entity *ent, const be_stack_layout_t *layout);
+ void (*method_begin)(dbg_handle *handle, const ir_entity *ent, const be_stack_layout_t *layout);
/** dumps the stabs for a method end */
void (*method_end)(dbg_handle *handle);
void (*types)(dbg_handle *handle);
/** dump a variable in the global type */
- void (*variable)(dbg_handle *h, ir_entity *ent);
+ void (*variable)(dbg_handle *h, const ir_entity *ent);
/** notify debug info about position change */
void (*set_dbg_info)(dbg_handle *h, dbg_info *dbgi);
return abi->call->flags.bits.try_omit_fp;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_abi);
void be_init_abi(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.abi");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_abi);
* |_| |_|\__,_|_|_| |_|
*
*/
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_blocksched);
void be_init_blocksched(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
FIRM_DBG_REGISTER(dbg, "firm.be.blocksched");
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_blocksched);
-
ir_node **be_create_block_schedule(ir_graph *irg, ir_exec_freq *execfreqs)
{
switch (algo) {
del_pset(env.pre_colored);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal);
void be_init_chordal(void)
{
static be_ra_chordal_coloring_t coloring = {
be_register_chordal_coloring("default", &coloring);
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal);
* @date 08.12.2004
* @version $Id: bechordal.c 26750 2009-11-27 09:37:43Z bersch $
*/
-
#include "config.h"
+
+#include "bechordal_common.h"
+
#include "debug.h"
#include "iredges.h"
return perm;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal_common);
void be_init_chordal_common(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.chordal_common");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal_common);
rect->x, rect->y, rect->w, rect->h);
}
-void ps_text(plotter_t *_self, int x, int y, const char *str)
+static void ps_text(plotter_t *_self, int x, int y, const char *str)
{
decl_self(ps_plotter_t, _self);
be_add_module_to_list(&colorings, name, coloring);
}
-void be_ra_chordal_coloring(be_chordal_env_t *env)
+static void be_ra_chordal_coloring(be_chordal_env_t *env)
{
assert(selected_coloring != NULL);
if (selected_coloring != NULL) {
}
}
-
static void dump(unsigned mask, ir_graph *irg,
const arch_register_class_t *cls,
const char *suffix,
be_timer_pop(T_RA_OTHER);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal_main);
void be_init_chordal_main(void)
{
static be_ra_t be_ra_chordal_allocator = {
lc_opt_add_table(chordal_grp, be_chordal_options);
be_add_module_list_opt(chordal_grp, "coloring", "select coloring methode", &colorings, (void**) &selected_coloring);
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal_main);
return 0;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur);
void be_init_copyheur(void)
{
static co_algo_info copyheur = {
be_register_copyopt("heur1", ©heur);
FIRM_DBG_REGISTER(dbg, "ir.be.copyoptheur");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur);
return QSORT_CMP(c, d);
}
-int cmp_edges(const void *a, const void *b)
+static int cmp_edges(const void *a, const void *b)
{
const edge_t *p = a;
const edge_t *q = b;
return 0;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur2);
void be_init_copyheur2(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
lc_opt_add_table(co2_grp, options);
be_register_copyopt("heur2", ©heur);
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur2);
LC_OPT_LAST
};
-
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur4);
void be_init_copyheur4(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
FIRM_DBG_REGISTER(dbg, "firm.be.co.heur4");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur4);
LC_OPT_LAST
};
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyilp);
void be_init_copyilp(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
lc_opt_add_table(ilp_grp, options);
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyilp);
-
#include "becopyilp_t.h"
#include "beifg_t.h"
#endif
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyilp2);
void be_init_copyilp2(void)
{
static co_algo_info copyheur = {
be_register_copyopt("ilp", ©heur);
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyilp2);
-
int co_solve_ilp2(copy_opt_t *co)
{
lpp_sol_state_t sol_state;
be_add_module_to_list(©opts, name, copyopt);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyopt);
void be_init_copyopt(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
©opts, (void**) &selected_copyopt);
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyopt);
-
static int void_algo(copy_opt_t *co)
{
(void) co;
return 0;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copynone);
void be_init_copynone(void)
{
static co_algo_info copyheur = {
be_register_copyopt("none", ©heur);
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copynone);
-
#undef QUICK_AND_DIRTY_HACK
static int nodes_interfere(const be_chordal_env_t *env, const ir_node *a, const ir_node *b)
static ir_nodeset_t *all_phi_nodes;
static ir_nodeset_t *all_copy_nodes;
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copystat);
void be_init_copystat(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.copystat");
all_copy_nodes = ir_nodeset_new(64);
memset(curr_vals, 0, sizeof(curr_vals));
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copystat);
+BE_REGISTER_MODULE_DESTRUCTOR(be_quit_copystat);
void be_quit_copystat(void)
{
ir_nodeset_del(all_phi_nodes);
ir_nodeset_del(all_copy_nodes);
}
-BE_REGISTER_MODULE_DESTRUCTOR(be_quit_copystat);
/**
* @return 1 if the block at pos @p pos removed a critical edge
handle->ops->main_program(handle);
}
-void be_dbg_method_begin(ir_entity *ent, const be_stack_layout_t *layout)
+void be_dbg_method_begin(const ir_entity *ent, const be_stack_layout_t *layout)
{
if (handle->ops->method_begin)
handle->ops->method_begin(handle, ent, layout);
handle->ops->types(handle);
}
-void be_dbg_variable(ir_entity *ent)
+void be_dbg_variable(const ir_entity *ent)
{
if (handle->ops->variable)
handle->ops->variable(handle, ent);
return &null_handle;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_dbgout);
void be_init_dbgout(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
&dbgout_modules, (void**) &selected_dbgout_module);
be_register_dbgout_module("none", create_null_dbgout_module);
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_dbgout);
}
-int be_ifg_is_simplicial(const be_ifg_t *ifg, const ir_node *irn)
-{
- int degree = be_ifg_degree(ifg, irn);
- void *iter = be_ifg_neighbours_iter_alloca(ifg);
-
- ir_node **neighbours = XMALLOCN(ir_node*, degree);
-
- ir_node *curr;
- int i, j;
-
- i = 0;
- be_ifg_foreach_neighbour(ifg, iter, irn, curr)
- neighbours[i++] = curr;
-
- for (i = 0; i < degree; ++i) {
- for (j = 0; j < i; ++j)
- if (!be_ifg_connected(ifg, neighbours[i], neighbours[j])) {
- free(neighbours);
- return 0;
- }
- }
-
-
- free(neighbours);
- return 1;
-}
-
void be_ifg_check(const be_ifg_t *ifg)
{
void *iter1 = be_ifg_nodes_iter_alloca(ifg);
ir_printf("\n\nFound %d nodes in the 'check neighbour section'\n", neighbours_count);
}
-int be_ifg_check_get_node_count(const be_ifg_t *ifg)
+static int be_ifg_check_get_node_count(const be_ifg_t *ifg)
{
void *iter = be_ifg_nodes_iter_alloca(ifg);
int node_count = 0;
LC_OPT_LAST
};
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_ifg);
void be_init_ifg(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
lc_opt_add_table(ifg_grp, be_ifg_options);
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_ifg);
static FILE *be_ifg_open(const be_chordal_env_t *env, const char *prefix)
{
#include "be_t.h"
#include "beintlive_t.h"
#include "beifg_t.h"
+#include "beifg_impl.h"
#include "bechordal_t.h"
typedef struct _cli_head_t {
#include "irgraph_t.h"
#include "irgwalk.h"
+#include "beifg_impl.h"
#include "bearch.h"
#include "be_t.h"
#include "bera.h"
#include "beifg_t.h"
#include "bechordal_t.h"
-
typedef struct _adj_head_t adj_head_t;
typedef struct _ifg_list_t {
#include "be_t.h"
#include "bera.h"
#include "beifg_t.h"
+#include "beifg_impl.h"
#include "bechordal_t.h"
typedef struct _ptr_element_t ptr_element_t;
#include "belive_t.h"
#include "bera.h"
#include "beifg_t.h"
+#include "beifg_impl.h"
#include "bechordal_t.h"
#include "beirg.h"
#include "beintlive_t.h"
#include "beirg.h"
#include "bemachine.h"
#include "belistsched.h"
+#include "bemodule.h"
typedef struct _ilpsched_options_t {
unsigned regpress;
/**
* Register ILP scheduler options.
*/
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_ilpsched);
void be_init_ilpsched(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
return blocks_removed;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_irgmod);
void be_init_irgmod(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.irgmod");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_irgmod);
DEL_ARR_F(env.sched_info);
}
-/**
- * Register list scheduler options.
- */
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_listsched);
void be_init_listsched(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
FIRM_DBG_REGISTER(dbg, "firm.be.sched");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_listsched);
}
}
-int (be_lv_next_irn)(const struct _be_lv_t *lv, const ir_node *bl, unsigned flags, int i)
-{
- return _be_lv_next_irn(lv, bl, flags, i);
-}
-
-const ir_node * (be_lv_get_irn)(const struct _be_lv_t *lv, const ir_node *bl, int i)
-{
- return _be_lv_get_irn(lv, bl, i);
-}
-
int (be_is_live_in)(const be_lv_t *lv, const ir_node *block, const ir_node *irn)
{
return _be_is_live_xxx(lv, block, irn, be_lv_state_in);
obstack_free(&obst, NULL);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_live);
void be_init_live(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.liveness");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_live);
xfree(loop_ana);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_loopana);
void be_init_loopana(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.loopana");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_loopana);
/**
* Dump the names of all registered module options.
*/
-int dump_opt_module(char *buf, size_t buflen, const char *name,
- lc_opt_type_t type, void *data, size_t length)
+static int dump_opt_module(char *buf, size_t buflen, const char *name,
+ lc_opt_type_t type, void *data, size_t length)
{
module_opt_data_t *moddata = data;
const be_module_list_entry_t *module;
/**
* Dump the values of all register module options.
*/
-int dump_opt_module_vals(char *buf, size_t buflen, const char *name,
- lc_opt_type_t type, void *data, size_t len)
+static int dump_opt_module_vals(char *buf, size_t buflen, const char *name,
+ lc_opt_type_t type, void *data, size_t len)
{
module_opt_data_t *moddata = data;
char *p = buf;
* Currently you have to add modules manually in the list in bemodule.c.
* However future extensions might allow them to be automatically discovered
* when they are marked with BE_REGISTER_MODULE_CONSTRUCTOR
+ *
+ * Add this before your constructor as it will declare the function
*/
-#define BE_REGISTER_MODULE_CONSTRUCTOR(func)
+#define BE_REGISTER_MODULE_CONSTRUCTOR(func) void func(void);
/**
* Mark a function as module destructor.
+ *
+ * Add this before your constructor as it will declare the function
*/
-#define BE_REGISTER_MODULE_DESTRUCTOR(func)
+#define BE_REGISTER_MODULE_DESTRUCTOR(func) void func(void);
/**
* Call all module constructors
return proj;
}
-int be_has_frame_entity(const ir_node *irn)
+static bool be_has_frame_entity(const ir_node *irn)
{
switch (get_irn_opcode(irn)) {
case beo_Spill:
case beo_Reload:
case beo_FrameAddr:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
* Note: killing a node and rewiring os only allowed if new_node produces
* the same registers as old_node.
*/
-void be_peephole_before_exchange(const ir_node *old_node, ir_node *new_node)
+static void be_peephole_before_exchange(const ir_node *old_node,
+ ir_node *new_node)
{
const arch_register_t *reg;
const arch_register_class_t *cls;
irg_block_walk_graph(irg, process_block, NULL, NULL);
}
-void be_peephole_init(void)
-{
- clear_irp_opcodes_generic_func();
-}
-
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_peephole);
void be_init_peephole(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.peephole");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_peephole);
obstack_free(&obst, NULL);
}
-/**
- * Initializes this module.
- */
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_pref_alloc);
void be_init_pref_alloc(void)
{
static be_ra_t be_ra_pref = {
be_register_allocator("pref", &be_ra_pref);
FIRM_DBG_REGISTER(dbg, "firm.be.prefalloc");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_pref_alloc);
*/
#include "config.h"
+#include "bepressurestat.h"
+
#include <math.h>
#include "hashptr.h"
}
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_ra);
void be_init_ra(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
be_add_module_list_opt(be_grp, "regalloc", "register allocator",
®ister_allocators, (void**) &selected_allocator);
}
-BE_REGISTER_MODULE_CONSTRUCTOR(init_be_ra);
irg_block_walk_graph(irg, block_sched_dumper, NULL, f);
}
-/* Init the scheduling stuff. */
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched);
void be_init_sched(void)
{
sched_irn_data_offset = firm_register_additional_node_data(sizeof(sched_info_t));
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched);
-
void sched_renumber(const ir_node *block)
{
ir_node *irn;
void sched_add_after(ir_node *after, ir_node *irn);
void sched_init_block(ir_node *block);
void sched_reset(ir_node *node);
+int sched_comes_after(const ir_node *n1, const ir_node *n2);
void sched_remove(ir_node *irn);
#define sched_is_end(irn) is_Block(irn)
return inst;
}
-void normal_finish_graph(void *env)
+static void normal_finish_graph(void *env)
{
instance_t *inst = env;
*/
#include "config.h"
+#include "beschedrss.h"
+
#include <limits.h>
#include "obst.h"
phase_free(&rss->ph);
}
-/**
- * Register the options.
- */
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_schedrss);
void be_init_schedrss(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
lc_opt_add_table(rss_grp, rss_option_table);
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_schedrss);
-
/**
* Preprocess the irg for scheduling.
*/
selected_spiller->spill(birg, cls);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions);
void be_init_spilloptions(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
FIRM_DBG_REGISTER(dbg, "firm.be.spillprepare");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions);
return p->time - q->time;
}
-void workset_print(const workset_t *w)
-{
- int i;
-
- for (i = 0; i < w->len; ++i) {
- ir_fprintf(stderr, "%+F %d\n", w->vals[i].node, w->vals[i].time);
- }
-}
-
/**
* Alloc a new workset on obstack @p ob with maximum size @p max
*/
obstack_free(&obst, NULL);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady);
void be_init_spillbelady(void)
{
static be_spiller_t belady_spiller = {
be_register_spiller("belady", &belady_spiller);
FIRM_DBG_REGISTER(dbg, "firm.be.spill.belady");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady);
* @param birg The backend graph
* @param cls The register class to spill
*/
-void be_spill_belady(be_irg_t *birg, const arch_register_class_t *cls)
+static void be_spill_belady(be_irg_t *birg, const arch_register_class_t *cls)
{
ir_graph *irg = be_get_birg_irg(birg);
belady_env_t env;
obstack_free(&env.ob, NULL);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady2);
void be_init_spillbelady2(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
be_register_spiller("belady2", &belady_spiller);
FIRM_DBG_REGISTER(dbg, "firm.be.spill.belady2");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady2);
be_delete_spill_env(senv);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady3);
void be_init_spillbelady3(void)
{
static be_spiller_t belady3_spiller = {
be_register_spiller("belady3", &belady3_spiller);
FIRM_DBG_REGISTER(dbg, "firm.be.spill.belady3");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady3);
ir_nodeset_destroy(&live_nodes);
}
-void be_spill_daemel(be_irg_t *birg, const arch_register_class_t *new_cls)
+static void be_spill_daemel(be_irg_t *birg, const arch_register_class_t *new_cls)
{
ir_graph *irg = be_get_birg_irg(birg);
n_regs = new_cls->n_regs - be_put_ignore_regs(birg, new_cls, NULL);
spill_env = NULL;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_daemelspill);
void be_init_daemelspill(void)
{
static be_spiller_t daemel_spiller = {
be_register_spiller("daemel", &daemel_spiller);
FIRM_DBG_REGISTER(dbg, "firm.be.spilldaemel");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_daemelspill);
be_free_frame_entity_coalescer(env);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillslots);
void be_init_spillslots(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.spillslots");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillslots);
be_timer_pop(T_RA_SPILL_APPLY);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spill);
void be_init_spill(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.spill");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spill);
be_timer_pop(T_SSA_CONSTR);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_ssaconstr);
void be_init_ssaconstr(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.ssaconstr");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_ssaconstr);
*/
#include "config.h"
+#include "bessadestr.h"
+
#include "debug.h"
#include "set.h"
#include "pmap.h"
*/
typedef struct stabs_handle {
dbg_handle base; /**< the base class */
- ir_entity *cur_ent; /**< current method entity */
+ const ir_entity *cur_ent; /**< current method entity */
const be_stack_layout_t *layout; /**< current stack layout */
unsigned next_type_nr; /**< next type number */
pmap *type_map; /**< a map from type to type number */
/**
* print a pointer type
*/
-void print_pointer_type(stabs_handle *h, ir_type *tp, int local)
+static void print_pointer_type(stabs_handle *h, ir_type *tp, int local)
{
unsigned type_num = local ? h->next_type_nr++ : get_type_number(h, tp);
ir_type *el_tp = get_pointer_points_to_type(tp);
/**
* dump the stabs for a method begin
*/
-static void stabs_method_begin(dbg_handle *handle, ir_entity *ent, const be_stack_layout_t *layout)
+static void stabs_method_begin(dbg_handle *handle, const ir_entity *ent, const be_stack_layout_t *layout)
{
stabs_handle *h = (stabs_handle *)handle;
ir_type *mtp, *rtp;
static void stabs_method_end(dbg_handle *handle)
{
stabs_handle *h = (stabs_handle *)handle;
- ir_entity *ent = h->cur_ent;
+ const ir_entity *ent = h->cur_ent;
const be_stack_layout_t *layout = h->layout;
const char *ld_name = get_entity_ld_name(ent);
int i, n, frame_size;
/**
* dump a variable in the global type
*/
-static void stabs_variable(dbg_handle *handle, ir_entity *ent)
+static void stabs_variable(dbg_handle *handle, const ir_entity *ent)
{
stabs_handle *h = (stabs_handle *)handle;
unsigned tp_num = get_type_number(h, get_entity_type(ent));
};
/* Opens a stabs handler */
-dbg_handle *be_stabs_open(void)
+static dbg_handle *be_stabs_open(void)
{
stabs_handle *h = XMALLOCZ(stabs_handle);
return &h->base;
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_stabs);
void be_init_stabs(void)
{
be_register_dbgout_module("stabs", be_stabs_open);
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_stabs);
obstack_free(&env.obst, NULL);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_state);
void be_init_state(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.state");
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_state);
* @param mode The mode in question.
* @return A register class which can hold values of the given mode.
*/
-const arch_register_class_t *ia32_get_reg_class_for_mode(const ir_mode *mode)
+static const arch_register_class_t *ia32_get_reg_class_for_mode(const ir_mode *mode)
{
if (mode_is_float(mode)) {
return ia32_cg_config.use_sse2 ? &ia32_reg_classes[CLASS_ia32_xmm] : &ia32_reg_classes[CLASS_ia32_vfp];
}
}
-int ia32_to_appear_in_schedule(void *block_env, const ir_node *irn)
+static int ia32_to_appear_in_schedule(void *block_env, const ir_node *irn)
{
(void) block_env;
ia32_is_valid_clobber
};
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_ia32);
void be_init_arch_ia32(void)
{
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
ia32_init_x87();
ia32_init_architecture();
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_ia32);
***************************************************************************************/
/* default compare operation to compare attributes */
-int ia32_compare_attr(const ia32_attr_t *a, const ia32_attr_t *b)
+static int ia32_compare_attr(const ia32_attr_t *a, const ia32_attr_t *b)
{
if (a->data.tp != b->data.tp)
return 1;
ia32_immediate_attr_t *get_ia32_immediate_attr(ir_node *node);
const ia32_immediate_attr_t *get_ia32_immediate_attr_const(const ir_node *node);
+const ia32_asm_attr_t *get_ia32_asm_attr_const(const ir_node *node);
+
/**
* Gets the condcode attributes of a node.
*/
* @param mode The mode in question.
* @return A register class which can hold values of the given mode.
*/
-const arch_register_class_t *mips_get_reg_class_for_mode(const ir_mode *mode)
+static const arch_register_class_t *mips_get_reg_class_for_mode(const ir_mode *mode)
{
(void) mode;
ASSERT_NO_FLOAT(mode);
mips_is_valid_clobber
};
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_mips);
void be_init_arch_mips(void)
{
be_register_isa_if("mips", &mips_isa_if);
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_mips);
#include "mips_new_nodes.h"
#include "mips_map_regs.h"
-DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
-
#define SNPRINTF_BUF_LEN 128
/**
* Walks over the nodes in a block connected by scheduling edges
* and emits code for each node.
*/
-void mips_gen_block(const ir_node *block)
+static void mips_gen_block(const ir_node *block)
{
ir_node *node;
/**
* Emits code for function start.
*/
-void mips_emit_func_prolog(ir_graph *irg)
+static void mips_emit_func_prolog(ir_graph *irg)
{
ident *irg_ident = get_entity_ld_ident(get_irg_entity(irg));
/**
* Emits code for function end
*/
-void mips_emit_func_epilog(ir_graph *irg)
+static void mips_emit_func_epilog(ir_graph *irg)
{
ident *irg_ident = get_entity_ident(get_irg_entity(irg));
/**
* Sets labels for control flow nodes (jump target)
*/
-void mips_gen_labels(ir_node *block, void *env)
+static void mips_gen_labels(ir_node *block, void *env)
{
ir_node *pred;
int n = get_Block_n_cfgpreds(block);
mips_emit_func_epilog(irg);
}
-
-void mips_init_emitter(void)
-{
- FIRM_DBG_REGISTER(dbg, "firm.be.mips.emitter");
-}
* @param mode The mode in question.
* @return A register class which can hold values of the given mode.
*/
-const arch_register_class_t *ppc32_get_reg_class_for_mode(const ir_mode *mode)
+static const arch_register_class_t *ppc32_get_reg_class_for_mode(const ir_mode *mode)
{
if (mode_is_float(mode))
return &ppc32_reg_classes[CLASS_ppc32_fp];
}
}
-int ppc32_to_appear_in_schedule(void *block_env, const ir_node *irn)
+static int ppc32_to_appear_in_schedule(void *block_env, const ir_node *irn)
{
(void) block_env;
if (!is_ppc32_irn(irn))
ppc32_is_valid_clobber
};
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_ppc32);
void be_init_arch_ppc32(void)
{
be_register_isa_if("ppc32", &ppc32_isa_if);
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_ppc32);
* Sets labels for control flow nodes (jump target)
* TODO: Jump optimization
*/
-void ppc32_gen_labels(ir_node *block, void *env)
+static void ppc32_gen_labels(ir_node *block, void *env)
{
ir_node *pred;
int n;
}
-int is_ppc32_Load(const ir_node *n)
+static int is_ppc32_Load(const ir_node *n)
{
ir_op *op = get_irn_op(n);
if (op == op_ppc32_Lbz) return 1;
return 0;
}
-int is_ppc32_Store(const ir_node *n)
+static int is_ppc32_Store(const ir_node *n)
{
ir_op *op = get_irn_op(n);
if (op == op_ppc32_Stb) return 1;
/**
* Initializes ppc specific node attributes
*/
-void init_ppc32_attributes(ir_node *node, int flags,
- const arch_register_req_t **in_reqs,
- const be_execution_unit_t ***execution_units,
- int n_res)
+static void init_ppc32_attributes(ir_node *node, int flags,
+ const arch_register_req_t **in_reqs,
+ const be_execution_unit_t ***execution_units,
+ int n_res)
{
ir_graph *irg = get_irn_irg(node);
struct obstack *obst = get_irg_obstack(irg);
/**
* Returns a singleton condition mode
*/
-ir_mode *get_ppc32_mode_Cond(void)
+static ir_mode *get_ppc32_mode_Cond(void)
{
if (ppc32_mode_Cond)
return ppc32_mode_Cond;
* Returns true, if the given node is a Const node and it's value fits into
* a signed 16-bit variable
*/
-int is_16bit_signed_const(ir_node *node)
+static int is_16bit_signed_const(ir_node *node)
{
tarval *tv_const;
* Returns true, if the given node is a Const node and it's value fits into
* a unsigned 16-bit variable
*/
-int is_16bit_unsigned_const(ir_node *node)
+static int is_16bit_unsigned_const(ir_node *node)
{
tarval *tv_const;
panic("Mode for Conv not supported: %F -> %F", from_mode, to_mode);
}
-int search_from_node_in_block(ir_node *from, ir_node *to)
+static int search_from_node_in_block(ir_node *from, ir_node *to)
{
int n = get_irn_arity(from), i;
for (i=0;i<n;i++)
return 0;
}
-int nodes_dependency_order(ir_node **a, ir_node **b)
+static int nodes_dependency_order(ir_node **a, ir_node **b)
{
if (search_from_node_in_block(*a,*b)) return 1;
if (search_from_node_in_block(*b,*a)) return -1;
return 0;
}
-void finalize_block(ppc32_code_gen_t *cgenv)
+static void finalize_block(ppc32_code_gen_t *cgenv)
{
int i;
ir_node *current_conv;
}
}
-void init_block(void)
+static void init_block(void)
{
cw_block_attr *attr = XMALLOC(cw_block_attr);
attr->first_conv = NULL;
print OUT @obst_enum_op;
print OUT <<EOF;
int is_${arch}_irn(const ir_node *node);
+int is_${arch}_op(const ir_op *op);
int get_${arch}_opcode_first(void);
int get_${arch}_opcode_last(void);
* @param mode The mode in question.
* @return A register class which can hold values of the given mode.
*/
-const arch_register_class_t *sparc_get_reg_class_for_mode(const ir_mode *mode)
+static const arch_register_class_t *sparc_get_reg_class_for_mode(const ir_mode *mode)
{
if (mode_is_float(mode))
return &sparc_reg_classes[CLASS_sparc_fp];
* @param method_type The type of the method (procedure) in question.
* @param abi The abi object to be modified
*/
-void sparc_get_call_abi(const void *self, ir_type *method_type,
- be_abi_call_t *abi)
+static void sparc_get_call_abi(const void *self, ir_type *method_type,
+ be_abi_call_t *abi)
{
ir_type *tp;
ir_mode *mode;
}
}
-int sparc_to_appear_in_schedule(void *block_env, const ir_node *irn)
+static int sparc_to_appear_in_schedule(void *block_env, const ir_node *irn)
{
(void) block_env;
sparc_is_valid_clobber
};
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_sparc);
void be_init_arch_sparc(void)
{
be_register_isa_if("sparc", &sparc_isa_if);
sparc_init_transform();
sparc_init_emitter();
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_sparc);
/**
* Emits code for a node.
*/
-void sparc_emit_node(const ir_node *node)
+static void sparc_emit_node(const ir_node *node)
{
ir_op *op = get_irn_op(node);
* Walks over the nodes in a block connected by scheduling edges
* and emits code for each node.
*/
-void sparc_gen_block(ir_node *block, void *data)
+static void sparc_gen_block(ir_node *block, void *data)
{
ir_node *node;
(void) data;
/**
* Emits code for function start.
*/
-void sparc_emit_func_prolog(ir_graph *irg)
+static void sparc_emit_func_prolog(ir_graph *irg)
{
ir_entity *ent = get_irg_entity(irg);
/**
* Emits code for function end
*/
-void sparc_emit_func_epilog(ir_graph *irg)
+static void sparc_emit_func_epilog(ir_graph *irg)
{
ir_entity *ent = get_irg_entity(irg);
const char *irg_name = get_entity_ld_name(ent);
* TODO: Sets labels for control flow nodes (jump target).
* Links control predecessors to there destination blocks.
*/
-void sparc_gen_labels(ir_node *block, void *env)
+static void sparc_gen_labels(ir_node *block, void *env)
{
ir_node *pred;
int n = get_Block_n_cfgpreds(block);
/**
* Initializes the nodes attributes.
*/
-void init_sparc_attributes(ir_node *node, arch_irn_flags_t flags,
- const arch_register_req_t **in_reqs,
- const be_execution_unit_t ***execution_units,
- int n_res)
+static void init_sparc_attributes(ir_node *node, arch_irn_flags_t flags,
+ const arch_register_req_t **in_reqs,
+ const be_execution_unit_t ***execution_units,
+ int n_res)
{
ir_graph *irg = get_irn_irg(node);
struct obstack *obst = get_irg_obstack(irg);
#include "ident_t.h"
#include "firm.h"
#include "irflag_t.h"
-/* init functions are not public */
#include "tv_t.h"
#include "tpop_t.h"
#include "irprog_t.h"
#include "opt_init.h"
#include "debugger.h"
#include "be_t.h"
+#include "irtools.h"
/* returns the firm root */
lc_opt_entry_t *firm_opt_get_root(void)
arch_dep_init(arch_dep_default_factory);
arch_dep_set_opts(0);
+ init_irnode();
+
#ifdef DEBUG_libfirm
/* integrated debugger extension */
firm_init_debugger();
#include <windows.h>
#endif
+#include "debugger.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
static const char firm_debug_info_string[] =
API_VERSION(FIRM_DBG_MAJOR, FIRM_DBG_MINOR);
-/**
- * Returns non-zero, if the debug extension is active
- */
int firm_debug_active(void)
{
return is_active;
firm_dbg_msg_buf[0] = '\0';
} /* reset_dbg_buf */
-/**
- * Add text to the debug text buffer.
- */
static void add_to_dbg_buf(const char *buf)
{
strncat(firm_dbg_msg_buf, buf, sizeof(firm_dbg_msg_buf));
} /* add_to_dbg_buf */
-/**
- * Return the content of the debug text buffer.
- *
- * To be called from the debugger.
- */
const char *firm_debug_text(void)
{
firm_dbg_msg_buf[sizeof(firm_dbg_msg_buf) - 1] = '\0';
return c;
} /* get_token */
-/**
- * High level function to use from debugger interface
- *
- * See show_commands() for supported commands.
- */
void firm_debug(const char *cmd)
{
char name[1024], fname[1024];
;
} /* firm_debug */
-/* creates the debugger tables */
void firm_init_debugger(void)
{
char *env;
return buf;
}
-/**
- * A gdb helper function to print tarvals.
- */
const char *gdb_tarval_helper(void *tv_object)
{
static char buf[1024];
#ifndef FIRM_DEBUG_DEBUGGER_H
#define FIRM_DEBUG_DEBUGGER_H
+#include "firm_types.h"
+
/** Break into the debugger. */
void firm_debug_break(void);
/** Creates the debugger tables. */
void firm_init_debugger(void);
+/**
+ * @defgroup external_debug helper functions for debuggers
+ *
+ * @{
+ */
+
+/**
+ * Returns non-zero, if the debug extension is active
+ */
+int firm_debug_active(void);
+
+/**
+ * Return the content of the debug text buffer.
+ *
+ * To be called from the debugger.
+ */
+const char *firm_debug_text(void);
+
+/**
+ * A gdb helper function to print tarvals.
+ */
+const char *gdb_tarval_helper(void *tv_object);
+
+/**
+ * A gdb helper to print all (new-style-) out edges of a node
+ */
+const char *gdb_out_edge_helper(const ir_node *node);
+
+/**
+ * High level function to use from debugger interface
+ *
+ * See show_commands() for supported commands.
+ */
+void firm_debug(const char *cmd);
+
+/**
+ * @}
+ */
+
#endif
/**
* Default implementation using libfirm sets.
*/
-void set_finish_ident(void *handle)
+static void set_finish_ident(void *handle)
{
set *id_set = handle;
*/
#include "config.h"
-#include "bitset.h"
+#include "irargs_t.h"
#include <ctype.h>
+#include "bitset.h"
#include "lc_printf.h"
#include "firm_common.h"
#include "irnode_t.h"
irg->current_block->attr.block.graph_arr[pos + 1] = value;
} /* set_value */
-/* Find the value number for a node in the current block.*/
-int find_value(ir_node *value)
-{
- int i;
- ir_node *bl = current_ir_graph->current_block;
-
- for (i = ARR_LEN(bl->attr.block.graph_arr) - 1; i >= 1; --i)
- if (bl->attr.block.graph_arr[i] == value)
- return i - 1;
- return -1;
-} /* find_value */
-
/* get the current store */
ir_node *get_store(void)
{
}
-void dump_entity_node(FILE *F, ir_entity *ent)
+static void dump_entity_node(FILE *F, ir_entity *ent)
{
fprintf(F, "node: {title: \"");
PRINT_ENTID(ent); fprintf(F, "\"");
* packed together in one subgraph/box *
*--------------------------------------------------------------------------------*/
-void dump_loops_standalone(FILE *F, ir_loop *loop)
+static void dump_loops_standalone(FILE *F, ir_loop *loop)
{
int i = 0, loop_node_started = 0, son_number = 0, first = 0;
loop_element le;
/* Dumps the firm nodes in the loop tree to a graph along with the loop nodes.*/
/*----------------------------------------------------------------------------*/
-void collect_nodeloop(FILE *F, ir_loop *loop, eset *loopnodes)
+static void collect_nodeloop(FILE *F, ir_loop *loop, eset *loopnodes)
{
int i, son_number = 0, node_number = 0;
}
}
-void collect_nodeloop_external_nodes(ir_loop *loop, eset *loopnodes, eset *extnodes)
+static void collect_nodeloop_external_nodes(ir_loop *loop, eset *loopnodes,
+ eset *extnodes)
{
int i, j, start;
fprintf(F, " hidden_user");
}
-void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix, unsigned verbosity)
+static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix,
+ unsigned verbosity)
{
int i, j;
ir_type *owner, *type;
}
}
-void dump_entity_to_file (FILE *F, ir_entity *ent, unsigned verbosity)
+void dump_entity_to_file (FILE *F, ir_entity *ent, unsigned verbosity)
{
dump_entity_to_file_prefix (F, ent, "", verbosity);
fprintf(F, "\n");
#define SetRangeEmpty(ptr,size) memset(ptr, 0, (size) * sizeof((ptr)[0]))
#define hashset_init ir_edgeset_init
+void ir_edgeset_init_size(ir_edgeset_t *self, size_t size);
#define hashset_init_size ir_edgeset_init_size
#define hashset_destroy ir_edgeset_destroy
#define hashset_insert ir_edgeset_insert
#define hashset_remove ir_edgeset_remove
+ir_edge_t *ir_edgeset_find(const ir_edgeset_t *self, const ir_edge_t*);
#define hashset_find ir_edgeset_find
+size_t ir_edgeset_size(const ir_edgeset_t *self);
#define hashset_size ir_edgeset_size
#define hashset_iterator_init ir_edgeset_iterator_init
#define hashset_iterator_next ir_edgeset_iterator_next
assert(err == 0);
}
-#ifdef DEBUG_libfirm
-/**
- * Helper function to dump the edge set of a graph,
- * unused in normal code.
- */
void edges_dump_kind(ir_graph *irg, ir_edge_kind_t kind)
{
irg_edge_info_t *info;
ir_printf("%+F %d %d\n", e->src, e->pos, e->invalid);
}
}
-#endif
/* The edge from (src, pos) -> old_tgt is redirected to tgt */
void edges_notify_edge_kind(ir_node *src, int pos, ir_node *tgt,
return _get_irn_n_edges_kind(irn, kind);
}
-void dump_all_out_edges(ir_node *irn)
-{
- int i;
- for (i = 0; i < EDGE_KIND_LAST; ++i) {
- const ir_edge_t *edge;
-
- printf("kind \"%s\"\n", get_kind_str(i));
- foreach_out_edge_kind(irn, edge, i) {
- ir_printf("\t%+F(%d)\n", edge->src, edge->pos);
- }
- }
-}
-
static void irg_block_edges_walk2(ir_node *bl, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
void edges_invalidate_all(ir_node *irn, ir_graph *irg);
+/**
+ * Helper function to dump the edge set of a graph,
+ * unused in normal code.
+ */
+void edges_dump_kind(ir_graph *irg, ir_edge_kind_t kind);
+
#define get_irn_n_edges_kind(irn, kind) _get_irn_n_edges_kind(irn, kind)
#define get_edge_src_irn(edge) _get_edge_src_irn(edge)
#define get_edge_src_pos(edge) _get_edge_src_pos(edge)
/* verbose is always off on default */
optimization_state_t libFIRM_verb = 0;
+/* silence warnings */
+void set_opt_optimize(int value);
+int get_opt_optimize(void);
+
/* an external flag can be set and get from outside */
#define E_FLAG(name, value, def) \
void set_opt_##name(int flag) { \
/* for compatibility reasons */
void set_optimize(int value)
{
- if (value) libFIRM_opt |= irf_optimize;
- else libFIRM_opt &= ~irf_optimize;
+ set_opt_optimize(value);
}
int (get_optimize)(void)
I_FLAG(fragile_ops , 16, OFF)
/** Optimize cast nodes. */
-E_FLAG(optimize_class_casts , 21, ON)
E_FLAG(suppress_downcast_optimization , 22, OFF)
/** Not really an optimization, removes Confirm nodes. */
#define get_optimize() _get_optimize()
#define get_opt_cse() _get_opt_cse()
#define get_opt_dyn_meth_dispatch() _get_opt_dyn_meth_dispatch()
-#define get_opt_optimize_class_casts() _get_opt_optimize_class_casts()
#define get_opt_suppress_downcast_optimization() _get_opt_suppress_downcast_optimization()
#endif
return irg->n_loc - 1;
}
-void set_irg_n_loc(ir_graph *irg, int n_loc)
-{
- if (get_opt_precise_exc_context())
- irg->n_loc = n_loc + 1 + 1;
- else
- irg->n_loc = n_loc + 1;
-}
-
-
-
/* Returns the obstack associated with the graph. */
struct obstack *
(get_irg_obstack)(const ir_graph *irg) {
/**
* Traverse a block in post order.
*/
-void traverse_block_post(ir_node *block, block_entry_t *entry, irg_walk_func *post, void *env)
+static void traverse_block_post(ir_node *block, block_entry_t *entry,
+ irg_walk_func *post, void *env)
{
int j, n;
#define hashset_init ir_lnk_nodemap_init
#define hashset_init_size ir_lnk_nodemap_init_size
#define hashset_destroy ir_lnk_nodemap_destroy
-#define hashset_insert _ir_lnk_nodemap_insert
+ir_lnk_nodemap_entry_t *ir_lnk_nodemap_insert_(ir_lnk_nodemap_t *self, ir_node *node);
+#define hashset_insert ir_lnk_nodemap_insert_
#define hashset_remove ir_lnk_nodemap_remove
-#define hashset_find _ir_lnk_nodemap_find
+ir_lnk_nodemap_entry_t *ir_lnk_nodemap_find_(const ir_lnk_nodemap_t *self,
+ const ir_node *node);
+#define hashset_find ir_lnk_nodemap_find_
#define hashset_size ir_lnk_nodemap_size
#define ADDITIONAL_INIT INIT_LIST_HEAD(&self->elem_list); INIT_LIST_HEAD(&self->all_iters);
int ir_lnk_nodemap_put(ir_lnk_nodemap_t *nodemap, ir_node *node, void *data)
{
- ir_lnk_nodemap_entry_t *entry = _ir_lnk_nodemap_insert(nodemap, node);
+ ir_lnk_nodemap_entry_t *entry = ir_lnk_nodemap_insert_(nodemap, node);
entry->data = data;
if (entry->list.next == NULL) {
void *ir_lnk_nodemap_get(const ir_lnk_nodemap_t *nodemap, const ir_node *node)
{
- ir_lnk_nodemap_entry_t *entry = _ir_lnk_nodemap_find(nodemap, node);
+ ir_lnk_nodemap_entry_t *entry = ir_lnk_nodemap_find_(nodemap, node);
return entry->data;
}
#define hashset_init ir_lnk_nodeset_init
#define hashset_init_size ir_lnk_nodeset_init_size
#define hashset_destroy ir_lnk_nodeset_destroy
-#define hashset_insert _ir_lnk_nodeset_insert
+ir_lnk_nodeset_entry_t *ir_lnk_nodeset_insert_(ir_lnk_nodeset_t *nodeset, ir_node *node);
+#define hashset_insert ir_lnk_nodeset_insert_
#define hashset_remove ir_lnk_nodeset_remove
-#define hashset_find _ir_lnk_nodeset_find
+ir_lnk_nodeset_entry_t *ir_lnk_nodeset_find_(const ir_lnk_nodeset_t *nodeset, const ir_node *node);
+#define hashset_find ir_lnk_nodeset_find_
#define hashset_size ir_lnk_nodeset_size
#define ADDITIONAL_INIT INIT_LIST_HEAD(&self->elem_list); INIT_LIST_HEAD(&self->all_iters);
/* Inserts a node into a linked nodeset. */
int ir_lnk_nodeset_insert(ir_lnk_nodeset_t *nodeset, ir_node *node)
{
- ir_lnk_nodeset_entry_t *entry = _ir_lnk_nodeset_insert(nodeset, node);
+ ir_lnk_nodeset_entry_t *entry = ir_lnk_nodeset_insert_(nodeset, node);
if (entry->list.next == NULL) {
/* we have added a new element */
int ir_lnk_nodeset_contains(const ir_lnk_nodeset_t *nodeset, const ir_node *node)
{
- return _ir_lnk_nodeset_find(nodeset, node) != NULL;
+ return ir_lnk_nodeset_find_(nodeset, node) != NULL;
}
/**
#include "irtools.h"
#include "array.h"
#include "error.h"
+#include "pattern_dmp.h"
/** Obstack to hold all modes. */
static struct obstack modes;
return _Block_block_visited(node);
}
-ir_node *get_Block_graph_arr(ir_node *node, int pos)
-{
- assert(is_Block(node));
- return node->attr.block.graph_arr[pos+1];
-}
-
-void set_Block_graph_arr(ir_node *node, int pos, ir_node *value)
-{
- assert(is_Block(node));
- node->attr.block.graph_arr[pos+1] = value;
-}
-
#ifdef INTERPROCEDURAL_VIEW
void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[])
{
return get_irn_n(node, 0);
}
-void set_Builin_mem(ir_node *node, ir_node *mem)
+void set_Builtin_mem(ir_node *node, ir_node *mem)
{
assert(is_Builtin(node));
set_irn_n(node, 0, mem);
}
}
-void skip_Id_and_store(ir_node **node)
-{
- ir_node *n = *node;
-
- if (!n || (n->op != op_Id)) return;
-
- /* Don't use get_Id_pred(): We get into an endless loop for
- self-referencing Ids. */
- *node = skip_Id(n);
-}
-
int (is_strictConv)(const ir_node *node)
{
return _is_strictConv(node);
return pn_Start_T_args == get_Proj_proj(node) && is_Start(get_Proj_pred(node));
}
+/** initialize ir_node module */
+void init_irnode(void);
/* this section MUST contain all inline functions */
#define is_ir_node(thing) _is_ir_node(thing)
#define EntryIsEmpty(value) ((value).node == NULL)
#define EntryIsDeleted(value) ((value).node == (ir_node*)-1)
-#define hashset_init _ir_nodemap_init
+void ir_nodemap_init_(ir_nodemap_t *self);
+#define hashset_init ir_nodemap_init_
#define hashset_init_size ir_nodemap_init_size
#define hashset_destroy ir_nodemap_destroy
-#define hashset_insert _ir_nodemap_insert
+ir_nodemap_entry_t *ir_nodemap_insert_(ir_nodemap_t *self, ir_node *node);
+#define hashset_insert ir_nodemap_insert_
#define hashset_remove ir_nodemap_remove
-#define hashset_find _ir_nodemap_find
+ir_nodemap_entry_t *ir_nodemap_find_(const ir_nodemap_t *self,
+ const ir_node *node);
+#define hashset_find ir_nodemap_find_
#define hashset_size ir_nodemap_size
#define hashset_iterator_init ir_nodemap_iterator_init
#define hashset_iterator_next ir_nodemap_iterator_next
void *ir_nodemap_get(const ir_nodemap_t *self, const ir_node *node)
{
- ir_nodemap_entry_t *entry = _ir_nodemap_find(self, node);
+ ir_nodemap_entry_t *entry = ir_nodemap_find_(self, node);
return entry->data;
}
void ir_nodemap_insert(ir_nodemap_t *self, ir_node *node, void *data)
{
- ir_nodemap_entry_t *entry = _ir_nodemap_insert(self, node);
+ ir_nodemap_entry_t *entry = ir_nodemap_insert_(self, node);
entry->data = data;
}
#define KeysEqual(this,key1,key2) (key1) == (key2)
#define SetRangeEmpty(ptr,size) memset(ptr, 0, (size) * sizeof((ptr)[0]))
-#define hashset_init _ir_nodeset_init
+void ir_nodeset_init_(ir_nodeset_t *self);
+#define hashset_init ir_nodeset_init_
#define hashset_init_size ir_nodeset_init_size
#define hashset_destroy ir_nodeset_destroy
#define hashset_insert ir_nodeset_insert
#define hashset_remove ir_nodeset_remove
-#define hashset_find _ir_nodeset_find
+#define hashset_find ir_nodeset_contains
#define hashset_size ir_nodeset_size
#define hashset_iterator_init ir_nodeset_iterator_init
#define hashset_iterator_next ir_nodeset_iterator_next
{
ir_nodeset_init_size(nodeset, 16);
}
-
-int ir_nodeset_contains(const ir_nodeset_t *nodeset, const ir_node *node)
-{
- return _ir_nodeset_find(nodeset, node);
-}
/**
* Create a suffix for dumping.
*/
-void create_suffix(char *suffix, size_t n, const char *pass_name, unsigned index)
+static void create_suffix(char *suffix, size_t n, const char *pass_name,
+ unsigned index)
{
snprintf(suffix, n, "-%02u_%s", index, pass_name);
}
#define hashset_init ir_valueset_init
#define hashset_init_size ir_valueset_init_size
#define hashset_destroy ir_valueset_destroy
-#define hashset_insert _ir_valueset_insert
+ir_valueset_entry_t *ir_valueset_insert_(ir_valueset_t *self, ir_node *value);
+#define hashset_insert ir_valueset_insert_
#define hashset_remove ir_valueset_remove
-#define hashset_find _ir_valueset_find
+ir_valueset_entry_t *ir_valueset_find_(const ir_valueset_t *self,
+ const ir_node *value);
+#define hashset_find ir_valueset_find_
#define hashset_size ir_valueset_size
#define ADDITIONAL_INIT INIT_LIST_HEAD(&self->elem_list); INIT_LIST_HEAD(&self->all_iters);
int ir_valueset_insert(ir_valueset_t *valueset, ir_node *value, ir_node *expr)
{
- ir_valueset_entry_t *entry = _ir_valueset_insert(valueset, value);
+ ir_valueset_entry_t *entry = ir_valueset_insert_(valueset, value);
if (entry->list.next != NULL) {
/* this value is already inserted, do nothing */
int ir_valueset_replace(ir_valueset_t *valueset, ir_node *value, ir_node *expr)
{
int res = 0;
- ir_valueset_entry_t *entry = _ir_valueset_insert(valueset, value);
+ ir_valueset_entry_t *entry = ir_valueset_insert_(valueset, value);
if (entry->expr != expr) {
entry->expr = expr;
void *ir_valueset_lookup(const ir_valueset_t *valueset, const ir_node *value)
{
- ir_valueset_entry_t *entry = _ir_valueset_find(valueset, value);
+ ir_valueset_entry_t *entry = ir_valueset_find_(valueset, value);
if (entry != NULL)
return entry->expr;
return NULL;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#include <stdio.h>
#include "lc_parser_t.h"
#include "lc_config_parser.h"
-static int _lc_opt_wrap(void)
-{
- return 1;
-}
+static int _lc_opt_wrap(void);
-#line 540 "lc_config_lexer.c"
+#line 545 "lc_config_lexer.c"
#define INITIAL 0
#define LINE_COMMENT 1
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO fwrite( _lc_opt_text, _lc_opt_leng, 1, _lc_opt_out )
+#define ECHO do { if (fwrite( _lc_opt_text, _lc_opt_leng, 1, _lc_opt_out )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
errno=0; \
while ( (result = fread(buf, 1, max_size, _lc_opt_in))==0 && ferror(_lc_opt_in)) \
{ \
- if ( errno != EINTR) \
+ if( errno != EINTR) \
{ \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
break; \
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 55 "lc_config_lexer.l"
+#line 52 "lc_config_lexer.l"
-#line 730 "lc_config_lexer.c"
+#line 740 "lc_config_lexer.c"
if ( !(yy_init) )
{
case 1:
YY_RULE_SETUP
-#line 57 "lc_config_lexer.l"
+#line 54 "lc_config_lexer.l"
{ BEGIN(BIG_COMMENT); }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 58 "lc_config_lexer.l"
+#line 55 "lc_config_lexer.l"
{ BEGIN(INITIAL); }
YY_BREAK
case 3:
/* rule 3 can match eol */
YY_RULE_SETUP
-#line 59 "lc_config_lexer.l"
+#line 56 "lc_config_lexer.l"
PMANGLE(linenr)++;
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 60 "lc_config_lexer.l"
+#line 57 "lc_config_lexer.l"
;
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 62 "lc_config_lexer.l"
+#line 59 "lc_config_lexer.l"
{ BEGIN(LINE_COMMENT); }
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
-#line 63 "lc_config_lexer.l"
+#line 60 "lc_config_lexer.l"
{ BEGIN(INITIAL); PMANGLE(linenr)++; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 64 "lc_config_lexer.l"
+#line 61 "lc_config_lexer.l"
;
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 67 "lc_config_lexer.l"
+#line 64 "lc_config_lexer.l"
{ BEGIN(DAT); }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 68 "lc_config_lexer.l"
+#line 65 "lc_config_lexer.l"
{ BEGIN(STR); }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 69 "lc_config_lexer.l"
+#line 66 "lc_config_lexer.l"
{ BEGIN(DAT_CONT); }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 70 "lc_config_lexer.l"
+#line 67 "lc_config_lexer.l"
{ _lc_opt_add_to_data_char(PMANGLE(text)[0]); }
YY_BREAK
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
-#line 71 "lc_config_lexer.l"
+#line 68 "lc_config_lexer.l"
{
BEGIN(INITIAL);
PMANGLE(linenr)++;
case 13:
/* rule 13 can match eol */
YY_RULE_SETUP
-#line 77 "lc_config_lexer.l"
+#line 74 "lc_config_lexer.l"
{ BEGIN(DAT); PMANGLE(linenr)++; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 78 "lc_config_lexer.l"
+#line 75 "lc_config_lexer.l"
;
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 81 "lc_config_lexer.l"
+#line 78 "lc_config_lexer.l"
{
BEGIN(INITIAL);
_lc_opt_add_to_data_char('\0');
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 87 "lc_config_lexer.l"
+#line 84 "lc_config_lexer.l"
_lc_opt_add_to_data_char('\n');
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 88 "lc_config_lexer.l"
+#line 85 "lc_config_lexer.l"
_lc_opt_add_to_data_char('\r');
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 89 "lc_config_lexer.l"
+#line 86 "lc_config_lexer.l"
_lc_opt_add_to_data_char('\t');
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 90 "lc_config_lexer.l"
+#line 87 "lc_config_lexer.l"
_lc_opt_add_to_data_char('\b');
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 91 "lc_config_lexer.l"
+#line 88 "lc_config_lexer.l"
_lc_opt_add_to_data_char('\f');
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 92 "lc_config_lexer.l"
+#line 89 "lc_config_lexer.l"
_lc_opt_add_to_data_char(_lc_opt_text[1]);
YY_BREAK
case 22:
/* rule 22 can match eol */
YY_RULE_SETUP
-#line 93 "lc_config_lexer.l"
+#line 90 "lc_config_lexer.l"
_lc_opt_add_to_data_char(_lc_opt_text[0]);
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 95 "lc_config_lexer.l"
+#line 92 "lc_config_lexer.l"
{
PMANGLE(lval).text.str = PMANGLE(text);
PMANGLE(lval).text.len = PMANGLE(leng);
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 100 "lc_config_lexer.l"
+#line 97 "lc_config_lexer.l"
{ return SEP; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 102 "lc_config_lexer.l"
+#line 99 "lc_config_lexer.l"
;
YY_BREAK
case 26:
/* rule 26 can match eol */
YY_RULE_SETUP
-#line 103 "lc_config_lexer.l"
+#line 100 "lc_config_lexer.l"
PMANGLE(linenr)++;
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 105 "lc_config_lexer.l"
+#line 102 "lc_config_lexer.l"
return _lc_opt_text[0];
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 107 "lc_config_lexer.l"
+#line 104 "lc_config_lexer.l"
ECHO;
YY_BREAK
-#line 972 "lc_config_lexer.c"
+#line 982 "lc_config_lexer.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(LINE_COMMENT):
case YY_STATE_EOF(BIG_COMMENT):
/** Setup the input buffer state to scan the given bytes. The next call to _lc_opt_lex() will
* scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
{
/* Pop the buffer stack, destroying each element. */
- while (YY_CURRENT_BUFFER){
+ while(YY_CURRENT_BUFFER){
_lc_opt__delete_buffer(YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
_lc_opt_pop_buffer_state();
#define YYTABLES_NAME "yytables"
-#line 107 "lc_config_lexer.l"
+#line 104 "lc_config_lexer.l"
+
+
+
+static int _lc_opt_wrap(void)
+{
+ /* avoid warning */
+ (void) yyunput;
+ (void) input;
+ return 1;
+}
#include "lc_parser_t.h"
#include "lc_config_parser.h"
-static int _lc_opt_wrap(void)
-{
- return 1;
-}
+static int _lc_opt_wrap(void);
%}
. return yytext[0];
%%
+
+static int _lc_opt_wrap(void)
+{
+ /* avoid warning */
+ (void) yyunput;
+ (void) input;
+ return 1;
+}
-/* A Bison parser, made by GNU Bison 2.3. */
+
+/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 0
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
/* Using locations. */
#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
-#define yyparse _lc_opt_parse
-#define yylex _lc_opt_lex
-#define yyerror _lc_opt_error
-#define yylval _lc_opt_lval
-#define yychar _lc_opt_char
-#define yydebug _lc_opt_debug
-#define yynerrs _lc_opt_nerrs
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- SEP = 258,
- DATA = 259,
- IDENT = 260
- };
-#endif
-/* Tokens. */
-#define SEP 258
-#define DATA 259
-#define IDENT 260
-
-
+#define yyparse _lc_opt_parse
+#define yylex _lc_opt_lex
+#define yyerror _lc_opt_error
+#define yylval _lc_opt_lval
+#define yychar _lc_opt_char
+#define yydebug _lc_opt_debug
+#define yynerrs _lc_opt_nerrs
/* Copy the first part of user declarations. */
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#include <string.h>
+
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
# define YYTOKEN_TABLE 0
#endif
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ SEP = 258,
+ DATA = 259,
+ IDENT = 260
+ };
+#endif
+
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-
{
+
+
text_t text;
int num;
-}
-/* Line 187 of yacc.c. */
- YYSTYPE;
+
+
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
-
/* Copy the second part of user declarations. */
-/* Line 216 of yacc.c. */
-
#ifdef short
# undef short
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-static int YYID(int i)
+static int
+YYID (int yyi)
#else
-static int YYID(i)
- int i;
+static int
+YYID (yyi)
+ int yyi;
#endif
{
- return i;
+ return yyi;
}
#endif
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- };
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
static const char *const yytname[] =
{
"$end", "error", "$undefined", "SEP", "DATA", "IDENT", "'{'", "'}'",
- "$accept", "main", "decl", "decls", "dseq", "group", "@1", "option",
+ "$accept", "main", "decl", "decls", "dseq", "group", "$@1", "option",
"path", 0
};
#endif
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-static void yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
-static void yy_symbol_value_print(yyoutput, yytype, yyvaluep)
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-static void yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
-static void yy_symbol_print(yyoutput, yytype, yyvaluep)
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-static void yy_stack_print(yytype_int16 *bottom, yytype_int16 *top)
+static void
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
-static void yy_stack_print(bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
+static void
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-static void yy_reduce_print(YYSTYPE *yyvsp, int yyrule)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
#else
-static void yy_reduce_print(yyvsp, yyrule)
+static void
+yy_reduce_print (yyvsp, yyrule)
YYSTYPE *yyvsp;
int yyrule;
#endif
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
- fprintf (stderr, " $%d = ", yyi + 1);
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
- fprintf (stderr, "\n");
+ YYFPRINTF (stderr, "\n");
}
}
/* Return the length of YYSTR. */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-static YYSIZE_T yystrlen(const char *yystr)
+static YYSIZE_T
+yystrlen (const char *yystr)
#else
-static YYSIZE_T yystrlen(yystr)
+static YYSIZE_T
+yystrlen (yystr)
const char *yystr;
#endif
{
YYDEST. */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-static char *yystpcpy(char *yydest, const char *yysrc)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
#else
-static char *yystpcpy(yydest, yysrc)
+static char *
+yystpcpy (yydest, yysrc)
char *yydest;
const char *yysrc;
#endif
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
-static YYSIZE_T yytnamerr(char *yyres, const char *yystr)
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
copied. As a special case, return 0 if an ordinary "syntax error"
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
size calculation. */
-static YYSIZE_T yysyntax_error(char *yyresult, int yystate, int yychar)
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
{
int yyn = yypact[yystate];
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
#else
-static void yydestruct(yymsg, yytype, yyvaluep)
+static void
+yydestruct (yymsg, yytype, yyvaluep)
const char *yymsg;
int yytype;
YYSTYPE *yyvaluep;
break;
}
}
-\f
/* Prevent warnings from -Wmissing-prototypes. */
-
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#endif /* ! YYPARSE_PARAM */
-
-/* The look-ahead symbol. */
+/* The lookahead symbol. */
int yychar;
-/* The semantic value of the look-ahead symbol. */
+/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
/* Number of syntax errors so far. */
-/*----------.
-| yyparse. |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-int yyparse (void *YYPARSE_PARAM)
+int
+yyparse (void *YYPARSE_PARAM)
#else
-int yyparse (YYPARSE_PARAM)
+int
+yyparse (YYPARSE_PARAM)
void *YYPARSE_PARAM;
#endif
#else /* ! YYPARSE_PARAM */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
-int yyparse (void)
+int
+yyparse (void)
#else
-int yyparse ()
+int
+yyparse ()
#endif
#endif
{
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- YYSIZE_T yystacksize = YYINITDEPTH;
+ YYSIZE_T yystacksize;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
+ yytoken = 0;
+ yyss = yyssa;
+ yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
+
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
-
yyssp = yyss;
yyvsp = yyvs;
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
-
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
-
&yystacksize);
yyss = yyss1;
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
-
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
yybackup:
/* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to look-ahead token. */
+ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
- /* Not known => get a look-ahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
- /* Shift the look-ahead token. */
+ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
break;
-/* Line 1267 of yacc.c. */
default: break;
}
*++yyvsp = yyval;
-
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse look-ahead token after an
+ /* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
}
}
- /* Else will try to reuse look-ahead token after shifting the error
+ /* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
*++yyvsp = yylval;
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
#endif
yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
+ if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
/* Do not reclaim the symbols of the rule which action triggered
-/* A Bison parser, made by GNU Bison 2.3. */
+
+/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton interface for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
IDENT = 260
};
#endif
-/* Tokens. */
-#define SEP 258
-#define DATA 259
-#define IDENT 260
-
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-
{
+
+
text_t text;
int num;
-}
-/* Line 1489 of yacc.c. */
- YYSTYPE;
+
+
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE _lc_opt_lval;
return buf;
}
-char *lc_opt_values_to_string(char *buf, size_t len, const lc_opt_entry_t *ent)
+static char *lc_opt_values_to_string(char *buf, size_t len, const lc_opt_entry_t *ent)
{
const lc_opt_special_t *s = lc_get_opt_special(ent);
if (s->dump_vals)
+++ /dev/null
-/*
- libcore: library for basic data structures and algorithms.
- Copyright (C) 2005 IPD Goos, Universit"at Karlsruhe, Germany
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include "config.h"
-
-#include <ctype.h>
-#include "lc_opts_t.h"
-
-int lc_opt_type_scan(void *dest, lc_opt_type_t type, const char *str)
-{
- static const char *fmts[] = {
- "", "%s", "%i", "%f"
- };
-
- static const struct {
- const char *str;
- int val;
- } bool_vals[] = {
- { "true", 1 },
- { "on", 1 },
- { "yes", 1 },
- { "false", 0 },
- { "no", 0 },
- { "off", 0 }
- };
-
- int res = 0;
-
- switch (type) {
- case lc_opt_type_int:
- case lc_opt_type_double:
- case lc_opt_type_string:
- res = sscanf(str, fmts[type], dest);
- break;
- case lc_opt_type_boolean:
- {
- size_t i, n;
- int *data = dest;
- char buf[10];
-
- strncpy(buf, str, sizeof(buf));
- for (i = 0, n = strlen(buf); i < n; ++i)
- buf[i] = tolower(buf[i]);
-
- for (i = 0; i < LC_ARRSIZE(bool_vals); ++i) {
- if (strcmp(buf, bool_vals[i].str) == 0) {
- res = 1;
- *data = bool_vals[i].val;
- break;
- }
- }
- }
- break;
- default:
- break;
- }
-
- return res;
-}
-
-int lc_opt_type_print(char *buf, size_t n, lc_opt_type_t type, void *data)
-{
- int res = 0;
-
- switch (type) {
- case lc_opt_type_int:
- {
- int i = *((int *) data);
- res = snprintf(buf, n, "%d", i);
- }
- break;
- case lc_opt_type_double:
- {
- double d = *((double *) data);
- res = snprintf(buf, n, "%f", d);
- }
- break;
- case lc_opt_type_string:
- res = snprintf(buf, n, "%s", (const char*) data);
- break;
- case lc_opt_type_boolean:
- res = snprintf(buf, n, "%s", *((int *) data) ? "yes" : "no");
- break;
- default:
- res = 0;
- }
-
- return res;
-}
#include "irnode_t.h"
#include "irouts.h"
#include "irpass_t.h"
+#include "lowering.h"
#define foreach_out_irn(irn, i, outirn) for (i = get_irn_n_outs(irn) - 1;\
i >= 0 && (outirn = get_irn_out(irn, i)); --i)
*/
#include "config.h"
+#include "iroptimize.h"
#include "adt/pdeq.h"
#include "irnode_t.h"
#include "irouts.h"
*/
#include "config.h"
+#include "iroptimize.h"
#include "irflag.h"
#include "irdom.h"
#include "irouts.h"
*/
#include "config.h"
+#include "iroptimize.h"
+#include "opt_init.h"
#include "irnode.h"
#include "debug.h"
#include "irouts.h"
#include "iredges.h"
#include "irtools.h"
-#include "array_t.h" /* automatic array */
-#include "beutil.h" /* get_block */
-#include "irloop_t.h" /* set_irn_loop*/
+#include "array_t.h"
+#include "beutil.h"
+#include "irloop_t.h"
#include "irpass.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg);
}
/* Returns the number of blocks in a loop. */
-int get_loop_n_blocks(ir_loop *loop)
+static int get_loop_n_blocks(ir_loop *loop)
{
int elements, e;
int blocks = 0;
/**
* Construct SSA for all definitions in arr.
*/
-void construct_ssa_foreach(ir_node **arr, int arr_n)
+static void construct_ssa_foreach(ir_node **arr, int arr_n)
{
int i;
for (i = 0; i < arr_n ; ++i) {
}
/* Loop peeling */
-void loop_peeling(void)
+static void loop_peeling(void)
{
cur_loop_outs = NEW_ARR_F(out_edge, 0);
irg_walk_graph( current_ir_graph, get_loop_outs, NULL, NULL );
}
/* Loop inversion */
-void loop_inversion(void)
+static void loop_inversion(void)
{
unsigned do_inversion = 1;
* Returns last element of linked list of copies by
* walking the linked list.
*/
-ir_node *get_last_copy(ir_node *node)
+static ir_node *get_last_copy(ir_node *node)
{
ir_node *copy, *cur;
cur = node;
/**
* Rewire floating copies of the current loop.
*/
-void unrolling_fix_cf(void)
+static void unrolling_fix_cf(void)
{
ir_node *loophead = loop_cf_head;
int headarity = get_irn_arity(loophead);
* Loop unrolling
* Could be improved with variable range informations.
*/
-void loop_unrolling(void)
+static void loop_unrolling(void)
{
int i, j;
* Two block are congruent, if they contains only equal calculations.
*/
#include "config.h"
-#include "ircons.h"
+
#include "iroptimize.h"
+#include "ircons.h"
#include "irgmod.h"
#include "irgraph_t.h"
#include "irnode_t.h"
* @param part the partition
* @param env the environment
*/
-void propagate_blocks_live_troughs(partition_t *part, environment_t *env)
+static void propagate_blocks_live_troughs(partition_t *part, environment_t *env)
{
const ir_node *meet_block = part->meet_block;
block_t *bl, *next;
*
* @param env the environment
*/
-void propagate_live_troughs(environment_t *env)
+static void propagate_live_troughs(environment_t *env)
{
partition_t *part, *next;
*/
#include "config.h"
+#include "opt_polymorphy.h"
#include "iroptimize.h"
#include "irprog_t.h"
#include "entity_t.h"
*
* The default implementation hecks for Alloc nodes only.
*/
-ir_type *default_firm_get_Alloc(ir_node *n)
+static ir_type *default_firm_get_Alloc(ir_node *n)
{
n = skip_Proj(n);
if (is_Alloc(n)) {
*/
#include "config.h"
+#include "iroptimize.h"
#include "iropt_t.h"
#include "irnode_t.h"
#include "irgraph_t.h"
#include <stdlib.h>
#include <limits.h>
+#include "pattern.h"
#include "ident.h"
#include "irnode_t.h"
#include "irgwalk.h"
#ifndef FIRM_STAT_PATTERN_H
#define FIRM_STAT_PATTERN_H
+#include "firm_types.h"
+
/**
* Calculates the pattern history.
*