[qfcc] Clean out some old code

The move operator names are definitely obsolete (due to dropping the
expressions a year or two ago) and the precedence checks seem to be
handled elsewhere. Memset and state expressions went away a while back
too.
This commit is contained in:
Bill Currie 2022-01-08 20:55:20 +09:00
parent 14352ea65a
commit 63795e790b
6 changed files with 4 additions and 52 deletions

View file

@ -680,22 +680,6 @@ expr_t *new_assign_expr (expr_t *dst, expr_t *src);
*/
expr_t *new_param_expr (struct type_s *type, int num);
/** Create an expression representing a block copy.
This is used for structure assignments.
\param e1 Destination of move.
\param e2 Source of move.
\param type type giving size of move.
\param indirect Move uses dereferenced pointers.
\return A new expression representing the move.
*/
expr_t *new_move_expr (expr_t *e1, expr_t *e2, struct type_s *type,
int indirect);
expr_t *new_memset_expr (expr_t *dst, expr_t *val, struct type_s *type);
/** Convert a name to an expression of the appropriate type.
Converts the expression in-place. If the exprssion is not a name

View file

@ -1710,7 +1710,7 @@ fold_constants (expr_t *e)
}
op = e->e.expr.op;
if (op == 'i' || op == 'n' || op == 'c' || op == 's') {
if (op == 'i' || op == 'n' || op == 'c') {
return e;
}

View file

@ -97,7 +97,6 @@ get_op_string (int op)
case IFA: return "<ifa>";
case 'g': return "<goto>";
case 'r': return "<return>";
case 's': return "<state>";
case 'c': return "<call>";
case 'C': return "<cast>";
case 'M': return "<move>";

View file

@ -1341,33 +1341,6 @@ new_param_expr (type_t *type, int num)
return param_expr (va (0, ".param_%d", num), type);
}
expr_t *
new_move_expr (expr_t *e1, expr_t *e2, type_t *type, int indirect)
{
expr_t *e = new_binary_expr (indirect ? 'M' : 'm', e1, e2);
e->e.expr.type = type;
return e;
}
expr_t *
new_memset_expr (expr_t *dst, expr_t *val, type_t *type)
{
expr_t *e;
if (!is_pointer (get_type (dst))) {
return error (dst, "incorrect destination type for memset");
}
if (!is_scalar (get_type (val))) {
return error (val, "memset value must be a scalar");
}
e = new_expr ();
e->type = ex_memset;
e->e.memset.dst = dst;
e->e.memset.val = val;
e->e.memset.count = new_integer_expr (type_size (type));
e->e.memset.type = type;
return e;
}
expr_t *
append_expr (expr_t *block, expr_t *e)
{

View file

@ -873,7 +873,7 @@ check_precedence (int op, expr_t *e1, expr_t *e2)
{
if (e1->type == ex_uexpr && e1->e.expr.op == '!' && !e1->paren) {
if (options.traditional) {
if (op != AND && op != OR && op != '=') {
if (op != AND && op != OR) {
notice (e1, "precedence of `!' and `%s' inverted for "
"traditional code", get_op_string (op));
e1->e.expr.e1->paren = 1;
@ -890,8 +890,7 @@ check_precedence (int op, expr_t *e1, expr_t *e2)
if (e2->type == ex_expr && !e2->paren) {
if (((op == '&' || op == '|')
&& (is_math_op (e2->e.expr.op) || is_compare (e2->e.expr.op)))
|| (op == '='
&& (e2->e.expr.op == OR || e2->e.expr.op == AND))) {
|| (e2->e.expr.op == OR || e2->e.expr.op == AND)) {
notice (e1, "precedence of `%s' and `%s' inverted for "
"traditional code", get_op_string (op),
get_op_string (e2->e.expr.op));
@ -912,8 +911,7 @@ check_precedence (int op, expr_t *e1, expr_t *e2)
} else if (e1->type == ex_expr && !e1->paren) {
if (((op == '&' || op == '|')
&& (is_math_op (e1->e.expr.op) || is_compare (e1->e.expr.op)))
|| (op == '='
&& (e1->e.expr.op == OR || e1->e.expr.op == AND))) {
|| (e1->e.expr.op == OR || e1->e.expr.op == AND)) {
notice (e1, "precedence of `%s' and `%s' inverted for "
"traditional code", get_op_string (op),
get_op_string (e1->e.expr.op));

View file

@ -594,8 +594,6 @@ convert_op (int op)
case IFB: return "<IFB>";
case IFAE: return "<IFAE>";
case IFA: return "<IFA>";
case 'm': return "<MOVE>";
case 'M': return "<MOVEP>";
default:
return 0;
}