realclean:
for i in $(SUBDIRS); do $(MAKE) -C $$i realclean; done
- rm -f libfirm.a core include/*.h
+ rm -f libfirm.a core include/*.h TAGS
TAGFILES = $(shell find . -name '*.c' -o -name '*.h')
--- /dev/null
+
+This is a library implementing the intermediate representation
+FIRM developed at IPD Goos, Uni Karlsruhe.
+
+Call make lib to construct the library. This creates a file
+libfirm.a and extracts all necessary header files to ./include.
+
+To test the library goto ./testprograms and make and run the
+test examples placed there:
+
+make lib
+cd testprograms
+make
+make run
+
+For more documentation see /include/firm.h.
+To generate FIRM code from a compiler frontend read the documentation
+in ./include/ircons.h.
+About Firm you can learn in UKA tech-report 1999-??.
CFILES = $(MEMBERS:.m=.c)
HFILES = $(MEMBERS:.m=.h)
-HFILES += irnode_t.h irgraph_t.h
+HFILES += irnode_t.h irgraph_t.h ir_op_t.h
HFILES += array.h common.h cookies.h debug.h entity.h gmp.h \
host.h ident.h label.h misc.h obst.h pdeq.h pset.h \
set.h tune.h tv.h type.h xprintf.h xp_help.h irnode2.h
# include "entity.h"
# include <stdlib.h>
# include "array.h"
-# include "irop.h"
+# include "irop_t.h"
# include "tv.h"
# include "type_or_entity.h"
# include "irgwalk.h"
** traverse an ir graph
** - execute the pre function before recursion
** - execute the post function after recursion
+**
+** Uses current_ir_graph (from irgraph.h)!!! Set it to the proper
+** graph before starting the walker.
*/
return printed;
}
- XPF1 ("%I", get_irn_opname(np));
+ XPF1 ("%I", get_irn_opident(np));
switch (get_irn_opcode (np)) { /* node label */
case iro_Const:
return node->op->code;
}
-inline ident *
+inline const char *
get_irn_opname (ir_node *node)
+{
+ assert(node);
+ return id_to_str(node->op->name);
+}
+
+inline ident *
+get_irn_opident (ir_node *node)
{
assert(node);
return node->op->name;
}
inline int
-get_Call_arity (ir_node *node) {
+get_Call_n_params (ir_node *node) {
assert (node->op == op_Call);
return (get_irn_arity(node) - CALL_PARAM_OFFSET);
}
+inline int
+get_Call_arity (ir_node *node) {
+ return get_Call_n_params(node);
+}
+
/* inline void
set_Call_arity (ir_node *node, ir_node *arity) {
assert (node->op == op_Call);
/* Get the opcode-enum of the node */
inline opcode get_irn_opcode (ir_node *node);
/* Get the ident for a string representation of the opcode */
-inline ident *get_irn_opname (ir_node *node);
+inline const char *get_irn_opname (ir_node *node);
+inline ident *get_irn_opident (ir_node *node);
inline void set_irn_visited (ir_node *node, unsigned long visited);
inline unsigned long get_irn_visited (ir_node *node);
inline void set_irn_link (ir_node *node, ir_node *link);
inline ir_node *get_Call_ptr (ir_node *node);
inline void set_Call_ptr (ir_node *node, ir_node *ptr);
inline ir_node **get_Call_param_arr (ir_node *node);
+inline int get_Call_n_params (ir_node *node);
inline int get_Call_arity (ir_node *node);
/* inline void set_Call_arity (ir_node *node, ir_node *arity); */
inline ir_node *get_Call_param (ir_node *node, int pos);
#define DDMSG printf("%s(l.%i)\n", __FUNCTION__, __LINE__)
#define DDMSG1(X) printf("%s(l.%i) %s\n", __FUNCTION__, __LINE__, \
- id_to_str(get_irn_opname(X)))
+ id_to_str(get_irn_opident(X)))
#define DDMSG2(X) printf("%s(l.%i) %s: %ld\n", __FUNCTION__, __LINE__, \
- id_to_str(get_irn_opname(X)), get_irn_node_nr(X))
+ id_to_str(get_irn_opident(X)), get_irn_node_nr(X))
#define DDMSG3(X) printf("%s(l.%i) %s: %p\n", __FUNCTION__, __LINE__, \
print_firm_kind(X), (X))
# include "irnode.h"
# include "xprintf.h"
+# include "irop_t.h"
/** ir node attributes **/
/* Block attributes */
**
*/
-# include "irop.h"
+# include "irop_t.h"
# include "irnode_t.h"
# include "misc.h"
iro_Proj, iro_Tuple, iro_Id, iro_Bad
} opcode;
-typedef struct {
- opcode code;
- ident *name;
- size_t attr_size;
- int labeled;
-} ir_op;
+typedef struct ir_op ir_op;
extern ir_op *op_Block;
extern ir_op *op_Id;
extern ir_op *op_Bad;
-/* create a new ir operation */
-ir_op * new_ir_op (opcode code, ident *name, size_t attr_size, int labeled);
-
-/* initialize the irop module */
-void init_op (void);
/* returns the attribute size of the operator. */
int get_op_attr_size (ir_op *op);
+/* Returns the string for the opcode. */
+const char* get_op_name (ir_op *op);
+
+
# endif /* _IROP_H_ */
--- /dev/null
+
+# ifndef _IROP_T_H_
+# define _IROP_T_H_
+
+# include "irop.h"
+
+struct ir_op {
+ opcode code;
+ ident *name;
+ size_t attr_size;
+ int labeled;
+};
+
+/* create a new ir operation */
+ir_op * new_ir_op (opcode code, ident *name, size_t attr_size, int labeled);
+
+/* initialize the irop module */
+void init_op (void);
+
+#endif
obst.h pset.h set.h tv.h xprintf.h xp_help.h entity_t.h
DISTRIB = $(DISTRIBMEMBERS:.m=.h)
+DISTRIB += type_or_entity.h
OFILES = $(MEMBERS:%.m=../objects/%.o)
return res;
}
-#if 0
-inline char *
+inline const char *
get_entity_name (entity *ent) {
assert (ent);
return id_to_str(get_entity_ident(ent));
- /* GL:
- entity.c:52: warning: return discards `const' from pointer target type
- -- ned so guud
- */
}
-#endif
ident *
get_entity_ident (entity *ent) {
void set_method_ident (type_method *method, ident* ident);
*/
+
+inline int
+get_method_n_params (type_method *method) {
+ return method->arity;
+}
+
inline int
get_method_arity (type_method *method) {
return method->arity;
# include "common.h"
# include "ident.h"
# include "irmode.h"
-/*CS*/
-//# include "entity.h"
#ifndef _ENTITY_TYPEDEF_
#define _ENTITY_TYPEDEF_
void set_method_name (type_method *method, char *name);
void set_method_ident (type_method *method, ident* ident); */
+inline int get_method_n_params (type_method *method);
inline int get_method_arity (type_method *method);
/*inline void set_method_arity (type_method *method, int arity);*/
inline type *get_method_param_type(type_method *method, int pos);