Beispiel #1
0
static ir_type *create_utf8_const_type(void)
{
	ir_type *type_byte           = get_type_for_mode(mode_Bu);
	ir_type *type_var_char_array = new_type_array(type_byte, 0);

	ident *id = new_id_from_str("utf8_const");
	ir_type *type = new_type_struct(id);
	add_compound_member(type, "hash", type_ushort);
	add_compound_member(type, "len", type_ushort);
	add_compound_member(type, "data", type_var_char_array);
	default_layout_compound_type(type);
	return type;
}
Beispiel #2
0
void gcji_create_array_type(void)
{
	ident *id = new_id_from_str("array");
	type_jarray = new_type_class(id);
	assert(type_java_lang_object != NULL);
	add_class_supertype(type_jarray, type_java_lang_object);
	add_compound_member(type_jarray, superobject_ident, type_java_lang_object);
	ident *length_id = new_id_from_str("length");
	gcj_array_length = add_compound_member(type_jarray, length_id, type_int);

	default_layout_compound_type(type_jarray);
	array_header_size      = get_type_size(type_jarray);
	array_header_end_align = get_type_alignment(type_int);
}
Beispiel #3
0
static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind,
                                    ident *name, ir_type *type, dbg_info *dbgi)
{
	assert(owner != NULL);

	ir_entity *res = XMALLOCZ(ir_entity);
	res->kind    = k_entity;
	res->name    = name;
	res->ld_name = NULL;
	res->type    = type;
	res->owner   = owner;

	res->entity_kind          = kind;
	res->volatility           = volatility_non_volatile;
	res->aligned              = align_is_aligned;
	res->usage                = ir_usage_unknown;
	res->compiler_gen         = 0;
	res->visibility           = ir_visibility_external;
	res->offset               = -1;
	res->offset_bit_remainder = 0;
	res->alignment            = 0;
	res->link                 = NULL;
#ifdef DEBUG_libfirm
	res->nr = get_irp_new_node_nr();
#endif

	/* Remember entity in its owner. */
	if (is_compound_type(owner))
		add_compound_member(owner, res);

	res->visit = 0;
	set_entity_dbg_info(res, dbgi);

	return res;
}
Beispiel #4
0
void set_entity_owner(ir_entity *ent, ir_type *owner)
{
	assert(is_entity(ent));
	assert(is_compound_type(owner));

	remove_compound_member(ent->owner, ent);
	add_compound_member(owner, ent);
	ent->owner = owner;
}
Beispiel #5
0
ir_entity *copy_entity_name(ir_entity *old, ident *new_name)
{
	assert(old->kind == k_entity);
	if (old->name == new_name)
		return old;

	ir_entity *newe = deep_entity_copy(old);
	newe->name    = new_name;
	newe->ld_name = NULL;
	add_compound_member(old->owner, newe);

	return newe;
}
Beispiel #6
0
ir_entity *copy_entity_own(ir_entity *old, ir_type *new_owner)
{
	assert(is_entity(old));
	assert(is_compound_type(new_owner));
	assert(get_type_state(new_owner) != layout_fixed);
	if (old->owner == new_owner)
		return old;

	/* create a deep copy so we are safe of aliasing and double-freeing. */
	ir_entity *newe = deep_entity_copy(old);
	newe->owner = new_owner;
	add_compound_member(new_owner, newe);

	return newe;
}
Beispiel #7
0
static ir_type *create_method_desc_type(void)
{
	ir_type *type = new_type_struct(new_id_from_str("method_desc"));
	add_compound_member(type, "name", type_reference);
	add_compound_member(type, "sig", type_reference);
	add_compound_member(type, "accflags", type_ushort);
	add_compound_member(type, "index", type_ushort);
	add_compound_member(type, "ncode", type_reference);
	add_compound_member(type, "throws", type_reference);
	default_layout_compound_type(type);
	return type;
}
Beispiel #8
0
static ir_type *create_field_desc_type(void)
{
	ir_type *type_offs_addr = new_type_union(new_id_from_str("offset/address"));
	add_compound_member(type_offs_addr, "boffset", type_int);
	add_compound_member(type_offs_addr, "addr", type_reference);
	default_layout_compound_type(type_offs_addr);

	ir_type *type = new_type_struct(new_id_from_str("field_desc"));
	add_compound_member(type, "name", type_reference);
	add_compound_member(type, "type", type_reference);
	add_compound_member(type, "accflags", type_ushort);
	add_compound_member(type, "bsize", type_ushort);
	add_compound_member(type, "boffset/address", type_offs_addr);
	default_layout_compound_type(type);
	return type;
}
Beispiel #9
0
void gcji_add_java_lang_class_fields(ir_type *type)
{
	assert(type == type_java_lang_class);
	ir_type *ref_java_lang_class = new_type_pointer(type_java_lang_class);
	add_compound_member(type, "next_or_version", ref_java_lang_class);
	add_compound_member(type, "name", type_reference);
	add_compound_member(type, "accflags", type_ushort);
	add_compound_member(type, "superclass", ref_java_lang_class);
	add_compound_member(type, "constants.size", type_int);
	add_compound_member(type, "constants.tags", type_reference);
	add_compound_member(type, "constants.data", type_reference);
	add_compound_member(type, "methods", type_reference);
	add_compound_member(type, "method_count", type_short);
	add_compound_member(type, "vtable_method_count", type_short);
	add_compound_member(type, "fields", type_reference);
	add_compound_member(type, "size_in_bytes", type_int);
	add_compound_member(type, "field_count", type_short);
	add_compound_member(type, "static_field_count", type_short);
	add_compound_member(type, "vtable", type_reference);
	add_compound_member(type, "otable", type_reference);
	add_compound_member(type, "otable_syms", type_reference);
	add_compound_member(type, "atable", type_reference);
	add_compound_member(type, "atable_syms", type_reference);
	add_compound_member(type, "itable", type_reference);
	add_compound_member(type, "itable_syms", type_reference);
	add_compound_member(type, "catch_classes", type_reference);
	add_compound_member(type, "interfaces", type_reference);
	add_compound_member(type, "loader", type_reference);
	add_compound_member(type, "interface_count", type_short);
	add_compound_member(type, "state", type_byte);
	add_compound_member(type, "thread", type_reference);
	add_compound_member(type, "depth", type_short);
	add_compound_member(type, "ancestors", type_reference);
	add_compound_member(type, "idt", type_reference);
	add_compound_member(type, "arrayclass", type_reference);
	add_compound_member(type, "protectionDomain", type_reference);
	add_compound_member(type, "assertion_table", type_reference);
	add_compound_member(type, "hack_signers", type_reference);
	add_compound_member(type, "chain", type_reference);
	add_compound_member(type, "aux_info", type_reference);
	add_compound_member(type, "engine", type_reference);
	add_compound_member(type, "reflection_data", type_reference);
}