[Ups-cvs] ups/ups ci_compile_expr.c,1.6,1.7 xc_machine.h,1.5,1.6
Brought to you by:
ianedwards
From: Tom H. <th...@us...> - 2006-06-22 09:03:58
|
Update of /cvsroot/ups/ups/ups In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19622 Modified Files: ci_compile_expr.c xc_machine.h Log Message: Treat LONG as meaning a 32 bit type in the C expression evaluator even on 64 bit systems and map incoming variable types to LONG or LONG_LONG as appropriate to their size. Index: ci_compile_expr.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ci_compile_expr.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ci_compile_expr.c 21 Jun 2006 16:25:27 -0000 1.6 --- ci_compile_expr.c 22 Jun 2006 09:03:51 -0000 1.7 *************** *** 71,76 **** optype_t op, expr_context_t context)); ! static int opcode_offset PROTO((typecode_t typecode)); ! static void code_deref PROTO((text_t *tx, typecode_t typecode, addrtype_t addrtype)); static opcode_t operator_to_opcode PROTO((text_t *tx, optype_t op, type_t *ltype, type_t *rtype)); static bool is_aggregate PROTO((type_t *type)); --- 71,76 ---- optype_t op, expr_context_t context)); ! static int opcode_offset PROTO((typecode_t typecode, long typesize)); ! static void code_deref PROTO((text_t *tx, typecode_t typecode, long typesize, addrtype_t addrtype)); static opcode_t operator_to_opcode PROTO((text_t *tx, optype_t op, type_t *ltype, type_t *rtype)); static bool is_aggregate PROTO((type_t *type)); *************** *** 575,580 **** static int ! opcode_offset(typecode) typecode_t typecode; { switch (ci_effective_typecode(typecode)) { --- 575,581 ---- static int ! opcode_offset(typecode, typesize) typecode_t typecode; + long typesize; { switch (ci_effective_typecode(typecode)) { *************** *** 592,596 **** case TY_BOOLEAN: case DT_PTR_TO: ! return LONG_FORM_OFFSET; case TY_FLOAT: return FLOAT_FORM_OFFSET; --- 593,605 ---- case TY_BOOLEAN: case DT_PTR_TO: ! switch (typesize) { ! case 4: ! return LONG_FORM_OFFSET; ! case 8: ! return LONGLONG_FORM_OFFSET; ! default: ! ci_panic("bad size in oo"); ! return 0; /* to satisfy gcc */ ! } case TY_FLOAT: return FLOAT_FORM_OFFSET; *************** *** 621,627 **** static void ! code_deref(tx, typecode, addrtype) text_t *tx; typecode_t typecode; addrtype_t addrtype; { --- 630,637 ---- static void ! code_deref(tx, typecode, typesize, addrtype) text_t *tx; typecode_t typecode; + long typesize; addrtype_t addrtype; { *************** *** 635,639 **** : OC_DEREF_UNSIGNED_BYTE; ! ci_code_opcode(tx, (opcode_t)((int)opcode + opcode_offset(typecode))); } --- 645,649 ---- : OC_DEREF_UNSIGNED_BYTE; ! ci_code_opcode(tx, (opcode_t)((int)opcode + opcode_offset(typecode, typesize))); } *************** *** 686,690 **** opcode = want_value ? OC_ASSIGN_AND_PUSH_BYTE : OC_ASSIGN_BYTE; ! ci_code_opcode(tx, (opcode_t)((int)opcode + opcode_offset(typecode))); if (want_value && type->ty_code == TY_BITFIELD) --- 696,700 ---- opcode = want_value ? OC_ASSIGN_AND_PUSH_BYTE : OC_ASSIGN_BYTE; ! ci_code_opcode(tx, (opcode_t)((int)opcode + opcode_offset(typecode, type->ty_size))); if (want_value && type->ty_code == TY_BITFIELD) *************** *** 757,761 **** generic_opcode = (opcode_t)((int)generic_byte_opcode + N_OPCODE_SIZES * ! opcode_offset(v->va_type->ty_code)); } else { --- 767,771 ---- generic_opcode = (opcode_t)((int)generic_byte_opcode + N_OPCODE_SIZES * ! opcode_offset(v->va_type->ty_code, v->va_type->ty_size)); } else { *************** *** 823,827 **** if (need_deref) ! code_deref(tx, v->va_type->ty_code, AT_PROC_ADDR); return addrtype; --- 833,837 ---- if (need_deref) ! code_deref(tx, v->va_type->ty_code, v->va_type->ty_size, AT_PROC_ADDR); return addrtype; *************** *** 1086,1089 **** --- 1096,1100 ---- bf = v->va_type->ty_bitfield; code_deref(tx, bf->bf_type->ty_code, + bf->bf_type->ty_size, expr_addrtype); code_bitfield_op(tx, bf, *************** *** 1091,1095 **** } else ! code_deref(tx, v->va_type->ty_code, expr_addrtype); addrtype = unknown_addrtype(tx); } --- 1102,1108 ---- } else ! code_deref(tx, v->va_type->ty_code, ! v->va_type->ty_size, ! expr_addrtype); addrtype = unknown_addrtype(tx); } *************** *** 1272,1276 **** } else ! code_deref(tx, addrleft->ex_type->ty_code, left_at); if (left != addrleft) { --- 1285,1290 ---- } else ! code_deref(tx, addrleft->ex_type->ty_code, ! addrleft->ex_type->ty_size, left_at); if (left != addrleft) { *************** *** 1395,1399 **** if (context == EC_VALUE && !is_aggregate(base) && base->ty_code != DT_FUNC_RETURNING) { ! code_deref(tx, base->ty_code, expr_addrtype); addrtype = unknown_addrtype(tx); } --- 1409,1413 ---- if (context == EC_VALUE && !is_aggregate(base) && base->ty_code != DT_FUNC_RETURNING) { ! code_deref(tx, base->ty_code, base->ty_size, expr_addrtype); addrtype = unknown_addrtype(tx); } *************** *** 1420,1424 **** } else ! code_deref(tx, expr->ex_type->ty_code, expr_addrtype); if (context == EC_VALUE && !is_preop) --- 1434,1439 ---- } else ! code_deref(tx, expr->ex_type->ty_code, ! expr->ex_type->ty_size, expr_addrtype); if (context == EC_VALUE && !is_preop) Index: xc_machine.h =================================================================== RCS file: /cvsroot/ups/ups/ups/xc_machine.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xc_machine.h 18 Feb 2004 11:23:07 -0000 1.5 --- xc_machine.h 22 Jun 2006 09:03:51 -0000 1.6 *************** *** 85,90 **** unsigned short d_ushort; short d_short; ! unsigned long d_ulong; ! long d_long; float d_float; stackword_t d_word; --- 85,90 ---- unsigned short d_ushort; short d_short; ! unsigned int d_ulong; ! int d_long; float d_float; stackword_t d_word; |