* eval.c (evaluate_subexp): Handle new BINOP_MOD.
* expprint.c (dump_expression): Handle new BINOP_MOD.
* language.c (binop_type_check): Handle new BINOP_MOD.
* main.c (float_handler): Re-enable float handler when hit.
* valarith.c (language.h): Include, need current_language.
* valarith.c (TRUNCATION_TOWARDS_ZERO): Define default macro
for integer divide truncates towards zero for negative results.
* valarith.c (value_x_binop): Handle BINOP_MOD if seen.
* valarith.c (value_binop): Allow arithmetic operations on
TYPE_CODE_CHAR variables. Add case to handle new BINOP_MOD.
**** start-sanitize-chill ****
* ch-exp.y (operand_4): Add useful actions for MOD and REM.
* ch-exp.y (tokentab3): Add MOD and REM.
* ch-exp.y (yylex): Set innermost_block for symbols found
in local scopes. Return LOCATION_NAME for local symbols.
* ch-lang.c (chill_op_print_tab): Fix MOD entry to use
BINOP_MOD instead of BINOP_REM. Add REM entry, using BINOP_REM.
**** end-sanitize-chill ****
+Mon Jan 4 16:54:18 1993 Fred Fish (fnf@cygnus.com)
+
+ * expression.h (exp_opcode): Add BINOP_MOD.
+ * eval.c (evaluate_subexp): Handle new BINOP_MOD.
+ * expprint.c (dump_expression): Handle new BINOP_MOD.
+ * language.c (binop_type_check): Handle new BINOP_MOD.
+ * main.c (float_handler): Re-enable float handler when hit.
+ * valarith.c (language.h): Include, need current_language.
+ * valarith.c (TRUNCATION_TOWARDS_ZERO): Define default macro
+ for integer divide truncates towards zero for negative results.
+ * valarith.c (value_x_binop): Handle BINOP_MOD if seen.
+ * valarith.c (value_binop): Allow arithmetic operations on
+ TYPE_CODE_CHAR variables. Add case to handle new BINOP_MOD.
+ **** start-sanitize-chill ****
+ * ch-exp.y (operand_4): Add useful actions for MOD and REM.
+ * ch-exp.y (tokentab3): Add MOD and REM.
+ * ch-exp.y (yylex): Set innermost_block for symbols found
+ in local scopes. Return LOCATION_NAME for local symbols.
+ * ch-lang.c (chill_op_print_tab): Fix MOD entry to use
+ BINOP_MOD instead of BINOP_REM. Add REM entry, using BINOP_REM.
+ **** end-sanitize-chill ****
+
Sun Jan 3 14:24:56 1993 Steve Chamberlain (sac@thepub.cygnus.com)
* remote-sim.c: first attempt at general simulator interface
}
| operand_4 MOD operand_5
{
- $$ = 0; /* FIXME */
+ write_exp_elt_opcode (BINOP_MOD);
}
| operand_4 REM operand_5
{
- $$ = 0; /* FIXME */
+ write_exp_elt_opcode (BINOP_REM);
}
;
static const struct token tokentab3[] =
{
+ { "MOD", MOD },
+ { "REM", REM },
{ "NOT", NOT },
{ "XOR", LOGXOR },
{ "AND", LOGAND }
case LOC_STATIC:
/* Found a global or local static variable. */
return (LOCATION_NAME);
- case LOC_UNDEF:
- case LOC_CONST:
case LOC_REGISTER:
case LOC_ARG:
case LOC_REF_ARG:
case LOC_REGPARM:
case LOC_LOCAL:
- case LOC_TYPEDEF:
+ case LOC_LOCAL_ARG:
+ if (innermost_block == NULL
+ || contained_in (block_found, innermost_block))
+ {
+ innermost_block = block_found;
+ }
+ return (LOCATION_NAME);
+ break;
+ case LOC_CONST:
case LOC_LABEL:
+ return (LOCATION_NAME);
+ break;
+ case LOC_UNDEF:
+ case LOC_TYPEDEF:
case LOC_CONST_BYTES:
- case LOC_LOCAL_ARG:
+ error ("Symbol \"%s\" names no location.", simplename);
break;
}
}
{"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
{"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
{"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
- {"MOD", BINOP_REM, PREC_MUL, 0},
+ {"MOD", BINOP_MOD, PREC_MUL, 0},
+ {"REM", BINOP_REM, PREC_MUL, 0},
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
{"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
case BINOP_MUL:
case BINOP_DIV:
case BINOP_REM:
+ case BINOP_MOD:
case BINOP_LSH:
case BINOP_RSH:
case BINOP_BITWISE_AND:
return value_x_binop (arg1, arg2, op, OP_NULL);
else
if (noside == EVAL_AVOID_SIDE_EFFECTS
- && (op == BINOP_DIV || op == BINOP_REM))
+ && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
return value_zero (VALUE_TYPE (arg1), not_lval);
else
return value_binop (arg1, arg2, op);
case BINOP_MUL: opcode_name = "BINOP_MUL"; break;
case BINOP_DIV: opcode_name = "BINOP_DIV"; break;
case BINOP_REM: opcode_name = "BINOP_REM"; break;
+ case BINOP_MOD: opcode_name = "BINOP_MOD"; break;
case BINOP_LSH: opcode_name = "BINOP_LSH"; break;
case BINOP_RSH: opcode_name = "BINOP_RSH"; break;
case BINOP_LOGICAL_AND: opcode_name = "BINOP_LOGICAL_AND"; break;
BINOP_MUL, /* * */
BINOP_DIV, /* / */
BINOP_REM, /* % */
+ BINOP_MOD, /* mod (Knuth 1.2.4) */
BINOP_LSH, /* << */
BINOP_RSH, /* >> */
BINOP_LOGICAL_AND, /* && */
break;
case BINOP_REM:
+ case BINOP_MOD:
if (!integral_type(t1) || !integral_type(t2))
type_op_error ("Arguments to %s must be of integral type.",op);
break;
{
/* This message is based on ANSI C, section 4.7. Note that integer
divide by zero causes this, so "float" is a misnomer. */
+ signal (SIGFPE, float_handler);
error ("Erroneous arithmetic operation.");
}