int firm_debug_active(void)
{
return is_active;
-} /* firm_debug_active */
+}
/**
* Reset the debug text buffer.
static void reset_dbg_buf(void)
{
firm_dbg_msg_buf[0] = '\0';
-} /* reset_dbg_buf */
+}
static void add_to_dbg_buf(const char *buf)
{
strncat(firm_dbg_msg_buf, buf, sizeof(firm_dbg_msg_buf));
-} /* add_to_dbg_buf */
+}
const char *firm_debug_text(void)
{
firm_dbg_msg_buf[sizeof(firm_dbg_msg_buf) - 1] = '\0';
return firm_dbg_msg_buf;
-} /* firm_debug_text */
+}
/**
* debug output
add_to_dbg_buf(buf);
else
puts(buf);
-} /* dbg_printf */
+}
/**
* A new node is created.
dbg_printf("Firm BP %u reached, %+F created\n", elem->bp.bpnr, node);
firm_debug_break();
}
-} /* dbg_new_node */
+}
/**
* A node is replaced.
dbg_printf("Firm BP %u reached, %+F will be replaced by %+F\n", elem->bp.bpnr, old, nw);
firm_debug_break();
}
-} /* dbg_replace */
+}
/**
* A new node is lowered.
dbg_printf("Firm BP %u reached, %+F will be lowered\n", elem->bp.bpnr, node);
firm_debug_break();
}
-} /* dbg_lower */
+}
/**
* A graph will be deleted.
firm_debug_break();
}
}
-} /* dbg_free_graph */
+}
/**
* An entity was created.
firm_debug_break();
}
}
-} /* dbg_new_entity */
+}
/**
* A type was created.
firm_debug_break();
}
}
-} /* dbg_new_type */
+}
/**
* Return the reason string.
case BP_MAX_REASON: break;
}
panic("unsupported reason");
-} /* reason_str */
+}
/**
* Compare two number breakpoints.
(void) size;
return (e1->nr - e2->nr) | (e1->bp.reason - e2->bp.reason);
-} /* cmp_nr_bp */
+}
/**
* Compare two ident breakpoints.
(void) size;
return (e1->id != e2->id) | (e1->bp.reason - e2->bp.reason);
-} /* cmp_ident_bp */
+}
/**
* Update the hooks.
}
#undef CASE_ON
#undef CASE_OFF
-} /* update_hooks */
+}
/**
* Break if nr is reached.
update_hooks(&elem->bp);
}
-} /* break_on_nr */
+}
/**
* Break if ident name is reached.
update_hooks(&elem->bp);
}
-} /* break_on_ident */
+}
/**
* Sets/resets the active flag of breakpoint bp.
}
}
dbg_printf("Error: Firm BP %u not exists.\n", bp);
-} /* bp_activate */
+}
/**
"irgldname ldname prints address and graph number of a method given by its ldname\n"
"help list all commands\n"
);
-} /* show_commands */
+}
/**
* Shows all Firm breakpoints.
dbg_printf(p->active ? "+enabled" : "+disabled");
}
dbg_printf(have_one ? "+\n" : "+ NONE\n");
-} /* show_bp */
+}
/**
* firm_dbg_register() expects that the name is stored persistent.
ident *id = new_id_from_str(name);
return firm_dbg_register(get_id_str(id));
-} /* dbg_register */
+}
/**
* Sets the debug mask of module name to lvl
dbg_printf("Setting debug mask of module %s to %u\n", name, lvl);
}
-} /* set_dbg_level */
+}
/**
* Redirects the debug output of module name to fname
firm_dbg_set_file(module, f);
dbg_printf("Redirecting debug output of module %s to file %s\n", name, fname);
-} /* set_dbg_outfile */
+}
/**
* Show info about a firm thing.
default:
fprintf(f, "Cannot identify thing at (%p).\n", firm_thing);
}
-} /* show_firm_object */
+}
/**
* Find a firm type by its number.
if (get_type_nr(tp) == nr)
return tp;
return NULL;
-} /* find_type_nr */
+}
/**
* Find a firm type by its name.
if (strcmp(get_compound_name(tp), name) == 0)
return tp;
return NULL;
-} /* find_type_name */
+}
/** The environment for the entity search functions. */
typedef struct find_env {
env->res = tore.ent;
}
}
-} /* check_ent_nr */
+}
/**
* Type-walker: Find an entity with given name.
if (strcmp(get_entity_name(tore.ent), env->u.name) == 0) {
env->res = tore.ent;
}
-} /* check_ent_name */
+}
/**
* Find a firm entity by its number.
env.res = NULL;
type_walk(check_ent_nr, NULL, &env);
return env.res;
-} /* find_entity_nr */
+}
/**
* Find a firm entity by its name.
env.res = NULL;
type_walk(check_ent_name, NULL, &env);
return env.res;
-} /* find_entity_name */
+}
/**
* Search methods for a name.
}
}
}
-} /* show_by_name */
+}
/**
* Search methods for a ldname.
}
}
}
-} /* show_by_ldname */
+}
/**
* prints the address and graph number of all irgs with given name
ident *id = new_id_from_str(name);
type_walk(show_by_name, NULL, (void *)id);
-} /* irg_name */
+}
/**
* prints the address and graph number of all irgs with given ld_name
ident *id = new_id_from_str(name);
type_walk(show_by_ldname, NULL, (void *)id);
-} /* irg_ld_name */
+}
enum tokens {
tok_create = 256,
lexer.has_token = 0;
lexer.curr_pos = input;
lexer.end_pos = input + strlen(input);
-} /* init_lexer */
+}
/**
if (lexer.curr_pos >= lexer.end_pos)
return '\0';
return *lexer.curr_pos++;
-} /* next_char */
+}
#define unput() if (lexer.curr_pos < lexer.end_pos) --lexer.curr_pos
else if (c == '\0')
return tok_eof;
return c;
-} /* get_token */
+}
void firm_debug(const char *cmd)
{
}
leave:
;
-} /* firm_debug */
+}
void firm_init_debugger(void)
{
if (break_on_init)
firm_debug_break();
-} /* firm_init_debugger */
+}
/**
* A gdb helper function to print firm objects.
assert(!"unknown SymConst kind");
break;
}
-} /* lower_symconst */
+}
/**
* Checks, whether a size is an integral size
return 0;
/* must be at least byte size */
return size >= 8;
-} /* is_integral_size */
+}
/**
* lower bitfield load access.
}
exchange(proj, res);
-} /* lower_bitfields_loads */
+}
/**
* lower bitfield store access.
set_Store_mem(store, mem);
set_Store_value(store, value);
set_Store_ptr(store, ptr);
-} /* lower_bitfields_stores */
+}
/**
* lowers IR-nodes, called from walker
lower_highlevel_graph(irg);
return 0;
-} /* lower_highlevel_graph_wrapper */
+}
ir_graph_pass_t *lower_highlevel_graph_pass(const char *name)
{
return def_graph_pass_constructor(
&pass->pass, name ? name : "lower_hl", lower_highlevel_graph_wrapper);
-} /* lower_highlevel_graph_pass */
+}
/*
* does the same as lower_highlevel() for all nodes on the const code irg
void lower_const_code(void)
{
walk_const_code(NULL, lower_irnode, NULL);
-} /* lower_const_code */
+}
ir_prog_pass_t *lower_const_code_pass(const char *name)
{
lower_highlevel_graph(irg);
}
lower_const_code();
-} /* lower_highlevel */
+}
}
}
}
-} /* call_mapper */
+}
/* Go through all graphs and map calls to intrinsic functions. */
size_t lower_intrinsics(i_record *list, size_t length, int part_block_used)
pmap_destroy(c_map);
return nr_of_intrinsics;
-} /* lower_intrinsics */
+}
typedef struct pass_t {
ir_prog_pass_t pass;
return def_prog_pass_constructor(
&pass->pass, name ? name : "lower_intrinsics", pass_wrapper);
-} /* lower_intrinsics_pass*/
+}
/**
* Helper function, replace the call by the given node.
DBG_OPT_ALGSIM0(call, mux, FS_OPT_RTS_ABS);
replace_call(mux, call, mem, NULL, NULL);
return 1;
-} /* i_mapper_abs */
+}
/* A mapper for the integer bswap. */
int i_mapper_bswap(ir_node *call, void *ctx)
irn = new_r_Proj(irn, get_irn_mode(op), pn_Builtin_max+1);
replace_call(irn, call, mem, NULL, NULL);
return 1;
-} /* i_mapper_bswap */
+}
/* A mapper for the alloca() function. */
int i_mapper_alloca(ir_node *call, void *ctx)
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_ALLOCA);
replace_call(irn, call, mem, no_exc, exc);
return 1;
-} /* i_mapper_alloca */
+}
/* A mapper for the floating point sqrt. */
int i_mapper_sqrt(ir_node *call, void *ctx)
DBG_OPT_ALGSIM0(call, op, FS_OPT_RTS_SQRT);
replace_call(op, call, mem, NULL, NULL);
return 1;
-} /* i_mapper_sqrt */
+}
/* A mapper for the floating point cbrt. */
int i_mapper_cbrt(ir_node *call, void *ctx)
DBG_OPT_ALGSIM0(call, op, FS_OPT_RTS_CBRT);
replace_call(op, call, mem, NULL, NULL);
return 1;
-} /* i_mapper_cbrt */
+}
/* A mapper for the floating point pow. */
int i_mapper_pow(ir_node *call, void *ctx)
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_POW);
replace_call(irn, call, mem, reg_jmp, exc_jmp);
return 1;
-} /* i_mapper_pow */
+}
/* A mapper for the floating point exp. */
int i_mapper_exp(ir_node *call, void *ctx)
return 1;
}
return 0;
-} /* i_mapper_exp */
+}
/**
* A mapper for mapping f(0.0) to 0.0.
return 1;
}
return 0;
-} /* i_mapper_zero_to_zero */
+}
/**
* A mapper for mapping f(1.0) to 0.0.
return 1;
}
return 0;
-} /* i_mapper_one_to_zero */
+}
/**
* A mapper for mapping a functions with the following characteristics:
changed = 1;
}
return changed;
-} /* i_mapper_symmetric_zero_to_one */
+}
/* A mapper for the floating point log. */
int i_mapper_log(ir_node *call, void *ctx)
{
/* log(1.0) = 0.0 */
return i_mapper_one_to_zero(call, ctx, FS_OPT_RTS_LOG);
-} /* i_mapper_log */
+}
/* A mapper for the floating point sin. */
int i_mapper_sin(ir_node *call, void *ctx)
{
/* sin(0.0) = 0.0 */
return i_mapper_zero_to_zero(call, ctx, FS_OPT_RTS_SIN);
-} /* i_mapper_sin */
+}
/* A mapper for the floating point cos. */
int i_mapper_cos(ir_node *call, void *ctx)
{
/* cos(0.0) = 1.0, cos(-x) = x */
return i_mapper_symmetric_zero_to_one(call, ctx, FS_OPT_RTS_COS);
-} /* i_mapper_cos */
+}
/* A mapper for the floating point tan. */
int i_mapper_tan(ir_node *call, void *ctx)
{
/* tan(0.0) = 0.0 */
return i_mapper_zero_to_zero(call, ctx, FS_OPT_RTS_TAN);
-} /* i_mapper_tan */
+}
/* A mapper for the floating point asin. */
int i_mapper_asin(ir_node *call, void *ctx)
{
/* asin(0.0) = 0.0 */
return i_mapper_zero_to_zero(call, ctx, FS_OPT_RTS_ASIN);
-} /* i_mapper_asin */
+}
/* A mapper for the floating point acos. */
int i_mapper_acos(ir_node *call, void *ctx)
{
/* acos(1.0) = 0.0 */
return i_mapper_one_to_zero(call, ctx, FS_OPT_RTS_ACOS);
-} /* i_mapper_acos */
+}
/* A mapper for the floating point atan. */
int i_mapper_atan(ir_node *call, void *ctx)
{
/* atan(0.0) = 0.0 */
return i_mapper_zero_to_zero(call, ctx, FS_OPT_RTS_ATAN);
-} /* i_mapper_atan */
+}
/* A mapper for the floating point sinh. */
int i_mapper_sinh(ir_node *call, void *ctx)
{
/* sinh(0.0) = 0.0 */
return i_mapper_zero_to_zero(call, ctx, FS_OPT_RTS_SINH);
-} /* i_mapper_sinh */
+}
/* A mapper for the floating point cosh. */
int i_mapper_cosh(ir_node *call, void *ctx)
{
/* cosh(0.0) = 1.0, cosh(-x) = x */
return i_mapper_symmetric_zero_to_one(call, ctx, FS_OPT_RTS_COSH);
-} /* i_mapper_cosh */
+}
/* A mapper for the floating point tanh. */
int i_mapper_tanh(ir_node *call, void *ctx)
{
/* tanh(0.0) = 0.0 */
return i_mapper_zero_to_zero(call, ctx, FS_OPT_RTS_TANH);
-} /* i_mapper_tanh */
+}
/**
* Return the const entity that is accessed through the pointer ptr or
}
}
return NULL;
-} /* get_const_entity */
+}
static bool initializer_val_is_null(ir_initializer_t *init)
{
}
return NULL;
-} /* eval_strlen */
+}
/* A mapper for strlen */
int i_mapper_strlen(ir_node *call, void *ctx)
}
}
return 0;
-} /* i_mapper_strlen */
+}
/**
* Calculate the value of strlen if possible.
/* TODO */
return NULL;
-} /* eval_strcmp */
+}
/**
* Checks if an entity represents the empty string.
init0 = get_initializer_compound_value(initializer, 0);
return initializer_val_is_null(init0);
-} /* is_empty_string */
+}
/* A mapper for strcmp */
int i_mapper_strcmp(ir_node *call, void *ctx)
}
return 0;
-} /* i_mapper_strcmp */
+}
/* A mapper for strncmp */
int i_mapper_strncmp(ir_node *call, void *ctx)
return 1;
}
return 0;
-} /* i_mapper_strncmp */
+}
/* A mapper for strcpy */
int i_mapper_strcpy(ir_node *call, void *ctx)
return 1;
}
return 0;
-} /* i_mapper_strcpy */
+}
/* A mapper for memcpy */
int i_mapper_memcpy(ir_node *call, void *ctx)
return 1;
}
return 0;
-} /* i_mapper_memcpy */
+}
/* A mapper for mempcpy */
int i_mapper_mempcpy(ir_node *call, void *ctx)
return 1;
}
return 0;
-} /* i_mapper_mempcpy */
+}
/* A mapper for memmove */
int i_mapper_memmove(ir_node *call, void *ctx)
return 1;
}
return 0;
-} /* i_mapper_memmove */
+}
/* A mapper for memset */
int i_mapper_memset(ir_node *call, void *ctx)
return 1;
}
return 0;
-} /* i_mapper_memset */
+}
/* A mapper for memcmp */
int i_mapper_memcmp(ir_node *call, void *ctx)
return 1;
}
return 0;
-} /* i_mapper_memcmp */
+}
/**
* Returns the result mode of a node.
case iro_Mod: return get_Mod_resmode(node);
default: return NULL;
}
-} /* get_irn_res_mode */
+}
#define LMAX(a, b) ((a) > (b) ? (a) : (b))
}
/* should not happen */
return 0;
-} /* i_mapper_RuntimeCall */
+}