Support statement labels in dags.

While the code is broken in places, switch.r generates code again.
This commit is contained in:
Bill Currie 2012-11-16 20:12:13 +09:00
parent 4c6381d035
commit bd5a790456
2 changed files with 10 additions and 1 deletions

View file

@ -75,6 +75,7 @@ typedef struct ex_label_s {
struct sblock_s *dest; ///< the location of this label if known
const char *name; ///< the name of this label
int used; ///< label is used as a target
struct daglabel_s *daglabel;
} ex_label_t;
typedef struct {

View file

@ -71,6 +71,8 @@ flush_daglabels (void)
op->o.tempop.daglabel = 0;
else if (op->op_type == op_value || op->op_type == op_pointer)
op->o.value->daglabel = 0;
else if (op->op_type == op_label)
op->o.label->daglabel = 0;
else
internal_error (0, "unexpected operand type");
}
@ -154,8 +156,14 @@ operand_label (operand_t *op)
label = new_label ();
label->op = op;
val->daglabel = label;
} else if (op->op_type == op_label) {
if (op->o.label->daglabel)
return op->o.label->daglabel;
label = new_label ();
label->op = op;
op->o.label->daglabel = label;
} else {
//internal_error (0, "unexpected operand type: %d", op->op_type);
internal_error (0, "unexpected operand type: %d", op->op_type);
}
return label;
}