Exemple #1
0
ir_op *new_ir_op(unsigned code, const char *name, op_pin_state p,
                 irop_flags flags, op_arity opar, int op_index,
                 size_t attr_size)
{
	ir_op *res = XMALLOCZ(ir_op);

	res->code      = code;
	res->name      = new_id_from_chars(name, strlen(name));
	res->pin_state = p;
	res->attr_size = attr_size;
	res->flags     = flags;
	res->opar      = opar;
	res->op_index  = op_index;
	res->tag       = 0;

	memset(&res->ops, 0, sizeof(res->ops));
	res->ops.hash            = default_hash_node;
	res->ops.copy_attr       = default_copy_attr;
	res->ops.get_type_attr   = default_get_type_attr;
	res->ops.get_entity_attr = default_get_entity_attr;

	size_t len = ARR_LEN(opcodes);
	if ((size_t)code >= len) {
		ARR_RESIZE(ir_op*, opcodes, (size_t)code+1);
		memset(&opcodes[len], 0, (code-len+1) * sizeof(opcodes[0]));
	}
Exemple #2
0
static ident *new_ident_from_obst(struct obstack *const obst)
{
	size_t const len    = obstack_object_size(obst);
	char  *const string = (char*)obstack_finish(obst);
	ident *const res    = new_id_from_chars(string, len);
	obstack_free(obst, string);
	return res;
}
Exemple #3
0
static void add_pointer_in_jcr_segment(ir_entity *entity)
{
	if (!create_jcr_segment)
		return;

	ir_type   *segment = get_segment_type(IR_SEGMENT_JCR);
	ident     *id  = id_unique("jcr_ptr");
	ir_entity *ptr = new_entity(segment, id, type_reference);
	ir_graph  *irg = get_const_code_irg();
	ir_node   *val = new_r_Address(irg, entity);

	set_entity_ld_ident(ptr, new_id_from_chars("", 0));
	set_entity_visibility(ptr, ir_visibility_private);
	set_entity_linkage(ptr, IR_LINKAGE_CONSTANT|IR_LINKAGE_HIDDEN_USER);
	set_entity_alignment(ptr, 1);
	ir_initializer_t *const init = create_initializer_const(val);
	set_entity_initializer(ptr, init);
}
Exemple #4
0
ident *new_id_from_str(const char *str)
{
	return new_id_from_chars(str, strlen(str));
}