static bool fold_const_builtin_load_exponent (real_value *result, const real_value *arg0, const wide_int_ref &arg1, const real_format *format) { /* Bound the maximum adjustment to twice the range of the mode's valid exponents. Use abs to ensure the range is positive as a sanity check. */ int max_exp_adj = 2 * labs (format->emax - format->emin); /* The requested adjustment must be inside this range. This is a preliminary cap to avoid things like overflow, we may still fail to compute the result for other reasons. */ if (wi::les_p (arg1, -max_exp_adj) || wi::ges_p (arg1, max_exp_adj)) return false; REAL_VALUE_TYPE initial_result; real_ldexp (&initial_result, arg0, arg1.to_shwi ()); /* Ensure we didn't overflow. */ if (real_isinf (&initial_result)) return false; /* Only proceed if the target mode can hold the resulting value. */ *result = real_value_truncate (format, initial_result); return real_equal (&initial_result, result); }
static bool ortho_init (void) { tree n; input_location = BUILTINS_LOCATION; /* Create a global binding. */ push_binding (); build_common_tree_nodes (0); size_type_node = type_for_size (GET_MODE_BITSIZE (Pmode), 1); set_sizetype (size_type_node); build_common_tree_nodes_2 (0); n = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier ("int"), integer_type_node); push_decl (n); n = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier ("char"), char_type_node); push_decl (n); /* Create alloca builtin. */ { tree args_type = tree_cons (NULL_TREE, size_type_node, void_list_node); tree func_type = build_function_type (ptr_type_node, args_type); implicit_built_in_decls[BUILT_IN_ALLOCA] = builtin_function ("__builtin_alloca", func_type, BUILT_IN_ALLOCA, BUILT_IN_NORMAL, NULL, NULL_TREE); stack_alloc_function_ptr = build1 (ADDR_EXPR, build_pointer_type (func_type), implicit_built_in_decls[BUILT_IN_ALLOCA]); } { tree ptr_ftype = build_function_type (ptr_type_node, NULL_TREE); implicit_built_in_decls[BUILT_IN_STACK_SAVE] = builtin_function ("__builtin_stack_save", ptr_ftype, BUILT_IN_STACK_SAVE, BUILT_IN_NORMAL, NULL, NULL_TREE); } { tree ftype_ptr; ftype_ptr = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node, NULL_TREE)); implicit_built_in_decls[BUILT_IN_STACK_RESTORE] = builtin_function ("__builtin_stack_restore", ftype_ptr, BUILT_IN_STACK_RESTORE, BUILT_IN_NORMAL, NULL, NULL_TREE); } { REAL_VALUE_TYPE v; REAL_VALUE_FROM_INT (v, 1, 0, DFmode); real_ldexp (&fp_const_p5, &v, -1); REAL_VALUE_FROM_INT (v, -1, -1, DFmode); real_ldexp (&fp_const_m_p5, &v, -1); REAL_VALUE_FROM_INT (fp_const_zero, 0, 0, DFmode); } ortho_fe_init (); return true; }
static bool ortho_init (void) { tree n; input_location = BUILTINS_LOCATION; /* Create a global binding. Don't use push_binding, as neither a BLOCK nor a BIND_EXPR are needed. */ push_binding (GLOBAL_BINDING); build_common_tree_nodes (0, 0); n = build_decl (input_location, TYPE_DECL, get_identifier ("int"), integer_type_node); pushdecl (n); n = build_decl (input_location, TYPE_DECL, get_identifier ("char"), char_type_node); pushdecl (n); /* Create alloca builtin. */ { tree args_type = tree_cons (NULL_TREE, size_type_node, void_list_node); tree func_type = build_function_type (ptr_type_node, args_type); define_builtin ("__builtin_alloca", func_type, BUILT_IN_ALLOCA, NULL, 0); stack_alloc_function_ptr = build1 (ADDR_EXPR, build_pointer_type (func_type), builtin_decl_implicit (BUILT_IN_ALLOCA)); } { tree ptr_ftype = build_function_type (ptr_type_node, NULL_TREE); define_builtin ("__builtin_stack_save", ptr_ftype, BUILT_IN_STACK_SAVE, NULL, 0); } { tree ftype_ptr = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); define_builtin ("__builtin_stack_restore", ftype_ptr, BUILT_IN_STACK_RESTORE, NULL, 0); } { tree ftype_ptr = build_function_type_list (void_type_node, NULL_TREE); define_builtin ("__builtin_trap", ftype_ptr, BUILT_IN_TRAP, NULL, ECF_NOTHROW | ECF_LEAF); TREE_THIS_VOLATILE (builtin_decl_explicit (BUILT_IN_TRAP)) = 1; } { REAL_VALUE_TYPE v; REAL_VALUE_FROM_INT (v, 1, 0, DFmode); real_ldexp (&fp_const_p5, &v, -1); REAL_VALUE_FROM_INT (v, -1, -1, DFmode); real_ldexp (&fp_const_m_p5, &v, -1); REAL_VALUE_FROM_INT (fp_const_zero, 0, 0, DFmode); } build_common_builtin_nodes (); // FIXME: this MAY remove the need for creating the builtins above... // Evaluate tree.c / build_common_builtin_nodes (); for each in turn. return true; }