int yasm_value_finalize_expr(yasm_value *value, yasm_expr *e, yasm_bytecode *precbc, unsigned int size) { if (!e) { yasm_value_initialize(value, NULL, size); return 0; } yasm_value_initialize(value, e, size); return yasm_value_finalize(value, precbc); }
static yasm_effaddr * lc3b_ea_create_expr(yasm_arch *arch, yasm_expr *e) { yasm_effaddr *ea = yasm_xmalloc(sizeof(yasm_effaddr)); yasm_value_initialize(&ea->disp, e, 0); ea->need_nonzero_len = 0; ea->need_disp = 1; ea->nosplit = 0; ea->strong = 0; ea->segreg = 0; ea->pc_rel = 0; ea->not_pc_rel = 0; return ea; }
int yasm_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data) { int retval = 0; bc->len = 0; if (!bc->callback) yasm_internal_error(N_("got empty bytecode in yasm_bc_calc_len")); else retval = bc->callback->calc_len(bc, add_span, add_span_data); /* Check for multiples */ bc->mult_int = 1; if (bc->multiple) { /*@dependent@*/ /*@null@*/ const yasm_intnum *num; num = yasm_expr_get_intnum(&bc->multiple, 0); if (num) { if (yasm_intnum_sign(num) < 0) { yasm_error_set(YASM_ERROR_VALUE, N_("multiple is negative")); retval = -1; } else bc->mult_int = yasm_intnum_get_int(num); } else { if (yasm_expr__contains(bc->multiple, YASM_EXPR_FLOAT)) { yasm_error_set(YASM_ERROR_VALUE, N_("expression must not contain floating point value")); retval = -1; } else { yasm_value value; yasm_value_initialize(&value, bc->multiple, 0); add_span(add_span_data, bc, 0, &value, 0, 0); bc->mult_int = 0; /* assume 0 to start */ } } } /* If we got an error somewhere along the line, clear out any calc len */ if (retval < 0) bc->len = 0; return retval; }