summaryrefslogtreecommitdiffhomepage
path: root/ir/tr
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-01-31 09:48:26 +0100
committerMatthias Braun <matze@braunis.de>2016-02-01 02:29:11 +0100
commitac88d96aa83ecaa3590906db9ebb169b37578d06 (patch)
tree0160c023c1b7ea4f4df1e46b5c7a99073f3bdc97 /ir/tr
parenta80f85566624b9516344239cba28f0eb7c86e8b7 (diff)
bejit: Introduce brand new jit infrastructure
Diffstat (limited to 'ir/tr')
-rw-r--r--ir/tr/entity.c13
-rw-r--r--ir/tr/entity_t.h42
2 files changed, 39 insertions, 16 deletions
diff --git a/ir/tr/entity.c b/ir/tr/entity.c
index 2814053..058139a 100644
--- a/ir/tr/entity.c
+++ b/ir/tr/entity.c
@@ -64,7 +64,8 @@ static ir_entity *new_entity_vis(ir_type *owner, ident *name, ir_type *type,
if (is_Method_type(type)) {
res = intern_new_entity(owner, IR_ENTITY_METHOD, name, type, vis);
res->linkage = IR_LINKAGE_CONSTANT;
- res->attr.mtd_attr.properties = get_method_additional_properties(type);
+ res->attr.global.jit_addr = (void*)-1;
+ res->attr.global.properties = get_method_additional_properties(type);
res->attr.mtd_attr.vtable_number = IR_VTABLE_NUM_NOT_SET;
res->attr.mtd_attr.param_access = NULL;
res->attr.mtd_attr.param_weight = NULL;
@@ -75,6 +76,7 @@ static ir_entity *new_entity_vis(ir_type *owner, ident *name, ir_type *type,
res->attr.compound_member.offset = -1;
} else {
res = intern_new_entity(owner, IR_ENTITY_NORMAL, name, type, vis);
+ res->attr.global.jit_addr = (void*)-1;
}
hook_new_entity(res);
@@ -123,7 +125,8 @@ ir_entity *new_alias_entity(ir_type *owner, ident *name, ir_entity *aliased,
{
ir_entity *res = intern_new_entity(owner, IR_ENTITY_ALIAS, name, type,
visibility);
- res->attr.alias.aliased = aliased;
+ res->attr.alias.base.jit_addr = (void*)-1;
+ res->attr.alias.aliased = aliased;
hook_new_entity(res);
return res;
}
@@ -822,7 +825,7 @@ int entity_has_additional_properties(const ir_entity *entity)
mtp_additional_properties get_entity_additional_properties(const ir_entity *ent)
{
assert(entity_has_additional_properties(ent));
- return ent->attr.properties;
+ return ent->attr.global.properties;
}
void set_entity_additional_properties(ir_entity *ent,
@@ -834,7 +837,7 @@ void set_entity_additional_properties(ir_entity *ent,
/* do not allow to set the mtp_property_inherited flag or
* the automatic inheritance of flags will not work */
- ent->attr.properties = property_mask;
+ ent->attr.global.properties = property_mask;
}
void add_entity_additional_properties(ir_entity *ent,
@@ -844,7 +847,7 @@ void add_entity_additional_properties(ir_entity *ent,
/* do not allow to set the mtp_property_inherited flag or
* the automatic inheritance of flags will not work */
- ent->attr.properties |= properties;
+ ent->attr.global.properties |= properties;
}
dbg_info *(get_entity_dbg_info)(const ir_entity *ent)
diff --git a/ir/tr/entity_t.h b/ir/tr/entity_t.h
index 792f29b..04fd4d9 100644
--- a/ir/tr/entity_t.h
+++ b/ir/tr/entity_t.h
@@ -16,9 +16,10 @@
#include <stdint.h>
#include "compiler.h"
-#include "typerep.h"
-#include "type_t.h"
#include "ident.h"
+#include "panic.h"
+#include "type_t.h"
+#include "typerep.h"
#define get_entity_name(ent) _get_entity_name(ent)
#define get_entity_ident(ent) _get_entity_ident(ent)
@@ -94,15 +95,20 @@ union ir_initializer_t {
ir_initializer_tarval_t tarval;
};
+typedef struct global_ent_attr {
+ void const *jit_addr;
+ /**< Additional graph properties for methods+alias */
+ mtp_additional_properties properties;
+} global_ent_attr;
+
typedef struct normal_ent_attr {
+ global_ent_attr base;
ir_initializer_t *initializer; /**< entity initializer */
} normal_ent_attr;
/** The attributes for methods. */
typedef struct method_ent_attr {
- mtp_additional_properties properties; /**< Additional graph properties can
- be stored in a entity if no irg
- is available. Must be first. */
+ global_ent_attr base;
ir_graph *irg; /**< The corresponding irg if known.
The ir_graph constructor automatically sets this field. */
@@ -141,10 +147,8 @@ typedef struct parameter_ent_attr {
} parameter_ent_attr;
typedef struct alias_ent_attr {
- mtp_additional_properties properties; /**< Additional graph properties can
- be stored in a entity if no irg
- is available. Must be first. */
- ir_entity *aliased;
+ global_ent_attr base;
+ ir_entity *aliased;
} alias_ent_attr;
typedef enum ir_entity_kind {
@@ -199,8 +203,8 @@ struct ir_entity {
parameter_ent_attr parameter;
/** alias attributes */
alias_ent_attr alias;
- /** additional properties shared by method+alias entities */
- mtp_additional_properties properties;
+ /** properties shared by global entities */
+ global_ent_attr global;
} attr; /**< type specific attributes */
};
@@ -452,4 +456,20 @@ static inline void _set_entity_dbg_info(ir_entity *ent, dbg_info *db)
ent->dbi = db;
}
+static inline bool is_global_entity(ir_entity const *const entity)
+{
+ switch (entity->entity_kind) {
+ case IR_ENTITY_ALIAS:
+ case IR_ENTITY_METHOD:
+ case IR_ENTITY_NORMAL:
+ return true;
+ case IR_ENTITY_COMPOUND_MEMBER:
+ case IR_ENTITY_LABEL:
+ case IR_ENTITY_PARAMETER:
+ case IR_ENTITY_UNKNOWN:
+ return false;
+ }
+ panic("Invalid entity");
+}
+
#endif