+} /* set_dbg_outfile */
+
+/**
+ * Show info about a firm thing.
+ */
+static void show_firm_object(void *firm_thing) {
+ FILE *f = stdout;
+
+ if (firm_thing == NULL) {
+ fprintf(f, "<NULL>\n");
+ return;
+ }
+ switch (get_kind(firm_thing)) {
+ case k_BAD:
+ fprintf(f, "BAD: (%p)\n", firm_thing);
+ break;
+ case k_entity:
+ dump_entity_to_file(f, firm_thing, dump_verbosity_max);
+ break;
+ case k_type:
+ dump_type_to_file(f, firm_thing, dump_verbosity_max);
+ break;
+ case k_ir_graph:
+ case k_ir_node:
+ case k_ir_mode:
+ case k_ir_op:
+ case k_tarval:
+ case k_ir_loop:
+ case k_ir_compound_graph_path:
+ case k_ir_extblk:
+ case k_ir_prog:
+ fprintf(f, "NIY\n");
+ break;
+ default:
+ fprintf(f, "Cannot identify thing at (%p).\n", firm_thing);
+ }
+} /* show_firm_object */
+
+/**
+ * Find a firm type by its number.
+ */
+static ir_type *find_type_nr(long nr) {
+ int i, n = get_irp_n_types();
+ ir_type *tp;
+
+ for (i = 0; i < n; ++i) {
+ tp = get_irp_type(i);
+ if (get_type_nr(tp) == nr)
+ return tp;
+ }
+ tp = get_glob_type();
+ if (get_type_nr(tp) == nr)
+ return tp;
+ return NULL;
+} /* find_type_nr */
+
+/**
+ * Find a firm type by its name.
+ */
+static ir_type *find_type_name(const char *name) {
+ int i, n = get_irp_n_types();
+ ir_type *tp;
+
+ for (i = 0; i < n; ++i) {
+ tp = get_irp_type(i);
+ if (strcmp(get_type_name(tp), name) == 0)
+ return tp;
+ }
+ tp = get_glob_type();
+ if (strcmp(get_type_name(tp), name) == 0)
+ return tp;
+ return NULL;
+} /* find_type_name */
+
+/** The environment for the entity search functions. */
+typedef struct find_env {
+ union {
+ long nr; /**< the number that is searched for */
+ const char *name; /**< the name that is searched for */
+ } u;
+ entity *res; /**< the result */
+} find_env_t;
+
+/**
+ * Type-walker: Find an entity with given number.
+ */
+static void check_ent_nr(type_or_ent *tore, void *ctx) {
+ entity *ent = (entity *)tore;
+ find_env_t *env = ctx;
+
+ if (is_entity(ent))
+ if (get_entity_nr(ent) == env->u.nr) {
+ env->res = ent;
+ }
+} /* check_ent_nr */
+
+/**
+ * Type-walker: Find an entity with given name.
+ */
+static void check_ent_name(type_or_ent *tore, void *ctx) {
+ entity *ent = (entity *)tore;
+ find_env_t *env = ctx;
+
+ if (is_entity(ent))
+ if (strcmp(get_entity_name(ent), env->u.name) == 0) {
+ env->res = ent;
+ }
+} /* check_ent_name */
+
+/**
+ * Find a firm entity by its number.
+ */
+static entity *find_entity_nr(long nr) {
+ find_env_t env;
+
+ env.u.nr = nr;
+ env.res = NULL;
+ type_walk(check_ent_nr, NULL, &env);
+ return env.res;
+} /* find_entity_nr */
+
+/**
+ * Find a firm entity by its name.
+ */
+static entity *find_entity_name(const char *name) {
+ find_env_t env;
+
+ env.u.name = name;
+ env.res = NULL;
+ type_walk(check_ent_name, NULL, &env);
+ return env.res;
+} /* find_entity_name */
+
+static void irgname(const char *name) {
+ int i;
+ ident *id = new_id_from_str(name);
+
+ for(i = get_irp_n_irgs() - 1; i >= 0; --i) {
+ ir_graph *irg = get_irp_irg(i);
+ entity *ent = get_irg_entity(irg);
+ if(ent && get_entity_ident(ent) == id) {
+ ir_printf("%+F (%p)\n", irg, irg);
+ break;
+ }
+ }