Commit 2faa3bd7 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

*** empty log message ***

[r84]
parent 152abac4
15.01.2001 Goetz
added set/get_SymConst_type_or_id.
added field offset to entity.
12.01.2001 Goetz
Some changes to make the lib better portable
29.12.2000 Goetz
Initialize max_node_nr in irprog.
27.12.2000 Goetz
Now outputs warning if faulty type in irdump, dump_type_info.
Explicit string termination in irdump, vcg_open.
......
# Hey, emacs, this is a -*- makefile -*-
#
# Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
# Copyright (C) 1998 - 2001 by Universitaet Karlsruhe
# All rights reserved.
# Author: Goetz Lindenmaier
#
......@@ -10,22 +10,33 @@
SUBDIRS = ir testprograms
MAKE = /usr/bin/make -k
SHELL = /bin/sh
ifeq (,($MAKE))
MAKE = /usr/bin/make -k
endif
.PHONY: default all clean realclean install depend ir testprograms
#MAKE = ${MAKE:-/usr/bin/make} # Vorschlag Uwe
#MAKE = /usr/bin/make -k
#SHELL = /bin/sh
.PHONY: default all clean realclean install depend ir testprograms
# Makes the intermediate representation and bundles it into a
# library
ir:
$(MAKE) -C ir
# Makes the library, i.e., compiles and bundles the intermediate
# representation and extracts the necessary headers into directory
# include.
lib: ir
$(MAKE) -C ir lib
all: TAGS ir testprograms
# Makes the testprograms.
testprograms:
$(MAKE) -C testprograms
lib: ir
$(MAKE) -C ir lib
# Makes everything
all: TAGS ir lib testprograms
clean:
for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
......
......@@ -10,10 +10,10 @@
# ifndef _BOOL_H_
# define _BOOL_H_
# ifndef __CPLUSPLUS
# ifndef __cplusplus
typedef unsigned char bool;
# endif
# endif /* __cplusplus */
# endif /* _BOOL_H_ */
......@@ -27,6 +27,8 @@
#define DEFAULT_TYPE_ATTRIBUTE ""
#define TYPE_EDGE_ATTR ""
#define PRINT_NODEID(X) fprintf(F, "%p", X)
/* file to dump to */
static FILE *F;
......@@ -139,7 +141,8 @@ void
dump_node (ir_node *n) {
/* dump this node */
xfprintf (F, "node: {title: \"%p\" label: \"", n);
xfprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: \"");
dump_node_opcode(n);
dump_node_mode (n);
xfprintf (F, " ");
......@@ -156,7 +159,7 @@ void
dump_ir_node (ir_node *n)
{
/* dump this node */
xfprintf (F, "node: {title: \"%p\" label: ", n);
fprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: ");
switch (n->op->code) { /* node label */
case iro_Start:
......@@ -605,7 +608,7 @@ dump_ir_block (ir_node *block, void *env) {
if (get_irn_opcode(block) == iro_Block) {
/* This is a block. So dump the vcg information to make a block. */
xfprintf(F, "graph: { title: \"%p\" label: \"", block);
xfprintf(F, "graph: { title: \""); PRINT_NODEID(block); fprintf(F, "\" label: \"");
#ifdef DEBUG_libfirm
xfprintf (F, "%ld", get_irn_node_nr(block));
#else
......
/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
** All rights reserved.
**
......
......@@ -12,14 +12,15 @@
# include "irnode.h"
/* Turns a node into a "useless" Tuple. The Tuple just forms a tuple
from several inputs. The tuples predecessors have to be
from several inputs. The predecessors of the tuple have to be
set by hand.
This is useful if a node returning a tuple is removed, but the Projs
extracting values from the tuple are not available. */
void turn_into_tuple (ir_node *node, int arity);
/* Exchanges two nodes by conserving edges leaving old (i.e., pointers)
pointing to old. */
/* Exchanges two nodes by conserving edges leaving old (i.e., pointers
pointing to old). Turns the old node into an Id. Requires that
current_ir_graph is set properly. */
inline void exchange (ir_node *old, ir_node *new);
#endif /* ifndef _IRGMOD_H_ */
......@@ -22,12 +22,14 @@
Executes pre before visiting the predecessor of a node, post after.
irg_walk uses the visited flag in irg and the nodes to determine visited
nodes. It executes inc_irg_visited(current_ir_graph) to generate a new
flag. */
flag.
The void* env can be used to pass status information between the
pre and post functions. */
void irg_walk(ir_node *node,
void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
void *env);
/* walks only over Block nodes in the graph. Has it's own visited
/* Walks only over Block nodes in the graph. Has it's own visited
flag, so that it can be interleaved with the other walker. */
void irg_block_walk(ir_node *node,
void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
......
......@@ -573,8 +573,6 @@ get_SymConst_ptrinfo (ir_node *node) {
assert ( (node->op == op_SymConst)
&& (get_SymConst_kind(node) == linkage_ptr_info));
return node->attr.i.tori.ptrinfo;
}
inline void
......@@ -584,6 +582,18 @@ set_SymConst_ptrinfo (ir_node *node, ident *ptrinfo) {
node->attr.i.tori.ptrinfo = ptrinfo;
}
inline type_or_id_p
get_SymConst_type_or_id (ir_node *node) {
assert (node->op == op_SymConst);
return &(node->attr.i.tori);
}
inline void
set_SymConst_type_or_id (ir_node *node, type_or_id_p tori) {
assert (node->op == op_SymConst);
memcpy (&(node->attr.i.tori), tori, sizeof(type_or_id));
}
inline ir_node *
get_Sel_mem (ir_node *node) {
assert (node->op == op_Sel);
......
......@@ -130,19 +130,25 @@ inline void set_Const_tarval (ir_node *node, tarval *con);
this flag. */
typedef enum {
type_tag, /* The SymConst is a type tag for the given type.
Type_or_id_p is type * */
Type_or_id_p is type *. */
size, /* The SymConst is the size of the given type.
Type_or_id_p is type * */
Type_or_id_p is type *. */
linkage_ptr_info /* The SymConst is a symbolic pointer to be filled in
by the linker. Type_or_id_p is ident * */
by the linker. Type_or_id_p is ident *. */
} symconst_kind;
typedef union type_or_id * type_or_id_p;
inline symconst_kind get_SymConst_kind (ir_node *node);
inline void set_SymConst_kind (ir_node *node, symconst_kind num);
/* Only to access SymConst of kind type_tag or size. Else assertion: */
inline type *get_SymConst_type (ir_node *node);
inline void set_SymConst_type (ir_node *node, type *type);
/* Only to access SymConst of kind linkage_ptr_info. Else assertion: */
inline ident *get_SymConst_ptrinfo (ir_node *node);
inline void set_SymConst_ptrinfo (ir_node *node, ident *ptrinfo);
/* Sets both: type and ptrinfo. Needed to treat the node independent of
its semantics: */
inline type_or_id_p get_SymConst_type_or_id (ir_node *node);
inline void set_SymConst_type_or_id (ir_node *node, type_or_id_p tori);
inline ir_node *get_Sel_mem (ir_node *node);
inline void set_Sel_mem (ir_node *node, ir_node *mem);
......
......@@ -35,6 +35,10 @@ ir_prog *new_ir_prog (void) {
strlen(GLOBAL_TYPE_NAME)));
add_irp_type((type *)res->glob_type);
#ifdef DEBUG_libfirm
res->max_node_nr = 1;
#endif
return res;
}
......@@ -111,8 +115,10 @@ void set_irp_type(int pos, type *typ) {
}
#ifdef DEBUG_libfirm
int get_irp_new_node_nr() {
assert(irp);
irp->max_node_nr = irp->max_node_nr + 1;
return irp->max_node_nr - 1;
}
#endif
......@@ -3,7 +3,7 @@
**
** Authors: Christian Schaefer
**
**
x**
*/
# include "irgraph_t.h"
......
......@@ -116,6 +116,16 @@ set_entity_type (entity *ent, type *type) {
ent->type = type;
}
inline int
get_entity_offset (entity *ent) {
return ent->offset;
}
inline void
set_entity_offset (entity *ent, int offset) {
ent->offset = offset;
}
inline ir_graph *
get_entity_irg(entity *ent) {
assert (ent);
......
......@@ -24,6 +24,23 @@
** of procedures defined in the scope of an other procedure is the
** enclosing procedure.
**
** In detail the datastructure entity has the following fields:
**
** ident *name Name of this entity as specified in the source code.
** Only unequivocal in conjuction with scope.
** 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.
** type *owner; The class this entity belongs to. In case of local
** variables the method they are defined in.
** int offset; Offset in byte for this entity. Fixed when layout
** of owner is determined.
** ir_graph *irg; If (type == method_type) this is the corresponding irg.
** The ir_graph constructor automatically sets this field.
** If (type !- method_type) access of this field will cause
** an assertion.
*/
# ifndef _ENTITY_H_
......@@ -80,6 +97,9 @@ inline void assert_legal_owner_of_ent(type *owner);
type *get_entity_type (entity *ent);
void set_entity_type (entity *ent, type *type);
int get_entity_offset (entity *ent);
void set_entity_offset (entity *ent, int offset);
/* The entity knows the corresponding irg if the entity is a method.
This allows to get from a Call to the called irg. */
ir_graph *get_entity_irg(entity *ent);
......
......@@ -45,8 +45,10 @@ struct entity {
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 */
type *owner; /* The class this entity belongs to. In case of local variables
the method they are defined in. */
type *owner; /* The class this entity belongs to. In case of local
variables the method they are defined in. */
int offset; /* Offset in byte for this entity. Fixed when layout
of owner is determined. */
/* for methods */
ir_graph *irg; /* If (type == method_type) this is the corresponding irg.
The ir_graph constructor automatically sets this field.
......
......@@ -147,6 +147,19 @@ get_class_n_supertype (type_class *clss)
return (ARR_LEN (clss->supertypes))-1;
}
int
get_class_size (type_class *clss) {
assert(clss);
return clss->size;
}
void
set_class_size (type_class *clss, int size) {
assert(clss);
clss->size = size;
}
/*******************************************************************/
/** TYPE_STRCT **/
/*******************************************************************/
......
......@@ -217,6 +217,10 @@ struct type_class {
type_class **supertypes; /* direct supertypes */
unsigned long visit; /* visited counter for walks of
the type information */
int size; /* Size of an entity of this type. This is determined
when fixing the layout of this class. Size must be
given in bytes. */
};
......@@ -248,6 +252,10 @@ int get_class_n_supertype (type_class *clss);
type_class *get_class_supertype (type_class *clss, int pos);
void set_class_supertype (type_class *clss, type_class *supertype, int pos);
int get_class_size (type_class *clss);
void set_class_size (type_class *clss, int size);
/*******************************************************************/
/** TYPE_STRCT **/
/*******************************************************************/
......
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