Commit 3d16844c authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

*** empty log message ***

[r70]
parent c133b932
...@@ -32,7 +32,7 @@ clean: ...@@ -32,7 +32,7 @@ clean:
realclean: realclean:
for i in $(SUBDIRS); do $(MAKE) -C $$i realclean; done 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') TAGFILES = $(shell find . -name '*.c' -o -name '*.h')
......
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-??.
...@@ -29,7 +29,7 @@ MEMBERS = $(DISTRIBMEMBERS) ...@@ -29,7 +29,7 @@ MEMBERS = $(DISTRIBMEMBERS)
CFILES = $(MEMBERS:.m=.c) CFILES = $(MEMBERS:.m=.c)
HFILES = $(MEMBERS:.m=.h) 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 \ 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 \ 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 set.h tune.h tv.h type.h xprintf.h xp_help.h irnode2.h
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# include "entity.h" # include "entity.h"
# include <stdlib.h> # include <stdlib.h>
# include "array.h" # include "array.h"
# include "irop.h" # include "irop_t.h"
# include "tv.h" # include "tv.h"
# include "type_or_entity.h" # include "type_or_entity.h"
# include "irgwalk.h" # include "irgwalk.h"
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
** traverse an ir graph ** traverse an ir graph
** - execute the pre function before recursion ** - execute the pre function before recursion
** - execute the post function after recursion ** - execute the post function after recursion
**
** Uses current_ir_graph (from irgraph.h)!!! Set it to the proper
** graph before starting the walker.
*/ */
......
...@@ -116,7 +116,7 @@ ir_node_print (XP_PAR1, const xprintf_info *info ATTRIBUTE((unused)), XP_PARN) ...@@ -116,7 +116,7 @@ ir_node_print (XP_PAR1, const xprintf_info *info ATTRIBUTE((unused)), XP_PARN)
return printed; return printed;
} }
XPF1 ("%I", get_irn_opname(np)); XPF1 ("%I", get_irn_opident(np));
switch (get_irn_opcode (np)) { /* node label */ switch (get_irn_opcode (np)) { /* node label */
case iro_Const: case iro_Const:
...@@ -247,8 +247,15 @@ get_irn_opcode (ir_node *node) ...@@ -247,8 +247,15 @@ get_irn_opcode (ir_node *node)
return node->op->code; return node->op->code;
} }
inline ident * inline const char *
get_irn_opname (ir_node *node) 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); assert(node);
return node->op->name; return node->op->name;
...@@ -691,11 +698,16 @@ get_Call_param_arr (ir_node *node) { ...@@ -691,11 +698,16 @@ get_Call_param_arr (ir_node *node) {
} }
inline int inline int
get_Call_arity (ir_node *node) { get_Call_n_params (ir_node *node) {
assert (node->op == op_Call); assert (node->op == op_Call);
return (get_irn_arity(node) - CALL_PARAM_OFFSET); return (get_irn_arity(node) - CALL_PARAM_OFFSET);
} }
inline int
get_Call_arity (ir_node *node) {
return get_Call_n_params(node);
}
/* inline void /* inline void
set_Call_arity (ir_node *node, ir_node *arity) { set_Call_arity (ir_node *node, ir_node *arity) {
assert (node->op == op_Call); assert (node->op == op_Call);
......
...@@ -65,7 +65,8 @@ inline void set_irn_op (ir_node *node, ir_op *op); ...@@ -65,7 +65,8 @@ inline void set_irn_op (ir_node *node, ir_op *op);
/* Get the opcode-enum of the node */ /* Get the opcode-enum of the node */
inline opcode get_irn_opcode (ir_node *node); inline opcode get_irn_opcode (ir_node *node);
/* Get the ident for a string representation of the opcode */ /* 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 void set_irn_visited (ir_node *node, unsigned long visited);
inline unsigned long get_irn_visited (ir_node *node); inline unsigned long get_irn_visited (ir_node *node);
inline void set_irn_link (ir_node *node, ir_node *link); inline void set_irn_link (ir_node *node, ir_node *link);
...@@ -168,6 +169,7 @@ inline void set_Call_mem (ir_node *node, ir_node *mem); ...@@ -168,6 +169,7 @@ inline void set_Call_mem (ir_node *node, ir_node *mem);
inline ir_node *get_Call_ptr (ir_node *node); inline ir_node *get_Call_ptr (ir_node *node);
inline void set_Call_ptr (ir_node *node, ir_node *ptr); inline void set_Call_ptr (ir_node *node, ir_node *ptr);
inline ir_node **get_Call_param_arr (ir_node *node); 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 int get_Call_arity (ir_node *node);
/* inline void set_Call_arity (ir_node *node, ir_node *arity); */ /* inline void set_Call_arity (ir_node *node, ir_node *arity); */
inline ir_node *get_Call_param (ir_node *node, int pos); inline ir_node *get_Call_param (ir_node *node, int pos);
...@@ -396,9 +398,9 @@ int is_fragile_op(ir_node *node); ...@@ -396,9 +398,9 @@ int is_fragile_op(ir_node *node);
#define DDMSG printf("%s(l.%i)\n", __FUNCTION__, __LINE__) #define DDMSG printf("%s(l.%i)\n", __FUNCTION__, __LINE__)
#define DDMSG1(X) printf("%s(l.%i) %s\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__, \ #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__, \ #define DDMSG3(X) printf("%s(l.%i) %s: %p\n", __FUNCTION__, __LINE__, \
print_firm_kind(X), (X)) print_firm_kind(X), (X))
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# include "irnode.h" # include "irnode.h"
# include "xprintf.h" # include "xprintf.h"
# include "irop_t.h"
/** ir node attributes **/ /** ir node attributes **/
/* Block attributes */ /* Block attributes */
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
** **
*/ */
# include "irop.h" # include "irop_t.h"
# include "irnode_t.h" # include "irnode_t.h"
# include "misc.h" # include "misc.h"
......
...@@ -30,12 +30,7 @@ typedef enum { ...@@ -30,12 +30,7 @@ typedef enum {
iro_Proj, iro_Tuple, iro_Id, iro_Bad iro_Proj, iro_Tuple, iro_Id, iro_Bad
} opcode; } opcode;
typedef struct { typedef struct ir_op ir_op;
opcode code;
ident *name;
size_t attr_size;
int labeled;
} ir_op;
extern ir_op *op_Block; extern ir_op *op_Block;
...@@ -85,14 +80,13 @@ extern ir_op *op_Proj; ...@@ -85,14 +80,13 @@ extern ir_op *op_Proj;
extern ir_op *op_Id; extern ir_op *op_Id;
extern ir_op *op_Bad; 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. */ /* returns the attribute size of the operator. */
int get_op_attr_size (ir_op *op); 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_ */ # endif /* _IROP_H_ */
# 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
...@@ -34,6 +34,7 @@ HFILES += common.h debug.h gmp.h host.h ident.h irgraph.h \ ...@@ -34,6 +34,7 @@ HFILES += common.h debug.h gmp.h host.h ident.h irgraph.h \
obst.h pset.h set.h tv.h xprintf.h xp_help.h entity_t.h obst.h pset.h set.h tv.h xprintf.h xp_help.h entity_t.h
DISTRIB = $(DISTRIBMEMBERS:.m=.h) DISTRIB = $(DISTRIBMEMBERS:.m=.h)
DISTRIB += type_or_entity.h
OFILES = $(MEMBERS:%.m=../objects/%.o) OFILES = $(MEMBERS:%.m=../objects/%.o)
......
...@@ -57,17 +57,11 @@ new_entity (type *owner, ident *name, type *type) ...@@ -57,17 +57,11 @@ new_entity (type *owner, ident *name, type *type)
return res; return res;
} }
#if 0 inline const char *
inline char *
get_entity_name (entity *ent) { get_entity_name (entity *ent) {
assert (ent); assert (ent);
return id_to_str(get_entity_ident(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 * ident *
get_entity_ident (entity *ent) { get_entity_ident (entity *ent) {
......
...@@ -258,6 +258,12 @@ void set_method_name (type_method *method, char *name); ...@@ -258,6 +258,12 @@ void set_method_name (type_method *method, char *name);
void set_method_ident (type_method *method, ident* ident); void set_method_ident (type_method *method, ident* ident);
*/ */
inline int
get_method_n_params (type_method *method) {
return method->arity;
}
inline int inline int
get_method_arity (type_method *method) { get_method_arity (type_method *method) {
return method->arity; return method->arity;
......
...@@ -183,8 +183,6 @@ or lowering phases. ...@@ -183,8 +183,6 @@ or lowering phases.
# include "common.h" # include "common.h"
# include "ident.h" # include "ident.h"
# include "irmode.h" # include "irmode.h"
/*CS*/
//# include "entity.h"
#ifndef _ENTITY_TYPEDEF_ #ifndef _ENTITY_TYPEDEF_
#define _ENTITY_TYPEDEF_ #define _ENTITY_TYPEDEF_
...@@ -310,6 +308,7 @@ ident *get_method_ident (type_method *method); ...@@ -310,6 +308,7 @@ ident *get_method_ident (type_method *method);
void set_method_name (type_method *method, char *name); void set_method_name (type_method *method, char *name);
void set_method_ident (type_method *method, ident* ident); */ 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 int get_method_arity (type_method *method);
/*inline void set_method_arity (type_method *method, int arity);*/ /*inline void set_method_arity (type_method *method, int arity);*/
inline type *get_method_param_type(type_method *method, int pos); inline type *get_method_param_type(type_method *method, int pos);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment