/* returns the kind of the thing */
firm_kind
get_kind (void *firm_thing) {
+ assert (firm_thing);
return *(firm_kind *)firm_thing;
}
const char* print_firm_kind(void *firm_thing) {
+ assert (firm_thing);
switch (*(firm_kind *)firm_thing) {
case k_entity: { return "k_enitity"; } break;
case k_type_class: { return "k_type_class"; } break;
# ifndef _COMMON_H_
# define _COMMON_H_
-// GL# include <assert.h>
-
/** Global flags. Set these by autoconf?? **/
/* There are two implementations of the Phi node construction. The first
init_cons ();
/* Builds a construct allowing to access all information to be constructed
later. */
-
init_irprog ();
}
- size
- linkage_ptr_info
If the attr.i.num is type_tag or size, the node contains an attribute
- attr.i.*type A pointer to a type_class.
+ attr.i.*type, a pointer to a type_class. The mode of the node is mode_i.
if it is linkage_ptr_info it contains
- attr.i.*ptrinfo An ident holding information for the linker.
+ attr.i.*ptrinfo, an ident holding information for the linker. The mode
+ of the node is mode_p.
THE SELECT NODE
---------------
Parameters:
*store The current memory.
*addr A pointer to the variable to be read in this memory.
- *mode The mode of the loaded value.
Inputs:
The memory and a pointer to a variable in this memory.
# include "irnode_t.h"
# include "irgraph_t.h"
+# include "irprog.h"
# include "irdump.h"
# include "panic.h"
# include <string.h>
vcg_close();
current_ir_graph = rem;
}
+
+/***********************************************************************/
+/* dumps all graphs with the graph-dumper passed. Possible dumpers: */
+/* dump_ir_graph */
+/* dump_ir_block_graph */
+/* dump_cfg */
+/* dump_type_graph */
+/* dump_ir_graph_w_types */
+/***********************************************************************/
+void dump_all_ir_graphs (void dump_graph(ir_graph*)) {
+ int i;
+ for (i=0; i < get_irp_n_irgs(); i++) {
+ dump_graph(get_irp_irg(i));
+ }
+}
/* dumps a graph and the type inforamtion. */
void dump_ir_graph_w_types (ir_graph *irg);
+/* dumps all graphs with the graph-dumper passed. Possible dumpers:
+ * dump_ir_graph
+ * dump_ir_block_graph
+ * dump_cfg
+ * dump_type_graph
+ * dump_ir_graph_w_types */
+void dump_all_ir_graphs (void dump_graph(ir_graph*));
+
# endif /* _IRDUMP_H_ */
new_ir_prog ();
}
-/* Create a new ir prog. Automatically called by init_firm through init_irprog. */
+/* Create a new ir prog. Automatically called by init_firm through
+ init_irprog. */
ir_prog *new_ir_prog (void) {
ir_prog *res;
res = (type_method *) xmalloc (sizeof (type_method));
add_irp_type((type *) res); /* Remember the new type global. */
res->kind = k_type_method;
+
res->name = name; // do I need the name, or is the name in entity sufficient?
res->arity = arity;
res->param_type = (type **) xmalloc (sizeof (type *) * arity);
}
/* manipulate fields of type_primitive */
-/*
-char *
+const char *
get_primitive_name (type_primitive *primitive) {
assert(primitive);
return ID_TO_STR(primitive->name);
}
-*/
+
ident *
get_primitive_ident (type_primitive *primitive) {
else
return 0;
}
+
+int
+is_type_class(void *thing) {
+ if (get_kind(thing) == k_type_class) return 1;
+ else return 0;
+}
+
+int
+is_type_strct(void *thing) {
+ if (get_kind(thing) == k_type_strct) return 1;
+ else return 0;
+}
+
+int
+is_type_method(void *thing) {
+ if (get_kind(thing) == k_type_method) return 1;
+ else return 0;
+}
+
+int
+is_type_union(void *thing) {
+ if (get_kind(thing) == k_type_union) return 1;
+ else return 0;
+}
+
+int
+is_type_array(void *thing) {
+ if (get_kind(thing) == k_type_array) return 1;
+ else return 0;
+}
+
+int
+is_type_pointer(void *thing) {
+ if (get_kind(thing) == k_type_pointer) return 1;
+ else return 0;
+}
+
+int
+is_type_enumeration(void *thing) {
+ if (get_kind(thing) == k_type_enumeration) return 1;
+ else return 0;
+}
+
+int
+is_type_primitive(void *thing) {
+ if (get_kind(thing) == k_type_primitive) return 1;
+ else return 0;
+}
};
-int is_type(void *thing);
+int is_type (void *thing);
+int is_type_class (void *thing);
+int is_type_strct (void *thing);
+int is_type_method (void *thing);
+int is_type_union (void *thing);
+int is_type_array (void *thing);
+int is_type_pointer (void *thing);
+int is_type_enumeration(void *thing);
+int is_type_primitive (void *thing);
/****************************************************************************/
printf("Dumping graphs of all procedures.\n");
+
+ dump_all_ir_graphs(dump_ir_block_graph);
+ dump_all_ir_graphs(dump_type_graph);
+
+ /*
for (i = 0; i < get_irp_n_irgs(); i++) {
dump_ir_block_graph (get_irp_irg(i));
dump_type_graph(get_irp_irg(i));
}
+ */
//CS
dump_all_types();