Commit c3914363 authored by Florian Liekweg's avatar Florian Liekweg
Browse files

Added iro_InstOf operator --flo

Added exc/instanceof fields --flo

[r416]
parent 966d9403
...@@ -354,7 +354,8 @@ get_compound_ent_value(entity *ent, int pos) { ...@@ -354,7 +354,8 @@ get_compound_ent_value(entity *ent, int pos) {
} }
/* Copies the value i of the entity to current_block in current_ir_graph. */ /* Copies the value i of the entity to current_block in current_ir_graph. */
ir_node *copy_compound_ent_value(entity *ent, int pos) { ir_node *
copy_compound_ent_value(entity *ent, int pos) {
assert(ent && is_compound_entity(ent) && (ent->variability != uninitialized)); assert(ent && is_compound_entity(ent) && (ent->variability != uninitialized));
return copy_const_value(ent->values[pos+1]); return copy_const_value(ent->values[pos+1]);
} }
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
** of owner is determined. ** of owner is determined.
** ir_graph *irg; If (type == method_type) this is the corresponding irg. ** ir_graph *irg; If (type == method_type) this is the corresponding irg.
** The ir_graph constructor automatically sets this field. ** The ir_graph constructor automatically sets this field.
** If (type !- method_type) access of this field will cause ** If (type != method_type) access of this field will cause
** an assertion. ** an assertion.
*/ */
...@@ -175,7 +175,7 @@ typedef enum { ...@@ -175,7 +175,7 @@ typedef enum {
external_visible, /* The entity is visible to other external program parts, but external_visible, /* The entity is visible to other external program parts, but
it is defined here. It may not be optimized away. The entity must it is defined here. It may not be optimized away. The entity must
be static_allocated. */ be static_allocated. */
external_allocated /* The entity is defined and allocated externaly. This compilation external_allocated /* The entity is defined and allocated externally. This compilation
must not allocate memory for this entity. The entity must must not allocate memory for this entity. The entity must
be static_allocated. */ be static_allocated. */
} ent_visibility; } ent_visibility;
......
...@@ -150,7 +150,7 @@ void set_type_ident(type *tp, ident* id) { ...@@ -150,7 +150,7 @@ void set_type_ident(type *tp, ident* id) {
const char* get_type_name(type *tp) { const char* get_type_name(type *tp) {
assert(tp && tp->kind == k_type); assert(tp && tp->kind == k_type);
return id_to_str(tp->name); return (id_to_str(tp->name));
} }
int get_type_size(type *tp) { int get_type_size(type *tp) {
...@@ -263,6 +263,7 @@ type *new_type_class (ident *name) { ...@@ -263,6 +263,7 @@ type *new_type_class (ident *name) {
res->attr.ca.subtypes = NEW_ARR_F (type *, 1); res->attr.ca.subtypes = NEW_ARR_F (type *, 1);
res->attr.ca.supertypes = NEW_ARR_F (type *, 1); res->attr.ca.supertypes = NEW_ARR_F (type *, 1);
res->attr.ca.peculiarity = existent; res->attr.ca.peculiarity = existent;
res->attr.ca.dfn = 0;
return res; return res;
} }
...@@ -395,6 +396,16 @@ inline void set_class_peculiarity (type *clss, peculiarity pec) { ...@@ -395,6 +396,16 @@ inline void set_class_peculiarity (type *clss, peculiarity pec) {
clss->attr.ca.peculiarity = pec; clss->attr.ca.peculiarity = pec;
} }
void set_class_dfn (type *clss, int dfn)
{
clss->attr.ca.dfn = dfn;
}
int get_class_dfn (type *clss)
{
return (clss->attr.ca.dfn);
}
/* typecheck */ /* typecheck */
bool is_class_type(type *clss) { bool is_class_type(type *clss) {
assert(clss); assert(clss);
...@@ -607,7 +618,7 @@ bool is_union_type (type *uni) { ...@@ -607,7 +618,7 @@ bool is_union_type (type *uni) {
/* create a new type array -- set dimension sizes independently */ /* create a new type array -- set dimension sizes independently */
type *new_type_array (ident *name, int n_dimensions, type *new_type_array (ident *name, int n_dimensions,
type *element_type) { type *element_type) {
type *res; type *res;
int i; int i;
assert((element_type->type_op != type_method)); assert((element_type->type_op != type_method));
...@@ -627,6 +638,7 @@ type *new_type_array (ident *name, int n_dimensions, ...@@ -627,6 +638,7 @@ type *new_type_array (ident *name, int n_dimensions,
new_entity(res, mangle_u(name, id_from_str("elem_ent", 8)), element_type); new_entity(res, mangle_u(name, id_from_str("elem_ent", 8)), element_type);
return res; return res;
} }
inline void free_array_attrs (type *array) { inline void free_array_attrs (type *array) {
assert(array && (array->type_op == type_array)); assert(array && (array->type_op == type_array));
free(array->attr.aa.lower_bound); free(array->attr.aa.lower_bound);
......
...@@ -125,7 +125,7 @@ void set_type_ident(type *tp, ident* id); ...@@ -125,7 +125,7 @@ void set_type_ident(type *tp, ident* id);
const char* get_type_name(type *tp); const char* get_type_name(type *tp);
int get_type_size(type *tp); int get_type_size(type *tp);
/* For primitives, enumerationsm, pointer and method types the size /* For primitives, enumerations, pointer and method types the size
is always fixed. This call is legal but has no effect. */ is always fixed. This call is legal but has no effect. */
void set_type_size(type *tp, int size); void set_type_size(type *tp, int size);
...@@ -281,6 +281,10 @@ typedef enum peculiarity { ...@@ -281,6 +281,10 @@ typedef enum peculiarity {
inline peculiarity get_class_peculiarity (type *clss); inline peculiarity get_class_peculiarity (type *clss);
inline void set_class_peculiarity (type *clss, peculiarity pec); inline void set_class_peculiarity (type *clss, peculiarity pec);
/* Set and get a class' dfn */
void set_class_dfn (type*, int);
int get_class_dfn (type*);
/* typecheck */ /* typecheck */
bool is_class_type(type *clss); bool is_class_type(type *clss);
/*****/ /*****/
...@@ -429,7 +433,7 @@ void set_union_delim_nameid (type *uni, int pos, ident *id); ...@@ -429,7 +433,7 @@ void set_union_delim_nameid (type *uni, int pos, ident *id);
Entity for array elements is built automatically. Entity for array elements is built automatically.
Set dimension sizes after call to constructor with set_* routines. */ Set dimension sizes after call to constructor with set_* routines. */
type *new_type_array (ident *name, int n_dimensions, type *new_type_array (ident *name, int n_dimensions,
type *element_type); type *element_type);
/* manipulate private fields of array type */ /* manipulate private fields of array type */
int get_array_n_dimensions (type *array); int get_array_n_dimensions (type *array);
......
...@@ -26,6 +26,7 @@ typedef struct { ...@@ -26,6 +26,7 @@ typedef struct {
type **subtypes; /* direct subtypes */ type **subtypes; /* direct subtypes */
type **supertypes; /* direct supertypes */ type **supertypes; /* direct supertypes */
peculiarity peculiarity; peculiarity peculiarity;
int dfn; /* number used for 'instanceof' operator */
} cls_attr; } cls_attr;
typedef struct { typedef struct {
......
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