mirror of
https://github.com/danog/ir.git
synced 2024-11-26 20:34:53 +01:00
Remove IR_OPND_VAR
This commit is contained in:
parent
d3640495a2
commit
c93abd79b2
2
ir.c
2
ir.c
@ -201,7 +201,7 @@ void ir_print_const(const ir_ctx *ctx, const ir_insn *insn, FILE *f)
|
||||
#define ir_op_kind_str IR_OPND_STR
|
||||
#define ir_op_kind_num IR_OPND_NUM
|
||||
#define ir_op_kind_fld IR_OPND_STR
|
||||
#define ir_op_kind_var IR_OPND_VAR
|
||||
#define ir_op_kind_var IR_OPND_DATA
|
||||
#define ir_op_kind_prb IR_OPND_PROB
|
||||
#define ir_op_kind_opt IR_OPND_PROB
|
||||
|
||||
|
13
ir_check.c
13
ir_check.c
@ -95,8 +95,7 @@ bool ir_check(const ir_ctx *ctx)
|
||||
use_insn = &ctx->ir_base[use];
|
||||
switch (IR_OPND_KIND(flags, j)) {
|
||||
case IR_OPND_DATA:
|
||||
if (use_insn->op == IR_VAR
|
||||
|| !(ir_op_flags[use_insn->op] & IR_OP_FLAG_DATA)) {
|
||||
if (!(ir_op_flags[use_insn->op] & IR_OP_FLAG_DATA)) {
|
||||
if (!(ir_op_flags[use_insn->op] & IR_OP_FLAG_MEM)
|
||||
|| use_insn->type == IR_VOID) {
|
||||
fprintf(stderr, "ir_base[%d].ops[%d] reference (%d) must be DATA\n", i, j, use);
|
||||
@ -200,16 +199,6 @@ bool ir_check(const ir_ctx *ctx)
|
||||
ok = 0;
|
||||
}
|
||||
break;
|
||||
case IR_OPND_VAR:
|
||||
if (ctx->ir_base[use].op != IR_VAR) {
|
||||
fprintf(stderr, "ir_base[%d].ops[%d] reference (%d) must be VAR\n", i, j, use);
|
||||
ok = 0;
|
||||
}
|
||||
if (use >= i) {
|
||||
fprintf(stderr, "ir_base[%d].ops[%d] invalid forward reference (%d)\n", i, j, use);
|
||||
ok = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "ir_base[%d].ops[%d] reference (%d) of unsupported kind\n", i, j, use);
|
||||
ok = 0;
|
||||
|
@ -105,7 +105,6 @@ void ir_dump_dot(const ir_ctx *ctx, FILE *f)
|
||||
if (ref) {
|
||||
switch (IR_OPND_KIND(flags, j)) {
|
||||
case IR_OPND_DATA:
|
||||
case IR_OPND_VAR:
|
||||
if (IR_IS_CONST_REF(ref)) {
|
||||
fprintf(f, "\tc%d -> n%d [color=blue,weight=%d];\n", -ref, i, DATA_WEIGHT);
|
||||
} else if (insn->op == IR_PHI
|
||||
|
@ -801,10 +801,9 @@ IR_ALWAYS_INLINE bool ir_const_is_true(const ir_insn *v)
|
||||
#define IR_OPND_CONTROL 0x2
|
||||
#define IR_OPND_CONTROL_DEP 0x3
|
||||
#define IR_OPND_CONTROL_REF 0x4
|
||||
#define IR_OPND_VAR 0x5
|
||||
#define IR_OPND_STR 0x6
|
||||
#define IR_OPND_NUM 0x7
|
||||
#define IR_OPND_PROB 0x8
|
||||
#define IR_OPND_STR 0x5
|
||||
#define IR_OPND_NUM 0x6
|
||||
#define IR_OPND_PROB 0x7
|
||||
|
||||
#define IR_OP_FLAGS(op_flags, op1_flags, op2_flags, op3_flags) \
|
||||
((op_flags) | ((op1_flags) << 20) | ((op2_flags) << 24) | ((op3_flags) << 28))
|
||||
@ -818,7 +817,7 @@ IR_ALWAYS_INLINE bool ir_const_is_true(const ir_insn *v)
|
||||
(((flags) >> (16 + (4 * (((i) > 3) ? 3 : (i))))) & 0xf)
|
||||
|
||||
#define IR_IS_REF_OPND_KIND(kind) \
|
||||
((kind) >= IR_OPND_DATA && (kind) <= IR_OPND_VAR)
|
||||
((kind) >= IR_OPND_DATA && (kind) <= IR_OPND_CONTROL_REF)
|
||||
|
||||
IR_ALWAYS_INLINE ir_ref ir_operands_count(const ir_ctx *ctx, const ir_insn *insn)
|
||||
{
|
||||
|
@ -70,7 +70,6 @@ void ir_save(const ir_ctx *ctx, FILE *f)
|
||||
if (ref) {
|
||||
switch (opnd_kind) {
|
||||
case IR_OPND_DATA:
|
||||
case IR_OPND_VAR:
|
||||
if (IR_IS_CONST_REF(ref)) {
|
||||
fprintf(f, "%sc_%d", first ? "(" : ", ", -ref);
|
||||
} else {
|
||||
|
@ -737,21 +737,21 @@ int ir_sccp(ir_ctx *ctx)
|
||||
_values[i+j+1].optx = IR_BOTTOM; /* keep the tail of a long multislot instruction */
|
||||
}
|
||||
for (j = 2, p = insn->ops + j; j <= n; j++, p++) {
|
||||
IR_ASSERT(IR_OPND_KIND(flags, j) == IR_OPND_DATA || IR_OPND_KIND(flags, j) == IR_OPND_VAR);
|
||||
IR_ASSERT(IR_OPND_KIND(flags, j) == IR_OPND_DATA);
|
||||
use = *p;
|
||||
if (use > 0 && UNEXPECTED(_values[use].optx == IR_TOP)) {
|
||||
ir_bitqueue_add(&worklist, use);
|
||||
}
|
||||
}
|
||||
} else if (n >= 2) {
|
||||
IR_ASSERT(IR_OPND_KIND(flags, 2) == IR_OPND_DATA || IR_OPND_KIND(flags, 2) == IR_OPND_VAR);
|
||||
IR_ASSERT(IR_OPND_KIND(flags, 2) == IR_OPND_DATA);
|
||||
use = insn->op2;
|
||||
if (use > 0 && UNEXPECTED(_values[use].optx == IR_TOP)) {
|
||||
ir_bitqueue_add(&worklist, use);
|
||||
}
|
||||
if (n > 2) {
|
||||
IR_ASSERT(n == 3);
|
||||
IR_ASSERT(IR_OPND_KIND(flags, 3) == IR_OPND_DATA || IR_OPND_KIND(flags, 3) == IR_OPND_VAR);
|
||||
IR_ASSERT(IR_OPND_KIND(flags, 3) == IR_OPND_DATA);
|
||||
use = insn->op3;
|
||||
if (use > 0 && UNEXPECTED(_values[use].optx == IR_TOP)) {
|
||||
ir_bitqueue_add(&worklist, use);
|
||||
|
Loading…
Reference in New Issue
Block a user