remove VALUE_STRING

This commit is contained in:
Anthony Pesch 2017-08-03 15:38:51 -04:00
parent 648041696f
commit 7b0b47a641
4 changed files with 0 additions and 34 deletions

View File

@ -270,28 +270,6 @@ struct ir_value *ir_alloc_f64(struct ir *ir, double c) {
return v;
}
struct ir_value *ir_alloc_str(struct ir *ir, const char *format, ...) {
struct ir_value *v = ir_calloc(ir, sizeof(struct ir_value));
v->type = VALUE_STRING;
v->reg = NO_REGISTER;
/* format the string */
va_list args;
va_start(args, format);
int name_len = vsnprintf(0, 0, format, args);
int name_size = name_len + 1;
v->str = ir_calloc(ir, name_size);
va_end(args);
va_start(args, format);
vsnprintf(v->str, name_size, format, args);
va_end(args);
return v;
}
struct ir_value *ir_alloc_ptr(struct ir *ir, void *c) {
return ir_alloc_i64(ir, (uint64_t)c);
}

View File

@ -28,7 +28,6 @@ enum ir_type {
VALUE_F32,
VALUE_F64,
VALUE_V128,
VALUE_STRING,
VALUE_BLOCK,
VALUE_NUM,
};
@ -80,7 +79,6 @@ struct ir_value {
int64_t i64;
float f32;
double f64;
char *str;
struct ir_block *blk;
};
@ -235,7 +233,6 @@ struct ir_value *ir_alloc_i32(struct ir *ir, int32_t c);
struct ir_value *ir_alloc_i64(struct ir *ir, int64_t c);
struct ir_value *ir_alloc_f32(struct ir *ir, float c);
struct ir_value *ir_alloc_f64(struct ir *ir, double c);
struct ir_value *ir_alloc_str(struct ir *ir, const char *format, ...);
struct ir_value *ir_alloc_ptr(struct ir *ir, void *c);
struct ir_value *ir_alloc_block_ref(struct ir *ir, struct ir_block *block);
struct ir_local *ir_alloc_local(struct ir *ir, enum ir_type type);

View File

@ -355,9 +355,6 @@ static int ir_parse_arg(struct ir_parser *p, struct ir_instr *instr, int arg) {
uint64_t v = (uint64_t)p->val.i;
value = ir_alloc_f64(p->ir, *(double *)&v);
} break;
case VALUE_STRING: {
value = ir_alloc_str(p->ir, p->val.s);
} break;
default:
LOG_FATAL("unexpected value type");
break;

View File

@ -55,9 +55,6 @@ static void ir_write_type(struct ir_writer *w, enum ir_type type,
case VALUE_V128:
fprintf(output, "v128");
break;
case VALUE_STRING:
fprintf(output, "str");
break;
case VALUE_BLOCK:
fprintf(output, "blk");
break;
@ -106,9 +103,6 @@ static void ir_write_value(struct ir_writer *w, const struct ir_value *value,
double v = value->f64;
fprintf(output, "0x%" PRIx64, *(uint64_t *)&v);
} break;
case VALUE_STRING: {
fprintf(output, "'%s'", value->str);
} break;
case VALUE_BLOCK:
fprintf(output, "%%%d", ir_get_block_label(w, value->blk));
break;