void
init_firm (void)
{
+ /* register the character 'I' as variable for ident outputs. */
xprintf_register ('I', ident_print);
+ /* register the character 'v' as variable for tarval outputs. */
xprintf_register ('v', tarval_print);
+ /* register the character 'R' as variable for ir node outputs. */
xprintf_register ('R', ir_node_print);
+ /* initialize all ident stuff */
id_init ();
+ /* create an obstack and put alle tarvals in a pdeq */
tarval_init_1 ();
+ /* initialize all modes an ir node can consist of */
init_mode ();
+ /* initialize tarvals, and floating point arithmetic */
tarval_init_2 ();
+ /* kind of obstack initialization */
init_mangle ();
+ /* initalize all op codes an irnode can consist of */
init_op ();
+ /* called once for each run of this library, empty at this moment!!! */
init_cons ();
}
**
** Authors: Martin Trapp, Christian Schaefer
**
-** firm.h:
+** firm.h: initialize the firm tree with all its components
*/
# ifndef _FIRM_H_
#define XX_USER(name) ident *id_##name;
#define XX_INTERNAL(name, str) XX_USER(name)
-//#include "xx_ident.h"
#undef XX_USER
#undef XX_INTERNAL
#define XX_USER(name) id_##name = ID_FROM_STR(#name, sizeof(#name)- 1);
#define XX_INTERNAL(name, str) id_##name = ID_FROM_STR((str), sizeof((str))-1);
- //#include "xx_ident.h"
#undef XX_USER
#undef XX_INTERNAL
}
res->attr.block.matured = 0;
set_Block_block_visit(res, 0);
- // res = optimize (res); /* GL: only optimize if mature!!!! */
+ /* forget this optimization. use this only if mature !!!!
+ res = optimize (res); */
ir_vrfy (res);
/** create a new dynamic array, which stores all parameters in irnodes */
assert(n->attr.s.ent->kind == k_entity);
xfprintf (F, "\"%I ", n->op->name);
xfprintf (F, "%s\" ", id_to_str(n->attr.s.ent->name));
- // xfprintf (F, "\"%I %I\" ", n->op->name, n->attr.s.ent); // GL: doesn't work for some reason.
+ /* xdoesn't work for some reason.
+ fprintf (F, "\"%I %I\" ", n->op->name, n->attr.s.ent); */
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_SymConst:
assert(get_kind(get_SymConst_type(n)) == k_type_class);
- //assert(n->attr.i.type->kind == k_type_class);
+ /* assert(n->attr.i.type->kind == k_type_class); */
assert(get_class_ident((type_class *)get_SymConst_type(n)));
- //assert(n->attr.i.type->clss->name);
+ /* assert(n->attr.i.type->clss->name); */
xfprintf (F, "\"%s ", id_to_str(get_class_ident((type_class *)get_SymConst_type(n))));
- //xfprintf (F, "\"%s ", id_to_str(n->attr.i.type->name));
- // xfprintf (F, "\"%N\" ", n->attr.i.type); // GL: doesn't work for some reason.
+ /* xfprintf (F, "\"%s ", id_to_str(n->attr.i.type->name)); */
+ /* doesn't work for some reason. */
+ /* xfprintf (F, "\"%N\" ", n->attr.i.type); */
switch (n->attr.i.num){
case type_tag:
xfprintf (F, "tag\" ");
vcg_open (irg, "-all");
/* dump common ir graph */
- // irg_block_walk(irg->end, dump_ir_block, NULL, irg);
+ /* irg_block_walk(irg->end, dump_ir_block, NULL, irg); */
irg_walk(irg->end, dump_whole_node, NULL, NULL);
/* dump type info */
type_walk(irg, dump_type_info, NULL, NULL);
}
}
} else {
- // printf(" # comp_val: Proj node, not optimized\n");
+ /* printf(" # comp_val: Proj node, not optimized\n"); */
}
}
break;
}
if (n_preds == 0) { /* Phi of dead Region without predecessors. */
- // GL: why not return new_Bad?
+ /* GL: why not return new_Bad? */
break;
}
return 1;
/* compare a->in[0..ins] with b->in[0..ins], i.e., include the block. */
- // do if (*ain++ != *bin++) return 1; while (ins--);
+ /* do if (*ain++ != *bin++) return 1; while (ins--); */
for (i = -1; i < get_irn_arity(a); i++)
if (get_irn_n(a, i) != get_irn_n(b, i))
return 1;
unsigned h;
int i;
- // hash table value = 9*(9*(9*(9*(9*arity+in[0])+in[1])+ ...)+mode)+code
+ /* hash table value = 9*(9*(9*(9*(9*arity+in[0])+in[1])+ ...)+mode)+code */
h = get_irn_arity(node);
- // consider all in nodes... except the block.
+ /* consider all in nodes... except the block. */
for (i = 0; i < get_irn_arity(node); i++) {
h = 9*h + (unsigned long)get_irn_n(node, i);
}
- // ...mode,...
+ /* ...mode,... */
h = 9*h + (unsigned long) get_irn_mode (node);
- // ...and code
+ /* ...and code */
h = 9*h + (unsigned long) get_irn_op (node);
return h;
/* evaluation was succesful -- replace the node. */
obstack_free (current_ir_graph->obst, n);
return new_Const (get_tv_mode (tv), tv);
- // xprintf("* optimize: computed node %I\n", n->op->name);
+ /* xprintf("* optimize: computed node %I\n", n->op->name); */
}
}
}
/* identify found a cse, so deallocate the old node. */
if (n != old_n) {
obstack_free (current_ir_graph->obst, old_n);
- // The AmRoq fiasco returns n here. Martin's version doesn't.
+ /* The AmRoq fiasco returns n here. Martin's version doesn't. */
}
#if 0
/* Now we have a legal, useful node. Enter it in hash table for cse */
if (get_opt_cse()) {
- // aborts ??! set/pset can not handle several hash tables??!
- // No, suddenly it works.
+ /* aborts ??! set/pset can not handle several hash tables??!
+ No, suddenly it works. */
n = identify_remember (current_ir_graph->value_table, n);
}
-#if 0 // GL: what's the use of this??
+#if 0 /* GL: what's the use of this?? */
if ((current_ir_graph->state & irgs_building) && IR_KEEP_ALIVE (n)) {
assert (~current_ir_graph->state & irgs_keep_alives_in_arr);
pdeq_putr (current_ir_graph->keep.living, n);
/* if not optimize return n */
if (n == NULL) {
- // Here this is possible. Why?
+ /* Here this is possible. Why? */
return n;
}
if (tv != NULL) {
/* evaluation was succesful -- replace the node. */
return new_Const (get_tv_mode (tv), tv);
- // xprintf("* optimize: computed node %I\n", n->op->name);
+ /* xprintf("* optimize: computed node %I\n", n->op->name);*/
}
}
}
/* identify found a cse, so deallocate the old node. */
if (n != old_n) {
- // The AmRoq fiasco returns n here. Martin's version doesn't.
+ /* The AmRoq fiasco returns n here. Martin's version doesn't. */
}
#if 0
/* Now we have a legal, useful node. Enter it in hash table for cse */
if (get_opt_cse()) {
- // aborts ??! set/pset can not handle several hash tables??!
- // No, suddenly it works.
+ /* aborts ??! set/pset can not handle several hash tables??!
+ No, suddenly it works. */
n = identify_remember (current_ir_graph->value_table, n);
}
ident *name; /* name of this entity */
// type_class *owner; /* The class this entity belongs to */
type *owner; /* The class this entity belongs to */
- ident *ld_name; // don't know what this is good for.
+ ident *ld_name; /* Unique name of this entity, i.e., the mangled
+ name. E.g., for a class `A' with field `a' this
+ is the ident for `A_a'. */
type *type; /* The type of this entity, e.g., a method type, a
basic type of the language or a class itself */
unsigned long visit; /* visited counter for walks of the type information */
typedef struct {
firm_kind kind;
- ident *name; // do I need the name, or is the name in entity sufficient?
- int arity; /* number of parameters, better n_params */
- type **param_type; /* code generation needs this information.
- Should it be generated by the frontend,
- or does this impose unnecessary work for
- optimizatinos that change the parameters of
- methods? */
- int n_res; /* number of results */
+ ident *name; /* do I need the name,
+ or is the name in entity sufficient? */
+ int arity; /* number of parameters, better n_params */
+ type **param_type; /* code generation needs this information.
+ Should it be generated by the frontend,
+ or does this impose unnecessary work for
+ optimizatinos that change the parameters of
+ methods? */
+ int n_res; /* number of results */
type **res_type;
/** needs pointer to it's ir_graph ??
ir_graph *graph; **/
typedef struct {
firm_kind kind;
- ident *name; // do I need a name?
+ ident *name; /* do I need a name? */
int n_types;
/* type **unioned_type; ... or something like that? */
unsigned long visit; /* visited counter for walks of the type information */
/* int n_enums;
ir_node **enum * Contains all constant nodes that represent a member
of the enum -- enumerators. */
- // is ir_node the propper array member?
+ /* is ir_node the propper array member? */
unsigned long visit; /* visited counter for walks of the type information */
} type_enumeration;
int tarval_print (XP_PAR1, const xprintf_info *, XP_PARN);
-
- /* Labeling of tarvals */
+/* Labeling of tarvals */
label tarval_label (tarval *);
void tarval_forall_labeled (int (*) (tarval *, void *), void *);