Lines Matching refs:expr

42 static int evaluate_to_int_const_expr(struct expression *expr)
44 expr->ctype = &int_ctype;
45 expr->flags |= CEF_SET_ICE;
49 static int evaluate_pure_unop(struct expression *expr)
51 struct expression *arg = first_expression(expr->args);
60 expr->flags = flags;
67 static int eval_args(struct expression *expr, int n)
74 FOR_EACH_PTR(expr->args, arg) {
89 sym = expr->fn->ctype;
90 expression_error(expr, "%s for %s", msg, show_ident(sym->ident));
94 static int args_prototype(struct expression *expr)
96 struct symbol *fntype = expr->fn->ctype->ctype.base_type;
98 return eval_args(expr, n);
101 static int args_triadic(struct expression *expr)
103 return eval_args(expr, 3);
106 static int evaluate_choose(struct expression *expr)
108 struct expression_list *list = expr->args;
117 *expr = get_expression_value(args[0]) ? *args[1] : *args[2];
122 static int expand_expect(struct expression *expr, int cost)
124 struct expression *arg = first_ptr_list((struct ptr_list *) expr->args);
127 *expr = *arg;
135 static int expand_warning(struct expression *expr, int cost)
138 struct expression_list *arglist = expr->args;
154 warning(expr->pos, "%*s", string->length-1, string->data);
170 expr->type = EXPR_VALUE;
171 expr->value = 1;
172 expr->taint = 0;
177 static int expand_constant_p(struct expression *expr, int cost)
179 expr->type = EXPR_VALUE;
180 expr->value = !cost;
181 expr->taint = 0;
186 static int expand_safe_p(struct expression *expr, int cost)
188 expr->type = EXPR_VALUE;
189 expr->value = (cost < SIDE_EFFECTS);
190 expr->taint = 0;
219 static int expand_bswap(struct expression *expr, int cost)
228 arg = first_expression(expr->args);
230 switch (expr->ctype->bit_size) {
231 case 16: expr->value = bswap16(val); break;
232 case 32: expr->value = bswap32(val); break;
233 case 64: expr->value = bswap64(val); break;
238 expr->type = EXPR_VALUE;
239 expr->taint = 0;
250 static int expand_##name(struct expression *expr, int cost) \
258 arg = first_expression(expr->args); \
269 expr->value = val; \
270 expr->type = EXPR_VALUE; \
271 expr->taint = 0; \
287 static int evaluate_fp_unop(struct expression *expr)
291 if (!eval_args(expr, 1))
294 arg = first_expression(expr->args);
296 expression_error(expr, "non-floating-point argument in call to %s()",
297 show_ident(expr->fn->ctype->ident));
308 static int expand_isdigit(struct expression *expr, int cost)
310 struct expression *arg = first_expression(expr->args);
316 expr->value = (val >= '0') && (val <= '9');
317 expr->type = EXPR_VALUE;
318 expr->taint = 0;
328 static int evaluate_overflow_gen(struct expression *expr, int ptr)
334 FOR_EACH_PTR(expr->args, arg) {
362 expr->ctype = &bool_ctype;
368 expr->ctype = &bad_ctype;
372 static int evaluate_overflow(struct expression *expr)
374 return evaluate_overflow_gen(expr, 1);
382 static int evaluate_overflow_p(struct expression *expr)
384 return evaluate_overflow_gen(expr, 0);
404 static int evaluate_generic_int_op(struct expression *expr)
406 struct symbol *fntype = expr->fn->ctype->ctype.base_type;
414 FOR_EACH_PTR(expr->args, arg) {
441 return evaluate_arguments(types, expr->args);
446 expr->ctype = &bad_ctype;
456 static int eval_atomic_common(struct expression *expr)
458 struct symbol *fntype = expr->fn->ctype->ctype.base_type;
468 FOR_EACH_PTR(expr->args, arg) {
503 if (!expr->ctype) // set the return type, if needed
504 expr->ctype = ctype;
505 return evaluate_arguments(types, expr->args);
510 expr->ctype = &bad_ctype;
525 static int expand_object_size(struct expression *expr, int cost)
527 struct expression *arg = first_expression(expr->args);
528 int type = get_expression_value_silent(ptr_list_nth(expr->args, 1));
580 expr->flags |= CEF_SET_ICE;
581 expr->type = EXPR_VALUE;
582 expr->value = val;
583 expr->taint = 0;