- type_t *type = function_type->function.return_type;
- ir_mode *mode = get_ir_mode_arithmetic(type);
- tarval *tv = get_mode_NAN(mode);
- ir_node *res = new_d_Const(dbgi, tv);
- return res;
- }
- case bk_gnu_builtin_expect: {
- expression_t *argument = call->arguments->expression;
- return _expression_to_firm(argument);
- }
- case bk_gnu_builtin_va_end:
- /* evaluate the argument of va_end for its side effects */
- _expression_to_firm(call->arguments->expression);
- return NULL;
- case bk_gnu_builtin_frame_address: {
- expression_t *const expression = call->arguments->expression;
- long val = fold_constant(expression);
- if (val == 0) {
- /* the nice case */
- return get_irg_frame(current_ir_graph);
- } else {
- /* get the argument */
- ir_node *in[2];
-
- in[0] = expression_to_firm(expression);
- in[1] = get_irg_frame(current_ir_graph);
- ir_type *tp = get_ir_type(function_type);
- ir_node *irn = new_d_Builtin(dbgi, get_irg_no_mem(current_ir_graph), ir_bk_frame_addess, 2, in, tp);
- return new_Proj(irn, mode_P_data, pn_Builtin_1_result);
- }
- }
- case bk_gnu_builtin_return_address: {
-
- expression_t *const expression = call->arguments->expression;
- ir_node *in[2];
-
- in[0] = expression_to_firm(expression);
- in[1] = get_irg_frame(current_ir_graph);
- ir_type *tp = get_ir_type(function_type);
- ir_node *irn = new_d_Builtin(dbgi, get_irg_no_mem(current_ir_graph), ir_bk_return_address, 2, in, tp);
- return new_Proj(irn, mode_P_data, pn_Builtin_1_result);
- }
- case bk_gnu_builtin_ffs:
- return gen_unary_builtin(ir_bk_ffs, call->arguments->expression, function_type, dbgi);
- case bk_gnu_builtin_clz:
- return gen_unary_builtin(ir_bk_clz, call->arguments->expression, function_type, dbgi);
- case bk_gnu_builtin_ctz:
- return gen_unary_builtin(ir_bk_ctz, call->arguments->expression, function_type, dbgi);
- case bk_gnu_builtin_popcount:
- case bk_ms__popcount:
- return gen_unary_builtin(ir_bk_popcount, call->arguments->expression, function_type, dbgi);
- case bk_gnu_builtin_parity:
- return gen_unary_builtin(ir_bk_parity, call->arguments->expression, function_type, dbgi);
- case bk_gnu_builtin_prefetch: {
- call_argument_t *const args = call->arguments;
- expression_t *const addr = args->expression;
- ir_node *in[3];
-
- in[0] = _expression_to_firm(addr);
- if (args->next != NULL) {
- expression_t *const rw = args->next->expression;
-
- in[1] = _expression_to_firm(rw);
-
- if (args->next->next != NULL) {
- expression_t *const locality = args->next->next->expression;
-
- in[2] = expression_to_firm(locality);
- } else {
- in[2] = new_Const_long(mode_int, 3);
- }
- } else {
- in[1] = new_Const_long(mode_int, 0);
- in[2] = new_Const_long(mode_int, 3);
- }
- ir_type *tp = get_ir_type(function_type);
- ir_node *irn = new_d_Builtin(dbgi, get_store(), ir_bk_prefetch, 3, in, tp);
- set_store(new_Proj(irn, mode_M, pn_Builtin_M));
- return NULL;
- }
- case bk_gnu_builtin_trap:
- case bk_ms__ud2:
- {
- ir_type *tp = get_ir_type(function_type);
- ir_node *irn = new_d_Builtin(dbgi, get_store(), ir_bk_trap, 0, NULL, tp);
- set_store(new_Proj(irn, mode_M, pn_Builtin_M));
- return NULL;
- }
- case bk_ms__debugbreak: {
- ir_type *tp = get_ir_type(function_type);
- ir_node *irn = new_d_Builtin(dbgi, get_store(), ir_bk_debugbreak, 0, NULL, tp);
- set_store(new_Proj(irn, mode_M, pn_Builtin_M));
- return NULL;