mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 03:50:36 +00:00
Same style fixups for ir_instr
This commit is contained in:
parent
38532ceb11
commit
be620ff431
1 changed files with 36 additions and 36 deletions
72
ir.c
72
ir.c
|
@ -82,7 +82,7 @@ ir_value* ir_builder_get_global(ir_builder *self, const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ir_value* ir_builder_create_global(ir_builder *self, const char *name, ir_type_t vtype)
|
ir_value* ir_builder_create_global(ir_builder *self, const char *name, int vtype)
|
||||||
{
|
{
|
||||||
ir_value *ve = ir_builder_get_global(self, name);
|
ir_value *ve = ir_builder_get_global(self, name);
|
||||||
if (ve) {
|
if (ve) {
|
||||||
|
@ -247,48 +247,48 @@ void ir_block_set_label(ir_block *self, const char *name)
|
||||||
*IR Instructions
|
*IR Instructions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ir_instr* ir_instr_new(ir_block* owner, ir_op_t op)
|
ir_instr* ir_instr_new(ir_block* owner, int op)
|
||||||
{
|
{
|
||||||
ir_instr *self;
|
ir_instr *self;
|
||||||
self = (ir_instr*)malloc(sizeof(*self));
|
self = (ir_instr*)mem_a(sizeof(*self));
|
||||||
self->owner = owner;
|
self->owner = owner;
|
||||||
self->context.file = "<@no context>";
|
self->context.file = "<@no context>";
|
||||||
self->context.line = 0;
|
self->context.line = 0;
|
||||||
self->opcode = op;
|
self->opcode = op;
|
||||||
self->_ops[0] = NULL;
|
self->_ops[0] = NULL;
|
||||||
self->_ops[1] = NULL;
|
self->_ops[1] = NULL;
|
||||||
self->_ops[2] = NULL;
|
self->_ops[2] = NULL;
|
||||||
self->bops[0] = NULL;
|
self->bops[0] = NULL;
|
||||||
self->bops[1] = NULL;
|
self->bops[1] = NULL;
|
||||||
VEC_INIT(self, phi);
|
MEM_VECTOR_INIT(self, phi);
|
||||||
|
|
||||||
self->eid = 0;
|
self->eid = 0;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
MAKE_VEC_ADD(ir_instr, ir_phi_entry_t, phi)
|
MEM_VECTOR_FUNCTIONS(ir_instr, ir_phi_entry_t, phi)
|
||||||
|
|
||||||
void ir_instr_delete(ir_instr *self)
|
void ir_instr_delete(ir_instr *self)
|
||||||
{
|
{
|
||||||
ir_instr_op(self, 0, NULL, ifalse);
|
ir_instr_op(self, 0, NULL, ifalse);
|
||||||
ir_instr_op(self, 1, NULL, ifalse);
|
ir_instr_op(self, 1, NULL, ifalse);
|
||||||
ir_instr_op(self, 2, NULL, ifalse);
|
ir_instr_op(self, 2, NULL, ifalse);
|
||||||
VEC_CLEAR(self, phi);
|
MEM_VECTOR_CLEAR(self, phi);
|
||||||
free(self);
|
mem_d(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ir_instr_op(ir_instr *self, int op, ir_value *v, ir_bool writing)
|
void ir_instr_op(ir_instr *self, int op, ir_value *v, qbool writing)
|
||||||
{
|
{
|
||||||
if (self->_ops[op]) {
|
if (self->_ops[op]) {
|
||||||
if (writing)
|
if (writing)
|
||||||
ir_value_writes_add(self->_ops[op], self);
|
ir_value_writes_add(self->_ops[op], self);
|
||||||
else
|
else
|
||||||
ir_value_reads_add(self->_ops[op], self);
|
ir_value_reads_add(self->_ops[op], self);
|
||||||
}
|
}
|
||||||
if (v) {
|
if (v) {
|
||||||
if (writing)
|
if (writing)
|
||||||
ir_value_writes_add(v, self);
|
ir_value_writes_add(v, self);
|
||||||
else
|
else
|
||||||
ir_value_reads_add(v, self);
|
ir_value_reads_add(v, self);
|
||||||
}
|
}
|
||||||
self->_ops[op] = v;
|
self->_ops[op] = v;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue