From d382d46d40faa79f071cf3eebd74fc47ad22b196 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 17 Nov 2005 17:44:42 +0000 Subject: [PATCH] removed bool type and depency from stdbool.h (not C89) [r6931] --- ir/ana/rta.c | 7 +-- ir/ir/irdump.c | 115 +++++++++++++++++++--------------------- ir/ir/irdump.h | 42 +++++++-------- ir/ir/irdump_t.h | 4 +- ir/ir/irgopt.c | 16 +++--- ir/ir/irgwalk.c | 6 +-- ir/ir/irnode.c | 12 ++--- ir/ir/irnode.h | 6 +-- ir/ir/irprog.c | 12 ++--- ir/ir/irreflect.c | 34 +++++++----- ir/ir/irreflect.h | 42 +++++++-------- ir/ir/pseudo_irg.c | 6 +-- ir/ir/pseudo_irg.h | 2 +- ir/opt/loop_unrolling.c | 2 +- ir/tr/entity.c | 25 +++++---- ir/tr/entity.h | 4 +- ir/tr/tr_inheritance.c | 18 ++++--- ir/tr/trvrfy.c | 18 +++---- ir/tr/type.h | 2 - 19 files changed, 190 insertions(+), 183 deletions(-) diff --git a/ir/ana/rta.c b/ir/ana/rta.c index eb613f34f..64a1d20ae 100644 --- a/ir/ana/rta.c +++ b/ir/ana/rta.c @@ -222,8 +222,6 @@ static int rta_fill_graph (ir_graph* graph) } /** Traverse all graphs to collect method accesses and object allocations. - * - * @param rerun Whether to rely on is_alive in a second run */ static int rta_fill_incremental (void) { @@ -232,7 +230,7 @@ static int rta_fill_incremental (void) int rerun = TRUE; int old_ip_view = get_interprocedural_view(); - set_interprocedural_view(false); /* save this for later */ + set_interprocedural_view(0); /* save this for later */ /* init_tables has added main_irg to _live_graphs */ @@ -535,6 +533,9 @@ void rta_report (void) /* * $Log$ + * Revision 1.33 2005/11/17 17:26:57 beck + * removed bool type and depency from stdbool.h (not C89) + * * Revision 1.32 2005/01/05 14:24:52 beck * renames all is_x*_type() functions to is_X*_type() to prevent name clash with EDG frontend * diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index 507e74818..ee5223917 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -86,8 +86,8 @@ int dump_dominator_information_flag = 0; int dump_loop_information_flag = 0; int dump_backedge_information_flag = 1; int dump_const_local = 0; -bool opt_dump_analysed_type_info = 1; -bool opt_dump_pointer_values_to_info = 0; /* default off: for test compares!! */ +int opt_dump_analysed_type_info = 1; +int opt_dump_pointer_values_to_info = 0; /* default off: for test compares!! */ static dumper_colors overrule_nodecolor = ird_color_default; @@ -96,12 +96,12 @@ static DUMP_NODE_EDGE_FUNC dump_node_edge_hook = NULL; void set_dump_node_edge_hook(DUMP_NODE_EDGE_FUNC func) { - dump_node_edge_hook = func; + dump_node_edge_hook = func; } DUMP_NODE_EDGE_FUNC get_dump_node_edge_hook(void) { - return dump_node_edge_hook; + return dump_node_edge_hook; } @@ -125,11 +125,11 @@ void set_dump_edge_vcgattr_hook(DUMP_EDGE_VCGATTR_FUNC hook) { dump_edge_vcgattr_hook = hook; } -INLINE bool get_opt_dump_const_local(void) { +INLINE int get_opt_dump_const_local(void) { if (!dump_out_edge_flag && !dump_loop_information_flag) return dump_const_local; else - return false; + return 0; } void only_dump_method_with_name(ident *name) { @@ -140,7 +140,7 @@ ident *get_dump_file_filter_ident(void) { return dump_file_filter_id; } -/** Returns true if dump file filter is not set, or if it is a +/** Returns non-zero if dump file filter is not set, or if it is a * prefix of name. */ int is_filtered_dump_name(ident *name) { if (!dump_file_filter_id) return 1; @@ -153,52 +153,52 @@ void turn_off_edge_labels(void) { edge_label = 0; } -void dump_consts_local(bool b) { - dump_const_local = b; +void dump_consts_local(int flag) { + dump_const_local = flag; } -void dump_constant_entity_values(bool b) { - const_entities = b; +void dump_constant_entity_values(int flag) { + const_entities = flag; } -void dump_keepalive_edges(bool b) { - dump_keepalive = b; +void dump_keepalive_edges(int flag) { + dump_keepalive = flag; } -bool get_opt_dump_keepalive_edges(void) { +int get_opt_dump_keepalive_edges(void) { return dump_keepalive; } -void dump_out_edges(bool b) { - dump_out_edge_flag = b; +void dump_out_edges(int flag) { + dump_out_edge_flag = flag; } -void dump_dominator_information(bool b) { - dump_dominator_information_flag = b; +void dump_dominator_information(int flag) { + dump_dominator_information_flag = flag; } -void dump_loop_information(bool b) { - dump_loop_information_flag = b; +void dump_loop_information(int flag) { + dump_loop_information_flag = flag; } -void dump_backedge_information(bool b) { - dump_backedge_information_flag = b; +void dump_backedge_information(int flag) { + dump_backedge_information_flag = flag; } /* Dump the information of type field specified in ana/irtypeinfo.h. * If the flag is set, the type name is output in [] in the node label, * else it is output as info. */ -void set_opt_dump_analysed_type_info(bool b) { - opt_dump_analysed_type_info = b; +void set_opt_dump_analysed_type_info(int flag) { + opt_dump_analysed_type_info = flag; } -void dump_pointer_values_to_info(bool b) { - opt_dump_pointer_values_to_info = b; +void dump_pointer_values_to_info(int flag) { + opt_dump_pointer_values_to_info = flag; } -void dump_ld_names(bool b) { - dump_ld_name = b; +void dump_ld_names(int flag) { + dump_ld_name = flag; } /* -------------- some extended helper functions ----------------- */ @@ -543,7 +543,7 @@ static ir_node **construct_block_lists(ir_graph *irg) { irg_walk_graph(current_ir_graph, clear_link, collect_node, current_ir_graph); /* Collect also EndReg and EndExcept. We do not want to change the walker. */ - set_interprocedural_view(false); + set_interprocedural_view(0); set_irg_visited(current_ir_graph, get_irg_visited(current_ir_graph)-1); irg_walk(get_irg_end_reg(current_ir_graph), clear_link, collect_node, current_ir_graph); @@ -893,7 +893,7 @@ dump_node_nodeattr(FILE *F, ir_node *n) switch (get_irn_opcode(n)) { case iro_Start: - if (false && get_interprocedural_view()) { + if (0 && get_interprocedural_view()) { fprintf (F, "%s ", get_ent_dump_name(get_irg_entity(current_ir_graph))); } break; @@ -1069,7 +1069,7 @@ static INLINE int dump_node_info(FILE *F, ir_node *n) * checks whether a node is "constant-like" ie can be treated "block-less" */ static INLINE -bool is_constlike_node(ir_node *n) { +int is_constlike_node(ir_node *n) { ir_op *op = get_irn_op(n); return (op == op_Const || op == op_Bad || op == op_NoMem || op == op_SymConst || op == op_Unknown); } @@ -1133,16 +1133,16 @@ static void dump_const_block_local(FILE *F, ir_node *n) { PRINT_NODEID(n); fprintf (F, "\" targetname: \""); PRINT_CONSTBLKID(n,blk); - if (dump_edge_vcgattr_hook) { - fprintf (F, "\" "); + if (dump_edge_vcgattr_hook) { + fprintf (F, "\" "); if (dump_edge_vcgattr_hook(F, n, -1)) { fprintf (F, "}\n"); return; } - else { + else { fprintf (F, " " BLOCK_EDGE_ATTR "}\n"); - return; - } + return; + } } fprintf (F, "\" " BLOCK_EDGE_ATTR "}\n"); @@ -1224,16 +1224,16 @@ dump_ir_block_edge(FILE *F, ir_node *n) { fprintf (F, "\" targetname: "); fprintf(F, "\""); PRINT_NODEID(block); fprintf(F, "\""); - if (dump_edge_vcgattr_hook) { - fprintf (F, " "); + if (dump_edge_vcgattr_hook) { + fprintf (F, " "); if (dump_edge_vcgattr_hook(F, n, -1)) { fprintf (F, "}\n"); return; } - else { + else { fprintf (F, " " BLOCK_EDGE_ATTR "}\n"); - return; - } + return; + } } fprintf (F, " " BLOCK_EDGE_ATTR "}\n"); @@ -1243,10 +1243,10 @@ dump_ir_block_edge(FILE *F, ir_node *n) { static void print_data_edge_vcgattr(FILE *F, ir_node *from, int to) { - /* - * do not use get_nodes_block() here, will fail - * if the irg is not pinned. - */ + /* + * do not use get_nodes_block() here, will fail + * if the irg is not pinned. + */ if (get_irn_n(from, -1) == get_irn_n(get_irn_n(from, to), -1)) fprintf (F, INTRA_DATA_EDGE_ATTR); else @@ -1255,10 +1255,10 @@ print_data_edge_vcgattr(FILE *F, ir_node *from, int to) { static void print_mem_edge_vcgattr(FILE *F, ir_node *from, int to) { - /* - * do not use get_nodes_block() here, will fail - * if the irg is not pinned. - */ + /* + * do not use get_nodes_block() here, will fail + * if the irg is not pinned. + */ if (get_irn_n(from, -1) == get_irn_n(get_irn_n(from, to), -1)) fprintf (F, INTRA_MEM_EDGE_ATTR); else @@ -1270,8 +1270,8 @@ print_edge_vcgattr(FILE *F, ir_node *from, int to) { assert(from); if (dump_edge_vcgattr_hook) - if (dump_edge_vcgattr_hook(F, from, to)) - return; + if (dump_edge_vcgattr_hook(F, from, to)) + return; if (dump_backedge_information_flag && is_backedge(from, to)) fprintf (F, BACK_EDGE_ATTR); @@ -2603,7 +2603,7 @@ dump_cfg (ir_graph *irg, const char *suffix) if (ipv) { printf("Warning: dumping cfg not in interprocedural view!\n"); - set_interprocedural_view(false); + set_interprocedural_view(0); } if (get_irg_dom_state(irg) != dom_consistent) @@ -2734,7 +2734,7 @@ void dump_all_cg_block_graph(const char *suffix) { FILE *f; int i; int rem_view = get_interprocedural_view(); - set_interprocedural_view(true); + set_interprocedural_view(1); f = vcg_open_name("All_graphs", suffix); dump_vcg_header(f, "All_graphs", NULL); @@ -2799,17 +2799,14 @@ dump_all_types (const char *suffix) } void -dump_class_hierarchy (bool entities, const char *suffix) +dump_class_hierarchy (int entities, const char *suffix) { FILE *f = vcg_open_name("class_hierarchy", suffix); h_env_t env; - env.f = f; + env.f = f; + env.dump_ent = entities; dump_vcg_header(f, "class_hierarchy", NULL); - if (entities) - env.dump_ent = 1; - else - env.dump_ent = 0; type_walk(dump_class_hierarchy_node, NULL, &env); vcg_close(f); } diff --git a/ir/ir/irdump.h b/ir/ir/irdump.h index 3d8c7a265..e1c111753 100644 --- a/ir/ir/irdump.h +++ b/ir/ir/irdump.h @@ -383,7 +383,7 @@ void dump_all_types (const char *suffix); * is dumped along with the entities. * Dumps to a file class_hierarchy.vcg */ -void dump_class_hierarchy (bool entities, const char *suffix); +void dump_class_hierarchy (int entities, const char *suffix); /* **************************************************************************** */ /* LOOPTREE DUMPERS */ @@ -461,12 +461,12 @@ void dump_graph_as_text(ir_graph *irg, const char *suffix); /** Verbosity for text dumpers */ typedef enum { dump_verbosity_onlynames = 0x00000001, /**< only dump names. turns off all other - flags up to 0x00010000. */ + flags up to 0x00010000. */ dump_verbosity_fields = 0x00000002, /**< dump types and fields (like a type declaration) */ dump_verbosity_methods = 0x00000004, /**< dump types and methods (like a type declaration) */ dump_verbosity_nostatic = 0x00000040, /**< dump types and dynamic allocated fields (like a - type declaration). This excludes methods and - static, polymorphic fields. */ + type declaration). This excludes methods and + static, polymorphic fields. */ dump_verbosity_typeattrs = 0x00000008, /**< dump all type attributes */ dump_verbosity_entattrs = 0x00000010, /**< dump all entity attributes */ dump_verbosity_entconsts = 0x00000020, /**< dump entity constants */ @@ -493,9 +493,9 @@ typedef enum { dump_verbosity_onlyEnumerationTypes=0x0007F000, /**< dump only enumeration types */ dump_verbosity_max = 0x4FF00FBE /**< turn on all verbosity. - Do not turn on negative flags! - @@@ Because of a bug in gcc 3.2 we can not set the - first two bits. */ + Do not turn on negative flags! + @@@ Because of a bug in gcc 3.2 we can not set the + first two bits. */ } dump_verbosity; @@ -573,75 +573,75 @@ int is_filtered_dump_name(ident *name); void turn_off_edge_labels(void); /** - * If set to true constants will be replicated for every use. In non + * If set to non-zero constants will be replicated for every use. In non * blocked view edges from constant to block are skipped. Vcg then * layouts the graphs more compact, this makes them better readable. * The flag is automatically and temporarily set to false if other * edges are dumped, as outs, loop, ... * Default setting: false. */ -void dump_consts_local(bool b); +void dump_consts_local(int flag); /** - * Returns false if dump_out_edge_flag or dump_loop_information_flag + * Returns 0 if dump_out_edge_flag or dump_loop_information_flag * are set, else returns dump_const_local_flag. */ -bool get_opt_dump_const_local(void); +int get_opt_dump_const_local(void); /** Turns off dumping the values of constant entities. Makes type graphs * better readable. */ -void dump_constant_entity_values(bool b); +void dump_constant_entity_values(int flag); /** Turns on dumping the edges from the End node to nodes to be kept * alive. */ -void dump_keepalive_edges(bool b); -bool get_opt_dump_keepalive_edges(void); +void dump_keepalive_edges(int flag); +int get_opt_dump_keepalive_edges(void); /** Turns on dumping the out edges starting from the Start block in * dump_ir_graph. * * To test the consistency of the out data structure. */ -void dump_out_edges(bool b); +void dump_out_edges(int flag); /** If this flag is set the dumper dumps edges to immediate dominator in cfg. */ -void dump_dominator_information(bool b); +void dump_dominator_information(int flag); /** If this flag is set the dumper dumps loop nodes and edges from * these nodes to the contained ir nodes. * * If the loops are interprocedural nodes can be missing. */ -void dump_loop_information(bool b); +void dump_loop_information(int flag); /** If set and backedge info is computed, backedges are dumped dashed * and as vcg 'backedge' construct. * * Default: set. */ -void dump_backedge_information(bool b); +void dump_backedge_information(int flag); /** Dump the information of type field specified in ana/irtypeinfo.h. * * If the flag is set, the type name is output in [] in the node label, * else it is output as info. */ -void set_opt_dump_analysed_type_info(bool b); +void set_opt_dump_analysed_type_info(int flag); /** Write the address of a node into the vcg info. * * This is off per default for automatic comparisons of * vcg graphs -- these will differ in the pointer values! */ -void dump_pointer_values_to_info(bool b); +void dump_pointer_values_to_info(int flag); /** Dumps ld_names of entities instead of there names. * * This option is on per default. */ -void dump_ld_names(bool b); +void dump_ld_names(int flag); # endif /* _IRDUMP_H_ */ diff --git a/ir/ir/irdump_t.h b/ir/ir/irdump_t.h index ea3e2fec7..b63ac79d0 100644 --- a/ir/ir/irdump_t.h +++ b/ir/ir/irdump_t.h @@ -58,8 +58,8 @@ #define PRINT_EXTBBID(X) fprintf(F, "x%ld", get_irn_node_nr(X)) extern int dump_dominator_information_flag; -extern bool opt_dump_pointer_values_to_info; -extern bool opt_dump_analysed_type_info; +extern int opt_dump_pointer_values_to_info; +extern int opt_dump_analysed_type_info; FILE *vcg_open (ir_graph *irg, const char * suffix1, const char *suffix2); FILE *vcg_open_name (const char *name, const char *suffix); diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index a4f76515a..d16b62f60 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -519,7 +519,7 @@ dead_node_elimination(ir_graph *irg) { struct obstack *graveyard_obst = NULL; struct obstack *rebirth_obst = NULL; - edges_init_graph(irg); + edges_init_graph(irg); /* inform statistics that we started a dead-node elimination run */ hook_dead_node_elim(irg, 1); @@ -527,7 +527,7 @@ dead_node_elimination(ir_graph *irg) { /* Remember external state of current_ir_graph. */ rem = current_ir_graph; current_ir_graph = irg; - set_interprocedural_view(false); + set_interprocedural_view(0); /* Handle graph state */ assert(get_irg_phase_state(current_ir_graph) != phase_building); @@ -603,9 +603,9 @@ static void relink_bad_block_predecessors(ir_node *n, void *env) { for (i = 0; i < old_irn_arity; i++) { irn = get_irn_n(n, i); if (!is_Bad(irn)) { - new_in[new_irn_n] = irn; - is_backedge(n, i) ? set_backedge(n, new_irn_n-1) : set_not_backedge(n, new_irn_n-1); - new_irn_n++; + new_in[new_irn_n] = irn; + is_backedge(n, i) ? set_backedge(n, new_irn_n-1) : set_not_backedge(n, new_irn_n-1); + ++new_irn_n; } } //ARR_SETLEN(int, n->attr.block.backedge, new_irn_arity); @@ -650,9 +650,9 @@ static void relink_bad_predecessors(ir_node *n, void *env) { new_irn_arity = 1; for(i = 1; i < old_irn_arity; i++) if (!is_Bad((ir_node *)old_in[i])) { - n->in[new_irn_arity] = n->in[i]; - is_backedge(n, i) ? set_backedge(n, new_irn_arity) : set_not_backedge(n, new_irn_arity); - new_irn_arity++; + n->in[new_irn_arity] = n->in[i]; + is_backedge(n, i) ? set_backedge(n, new_irn_arity) : set_not_backedge(n, new_irn_arity); + ++new_irn_arity; } ARR_SETLEN(ir_node *, n->in, new_irn_arity); diff --git a/ir/ir/irgwalk.c b/ir/ir/irgwalk.c index 1cead63dd..c4016f929 100644 --- a/ir/ir/irgwalk.c +++ b/ir/ir/irgwalk.c @@ -246,10 +246,10 @@ void irg_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void *env) ir_graph * irg; assert(get_irp_ip_view_state() == ip_view_valid); - set_interprocedural_view(false); + set_interprocedural_view(0); eset_insert(irg_set, current_ir_graph); irg_walk(node, (irg_walk_func *) collect_irgs, NULL, irg_set); - set_interprocedural_view(true); + set_interprocedural_view(1); visited = get_max_irg_visited() + 1; for (irg = eset_first(irg_set); irg; irg = eset_next(irg_set)) { set_irg_visited(irg, visited); @@ -351,7 +351,7 @@ void cg_walk(irg_walk_func *pre, irg_walk_func *post, void *env) { ir_graph *rem = current_ir_graph; int rem_view = get_interprocedural_view(); - set_interprocedural_view(true); + set_interprocedural_view(1); inc_max_irg_visited(); /* Fix all irg_visited flags */ diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 753bb6d99..9c2b87258 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -642,14 +642,14 @@ ir_node * return _get_Block_cfgpred_block(node, pos); } -bool +int get_Block_matured (ir_node *node) { assert (node->op == op_Block); - return node->attr.block.matured; + return (int)node->attr.block.matured; } void -set_Block_matured (ir_node *node, bool matured) { +set_Block_matured (ir_node *node, int matured) { assert (node->op == op_Block); node->attr.block.matured = matured; } @@ -697,7 +697,7 @@ void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) { /* Fix backedge array. fix_backedges() operates depending on interprocedural_view. */ int ipv = get_interprocedural_view(); - set_interprocedural_view(true); + set_interprocedural_view(1); fix_backedges(current_ir_graph->obst, node); set_interprocedural_view(ipv); } @@ -1415,7 +1415,7 @@ int is_Cast_upcast(ir_node *node) { assert(fromtype); - if (!is_Class_type(totype)) return false; + if (!is_Class_type(totype)) return 0; return is_subclass_of(fromtype, totype); } @@ -1437,7 +1437,7 @@ int is_Cast_downcast(ir_node *node) { assert(fromtype); - if (!is_Class_type(totype)) return false; + if (!is_Class_type(totype)) return 0; return is_subclass_of(totype, fromtype); } diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index 983f71f49..8bea175d5 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -267,7 +267,7 @@ ir_node *get_Block_cfgpred (ir_node *node, int pos); void set_Block_cfgpred (ir_node *node, int pos, ir_node *pred); /** Get the predecessor block. * - * Returns the block corresonding to the predecessor pos of block. + * Returns the block corresponding to the predecessor pos of block. * * There are several ambiguities we resolve with this function: * - The direct predecessor can be a Proj, which is not pinned. @@ -277,8 +277,8 @@ void set_Block_cfgpred (ir_node *node, int pos, ir_node *pred); * Start, but the Bad node. */ ir_node *get_Block_cfgpred_block(ir_node *node, int pos); -bool get_Block_matured (ir_node *node); -void set_Block_matured (ir_node *node, bool matured); +int get_Block_matured (ir_node *node); +void set_Block_matured (ir_node *node, int matured); /** A visited flag only for block nodes. * @see also: get_irn_visited() inc_irg_visited() inc_irg_block_visited()*/ diff --git a/ir/ir/irprog.c b/ir/ir/irprog.c index 51d69633f..f29c5278a 100644 --- a/ir/ir/irprog.c +++ b/ir/ir/irprog.c @@ -135,11 +135,11 @@ void add_irp_irg(ir_graph *irg) { /* Removes irg from the list or irgs, shrinks the list by one. */ void remove_irp_irg_from_list(ir_graph *irg){ - int i, found = false; + int i, found = 0; assert(irg); for (i = 0; i < (ARR_LEN (irp->graphs)); i++) { if (irp->graphs[i] == irg) { - found = true; + found = 1; for(; i < (ARR_LEN (irp->graphs)) - 1; i++) { irp->graphs[i] = irp->graphs[i+1]; } @@ -177,23 +177,23 @@ ir_graph *(get_irp_irg)(int pos){ void set_irp_irg(int pos, ir_graph *irg) { assert (irp && irg); - assert (pos < (ARR_LEN((irp)->graphs))); + assert (pos < (ARR_LEN(irp->graphs))); irp->graphs[pos] = irg; } /* Gets the number of graphs _and_ pseudo graphs. */ int get_irp_n_allirgs(void) { /* We can not call get_irp_n_irgs, as we end up in a recursion ... */ - return ARR_LEN((irp)->graphs) + get_irp_n_pseudo_irgs(); + return ARR_LEN(irp->graphs) + get_irp_n_pseudo_irgs(); } /* Returns the ir graph at position pos of all graphs (including pseudo graphs). Visits first graphs, then pseudo graphs. */ ir_graph *get_irp_allirg(int pos) { - int n_irgs = ARR_LEN((irp)->graphs); + int n_irgs = ARR_LEN(irp->graphs); assert(0 <= pos); if (pos < n_irgs) { - return (irp)->graphs[pos]; + return irp->graphs[pos]; } else { return get_irp_pseudo_irg(pos-n_irgs); } diff --git a/ir/ir/irreflect.c b/ir/ir/irreflect.c index 075430be9..6948fae8d 100644 --- a/ir/ir/irreflect.c +++ b/ir/ir/irreflect.c @@ -64,7 +64,7 @@ typedef struct { typedef struct { opcode opc; const char *name; - bool commutative; + int commutative; int sig_count; rflct_arg_t *sigs[MAX_SIG_COUNT]; } rflct_opcode_t; @@ -326,23 +326,26 @@ char *rflct_to_string(char *buf, int n, opcode opc, int sig) { return buf; } +#define NON_VARIADIC 0 +#define VARIADIC 1 + #define ARG(name,modes) \ -_ARG(name, modes, false, -1) +_ARG(name, modes, NON_VARIADIC, -1) #define ARG_SAME(name,modes,mode_same) \ -_ARG(name, modes, false, mode_same) +_ARG(name, modes, NON_VARIADIC, mode_same) #define VARG(name,modes) \ -_ARG(name, modes, true, 0) +_ARG(name, modes, VARIADIC, 0) #define VARG_SAME(name,modes) \ -_ARG(name, modes, true, 1) +_ARG(name, modes, VARIADIC, 1) #define MARK \ -_ARG(NULL, None, false, -1) +_ARG(NULL, None, NON_VARIADIC, -1) #define FINISH \ -_ARG(NULL, None, false, 0) +_ARG(NULL, None, NON_VARIADIC, 0) #define BLOCK ARG("Block", BB) @@ -401,7 +404,7 @@ arg->name = _name; \ arg->is_variadic = _var; \ arg->mode_equals = _me; -void rflct_new_opcode(opcode opc, const char *name, bool commutative) +void rflct_new_opcode(opcode opc, const char *name, int commutative) { rflct_opcode_t *ropc = obstack_alloc(&obst, sizeof(*ropc)); @@ -414,7 +417,7 @@ void rflct_new_opcode(opcode opc, const char *name, bool commutative) opcodes[opc] = ropc; } -bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig) +int rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig) { rflct_arg_t *args = sig->args; rflct_opcode_t *op = opcodes[opc]; @@ -425,12 +428,12 @@ bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig) for(i = 0; i < MAX_SIG_COUNT && op->sigs[i] != NULL; i++); if(i >= MAX_SIG_COUNT) - return false; + return 0; op->sigs[op->sig_count++] = args; free(sig); - return true; + return 1; } @@ -454,7 +457,7 @@ rflct_sig_t *rflct_signature_allocate(int defs, int uses) return sig; } -int rflct_signature_get_index(const rflct_sig_t *sig, bool is_use, int num) +int rflct_signature_get_index(const rflct_sig_t *sig, int is_use, int num) { return is_use ? num + sig->defs + 1 : num; } @@ -466,8 +469,8 @@ arg->name = _name; \ arg->is_variadic = _var; \ arg->mode_equals = _me; -int rflct_signature_set_arg(rflct_sig_t *sig, bool is_use, int num, - const char *name, rflct_mode_class_t mc, bool is_variadic, int mode_equals) +int rflct_signature_set_arg(rflct_sig_t *sig, int is_use, int num, + const char *name, rflct_mode_class_t mc, int is_variadic, int mode_equals) { int index = rflct_signature_get_index(sig, is_use, num); rflct_arg_t *arg = sig->args + index; @@ -479,3 +482,6 @@ int rflct_signature_set_arg(rflct_sig_t *sig, bool is_use, int num, void firm_init_rflct(void) { init_ops(); } + +#undef VARIADIC +#undef NON_VARIADIC diff --git a/ir/ir/irreflect.h b/ir/ir/irreflect.h index b598372b4..cb83f2511 100644 --- a/ir/ir/irreflect.h +++ b/ir/ir/irreflect.h @@ -11,7 +11,6 @@ #define _FIRM_REFLECT_H #include -#include #include "irop.h" #include "irnode.h" @@ -47,7 +46,7 @@ typedef enum { typedef struct _rflct_arg_t { const char *name; /**< The name of the argument (just a description). */ - bool is_variadic; /**< True, if this argument can have multiple parameters. */ + int is_variadic; /**< non-zero, if this argument can have multiple parameters. */ rflct_mode_class_t accepted_modes; /**< The set of accepted modes. */ int mode_equals; /**< If not variadic: You can specify the index of @@ -162,20 +161,20 @@ char *rflct_mode_class_name(char *str, int n, rflct_mode_class_t mc); /** * Create a new opcode. - * @param opc The Firm opcode. - * @param name A name. - * @param commutative True, if the opcode is commuatative. + * @param opc The Firm opcode. + * @param name A name. + * @param commutative non-zero, if the opcode is commutative. */ -void rflct_new_opcode(opcode opc, const char *name, bool commutative); +void rflct_new_opcode(opcode opc, const char *name, int commutative); /** * Add a signature to the opcode. * @param opc The opcode. * @param sig The signature. - * @return true, if the signature was added sucessfully, false if no + * @return non-zero, if the signature was added successfully, false if no * more signatures can be added to the opcode. */ -bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig); +int rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig); /** * Allocate a new signature. @@ -187,13 +186,14 @@ rflct_sig_t *rflct_signature_allocate(int defs, int uses); /** * Set an argument in a signature. - * @param sig The signature. - * @param is_use true, if the argument is a use, else it is considered a - * def. - * @param num The index of the argument. - * @param name The name of the argument. - * @param mc The mode class of the argument. - * @param is_variadic true, if the argument is variadic. + * + * @param sig The signature. + * @param is_use non-zero, if the argument is a use, else it is + * considered a def. + * @param num The index of the argument. + * @param name The name of the argument. + * @param mc The mode class of the argument. + * @param is_variadic non-zero, if the argument is variadic. * @param mode_equals This variable has following meaning: If the * argument is variadic, a 1 indicates that all operands binding to this * argument must have the same mode. A 0 indicates, that their mode must @@ -205,17 +205,17 @@ rflct_sig_t *rflct_signature_allocate(int defs, int uses); * @return The index of the argument. Only use this index in mode_equals * parameters of other arguments. */ -int rflct_signature_set_arg(rflct_sig_t *sig, bool is_use, int num, - const char *name, rflct_mode_class_t mc, bool is_variadic, int mode_equals); +int rflct_signature_set_arg(rflct_sig_t *sig, int is_use, int num, + const char *name, rflct_mode_class_t mc, int is_variadic, int mode_equals); /** * Get the arguments array index for an argument. - * @param sig The signature. - * @param is_use True, if the argument indicates a use or def argument. - * @param num The number of the argument. + * @param sig The signature. + * @param is_use non-zero, if the argument indicates a use or def argument. + * @param num The number of the argument. * @return The index into the arguments array. */ -int rflct_signature_get_index(const rflct_sig_t *sig, bool is_use, int num); +int rflct_signature_get_index(const rflct_sig_t *sig, int is_use, int num); #endif /* _FIRM_REFLECT_H */ diff --git a/ir/ir/pseudo_irg.c b/ir/ir/pseudo_irg.c index b17da3086..5ab5fcbcf 100644 --- a/ir/ir/pseudo_irg.c +++ b/ir/ir/pseudo_irg.c @@ -54,7 +54,7 @@ new_pseudo_ir_graph(entity *ent, int n_loc) { return res; } -/* Returns true ir ir_graph is pseudo graph. */ +/* Returns non-zero ir ir_graph is pseudo graph. */ int is_pseudo_ir_graph(ir_graph *irg) { int i, n_pseudo_irgs; @@ -64,9 +64,9 @@ int is_pseudo_ir_graph(ir_graph *irg) n_pseudo_irgs = get_irp_n_pseudo_irgs(); for (i = 0; i < n_pseudo_irgs; ++i) { - if (irg == get_irp_pseudo_irg(i)) return true; + if (irg == get_irp_pseudo_irg(i)) return 1; } - return false; + return 0; } static int visit_pseudo_irgs = 0; diff --git a/ir/ir/pseudo_irg.h b/ir/ir/pseudo_irg.h index a57f2b41b..1a3d0d8ff 100644 --- a/ir/ir/pseudo_irg.h +++ b/ir/ir/pseudo_irg.h @@ -26,7 +26,7 @@ */ ir_graph *new_pseudo_ir_graph(entity *ent, int n_loc); -/** Returns true ir ir_graph is pseudo graph. +/** Returns non-zero ir ir_graph is pseudo graph. * Is irg a pseudo graph for analysis? */ int is_pseudo_ir_graph(ir_graph *irg); diff --git a/ir/opt/loop_unrolling.c b/ir/opt/loop_unrolling.c index 94717291c..baefca245 100644 --- a/ir/opt/loop_unrolling.c +++ b/ir/opt/loop_unrolling.c @@ -112,7 +112,7 @@ copy_node (ir_node *n, void *env) ir_node *nn; int new_arity; ir_op *op = get_irn_op(n); - int copy_node_nr = false; + int copy_node_nr = 0; /* The end node looses it's flexible in array. This doesn't matter, as dead node elimination builds End by hand, inlineing doesn't use diff --git a/ir/tr/entity.c b/ir/tr/entity.c index ee1c3634a..8cb11fb73 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -518,15 +518,14 @@ int is_irn_const_expression(ir_node *n) { case iro_Const: case iro_SymConst: case iro_Unknown: - return true; break; + return 1; case iro_Conv: case iro_Cast: return is_irn_const_expression(get_irn_n(n, 0)); default: - return false; break; } - return false; + return 0; } /* @@ -622,15 +621,15 @@ int is_proper_compound_graph_path(compound_graph_path *gr, int pos) { node = get_compound_graph_path_node(gr, i); if (node == NULL) /* Path not yet complete. */ - return true; + return 1; if (get_entity_owner(node) != owner) - return false; + return 0; owner = get_entity_type(node); } if (pos == get_compound_graph_path_length(gr)) if (!is_atomic_type(owner)) - return false; - return true; + return 0; + return 1; } /* Returns the length of a graph path */ @@ -711,14 +710,14 @@ static int equal_paths(compound_graph_path *path1, int *visited_indicees, compou int len1 = get_compound_graph_path_length(path1); int len2 = get_compound_graph_path_length(path2); - if (len2 > len1) return false; + if (len2 > len1) return 0; for (i = 0; i < len1; i++) { type *tp; entity *node1 = get_compound_graph_path_node(path1, i); entity *node2 = get_compound_graph_path_node(path2, i); - if (node1 != node2) return false; + if (node1 != node2) return 0; tp = get_entity_owner(node1); if (is_Array_type(tp)) { @@ -730,13 +729,13 @@ static int equal_paths(compound_graph_path *path1, int *visited_indicees, compou low = get_array_lower_bound_int(tp, 0); if (low + visited_indicees[i] < get_compound_graph_path_array_index(path2, i)) { visited_indicees[i]++; - return false; + return 0; } else assert(low + visited_indicees[i] == get_compound_graph_path_array_index(path2, i)); } } - return true; + return 1; } /* Returns the position of a value with the given path. @@ -1278,9 +1277,9 @@ int is_compound_entity(entity *ent) { /** * @todo not implemented!!! */ -bool equal_entity(entity *ent1, entity *ent2) { +int equal_entity(entity *ent1, entity *ent2) { fprintf(stderr, " calling unimplemented equal entity!!! \n"); - return true; + return 1; } diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 66f45b05c..7c227774c 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -371,7 +371,7 @@ int get_compound_graph_path_array_index(compound_graph_path *gr, int pos); void set_compound_graph_path_array_index(compound_graph_path *gr, int pos, int index); /** Checks whether the path up to pos is correct. If the path contains a NULL, - * assumes the path is not complete and returns 'true'. */ + * assumes the path is not complete and returns non-zero. */ int is_proper_compound_graph_path(compound_graph_path *gr, int pos); /* A value of a compound entity is a pair of a value and the description of the @@ -509,7 +509,7 @@ int is_compound_entity(entity *ent); - they have the same type (the same C-struct) - ...? */ -bool equal_entity(entity *ent1, entity *ent2); +int equal_entity(entity *ent1, entity *ent2); /** Outputs a unique number for this entity if libfirm is compiled for debugging, (configure with --enable-debug) else returns 0. */ diff --git a/ir/tr/tr_inheritance.c b/ir/tr/tr_inheritance.c index aed2e1606..2982d2e12 100644 --- a/ir/tr/tr_inheritance.c +++ b/ir/tr/tr_inheritance.c @@ -351,12 +351,15 @@ void compute_inh_transitive_closure(void) { type *tp = get_irp_type(i); if (is_Class_type(tp) && type_not_visited(tp)) { /* For others there is nothing to accumulate. */ int j, n_subtypes = get_class_n_subtypes(tp); - int has_unmarked_subtype = false; + int has_unmarked_subtype = 0; assert(get_type_visited(tp) < get_master_type_visited()-1); - for (j = 0; j < n_subtypes && !has_unmarked_subtype; ++j) { + for (j = 0; j < n_subtypes; ++j) { type *stp = get_class_subtype(tp, j); - if (type_not_visited(stp)) has_unmarked_subtype = true; + if (type_not_visited(stp)) { + has_unmarked_subtype = 1; + break; + } } /* This is a good starting point. */ @@ -372,12 +375,15 @@ void compute_inh_transitive_closure(void) { type *tp = get_irp_type(i); if (is_Class_type(tp) && type_not_visited(tp)) { /* For others there is nothing to accumulate. */ int j, n_supertypes = get_class_n_supertypes(tp); - int has_unmarked_supertype = false; + int has_unmarked_supertype = 0; assert(get_type_visited(tp) < get_master_type_visited()-1); - for (j = 0; j < n_supertypes && !has_unmarked_supertype; ++j) { + for (j = 0; j < n_supertypes; ++j) { type *stp = get_class_supertype(tp, j); - if (type_not_visited(stp)) has_unmarked_supertype = true; + if (type_not_visited(stp)) { + has_unmarked_supertype = 1; + break; + } } /* This is a good starting point. */ diff --git a/ir/tr/trvrfy.c b/ir/tr/trvrfy.c index 2aae2b269..bab535380 100644 --- a/ir/tr/trvrfy.c +++ b/ir/tr/trvrfy.c @@ -41,18 +41,18 @@ static int check_class(type *tp) { entity *ovw = get_entity_overwrites(mem, j); /*printf(" overwrites: "); DDME(ovw);*/ /* Check whether ovw is member of one of tp's supertypes. If so, - the representation is correct. */ - found = false; + the representation is correct. */ + found = 0; for (k = 0; k < get_class_n_supertypes(tp); k++) { - if (get_class_member_index(get_class_supertype(tp, k), ovw) >= 0) { - found = true; - break; - } + if (get_class_member_index(get_class_supertype(tp, k), ovw) >= 0) { + found = 0; + break; + } } if (!found) { - DDMT(tp); DDME(mem); - assert(found && "overwrites an entity not contained in direct supertype"); - return error_ent_not_cont; + DDMT(tp); DDME(mem); + assert(found && "overwrites an entity not contained in direct supertype"); + return error_ent_not_cont; } } diff --git a/ir/tr/type.h b/ir/tr/type.h index 38d0bb3b4..963734b35 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -35,8 +35,6 @@ # ifndef _TYPE_H_ # define _TYPE_H_ -#include - # include "firm_types.h" # include "tpop.h" # include "firm_common.h" -- 2.20.1