GCC Middle and Back End API Reference
|
Functions | |
static void | copy (sreal *, sreal *) |
static void | shift_right (sreal *, int) |
static void | normalize (sreal *) |
void | dump_sreal () |
DEBUG_FUNCTION void | debug () |
static void | copy () |
static void | shift_right () |
static void | normalize () |
sreal * | sreal_init () |
HOST_WIDE_INT | sreal_to_int () |
int | sreal_compare () |
sreal * | sreal_add () |
sreal * | sreal_sub () |
sreal * | sreal_mul () |
sreal * | sreal_div () |
@verbatim Simple data type for positive real numbers for the GNU compiler.
Copyright (C) 2002-2013 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
This library supports positive real numbers and 0; inf and nan are NOT supported. It is written to be simple and fast. Value of sreal is x = sig * 2 ^ exp where sig = significant (for < 64-bit machines sig = sig_lo + sig_hi * 2 ^ SREAL_PART_BITS) exp = exponent One HOST_WIDE_INT is used for the significant on 64-bit (and more than 64-bit) machines, otherwise two HOST_WIDE_INTs are used for the significant. Only a half of significant bits is used (in normalized sreals) so that we do not have problems with overflow, for example when c->sig = a->sig * b->sig. So the precision for 64-bit and 32-bit machines is 32-bit. Invariant: The numbers are normalized before and after each call of sreal_*. Normalized sreals: All numbers (except zero) meet following conditions: SREAL_MIN_SIG <= sig && sig <= SREAL_MAX_SIG -SREAL_MAX_EXP <= exp && exp <= SREAL_MAX_EXP If the number would be too large, it is set to upper bounds of these conditions. If the number is zero or would be too small it meets following conditions: sig == 0 && exp == -SREAL_MAX_EXP
Referenced by add_excls(), add_loc_descr_to_each(), add_presence_absence(), adjust_piece_list(), apply_iterator_to_string(), attr_copy_rtx(), concat_INSN_LIST(), copy_ancestor_tree(), copy_constant(), copy_decl_for_dup_finish(), copy_decl_no_change(), copy_decl_to_var(), copy_decls_walk(), copy_gimple_seq_and_replace_locals(), copy_insn_1(), copy_result_decl_to_var(), copy_rtx(), copy_static_var_set(), copy_var_decl(), cselib_expand_value_rtx_1(), cselib_subst_to_values(), duplicate_block(), duplicate_insn_chain(), gimple_copy(), gimple_duplicate_bb(), gimple_merge_blocks(), gimplify_var_or_parm_decl(), go_define(), graphite_copy_stmts_from_block(), initialize_argument_information(), initialize_iterators(), lto_output_data_stream(), maybe_copy_prologue_epilogue_insn(), omega_extract_distance_vectors(), omp_copy_decl_2(), plus_constant(), record_temporary_equivalences_from_stmts_at_dest(), reload_reg_free_for_value_p(), remap_gimple_stmt(), separate_decls_in_region_name(), separate_decls_in_region_stmt(), shallow_copy_rtx_stat(), sra_ipa_reset_debug_stmts(), sreal_add(), sreal_sub(), tail_duplicate(), TB_getline(), and update_ld_motion_stores().
|
inlinestatic |
Copy the sreal number.
References sreal::exp, sreal::sig, sreal::sig_hi, and sreal::sig_lo.
DEBUG_FUNCTION void debug | ( | ) |
References dump_sreal().
void dump_sreal | ( | ) |
Print the content of struct sreal.
References sreal::exp, HOST_WIDE_INT_PRINT_UNSIGNED, sreal::sig, sreal::sig_hi, and sreal::sig_lo.
Referenced by debug().
|
static |
|
static |
Normalize *X.
References sreal::exp, HOST_WIDE_INT, shift, sreal::sig, sreal::sig_hi, and sreal::sig_lo.
|
inlinestatic |
Referenced by sreal_add(), and sreal_sub().
|
inlinestatic |
Shift X right by S bits. Needed: 0 < S <= SREAL_BITS. When the most significant bit shifted out is 1, add 1 to X (rounding).
References sreal::exp, sreal::sig, sreal::sig_hi, and sreal::sig_lo.
sreal* sreal_add | ( | ) |
*R = *A + *B. Return R.
References copy(), sreal::exp, normalize(), shift_right(), sreal::sig, sreal::sig_hi, sreal::sig_lo, sreal_compare(), and swap().
Referenced by estimate_bb_frequencies(), and propagate_freq().
int sreal_compare | ( | ) |
Compare *A and *B. Return -1 if *A < *B, 1 if *A > *B and 0 if *A == *B.
References sreal::exp, sreal::sig, sreal::sig_hi, and sreal::sig_lo.
Referenced by estimate_bb_frequencies(), propagate_freq(), sreal_add(), sreal_mul(), and sreal_sub().
sreal* sreal_div | ( | ) |
*R = *A / *B. Return R.
References sreal::exp, HOST_WIDE_INT, normalize(), sreal::sig, sreal::sig_hi, and sreal::sig_lo.
Referenced by estimate_bb_frequencies(), and propagate_freq().
sreal* sreal_init | ( | ) |
Set *R to SIG * 2 ^ EXP. Return R.
References sreal::exp, exp(), normalize(), sreal::sig, sreal::sig_hi, and sreal::sig_lo.
Referenced by estimate_bb_frequencies(), and propagate_freq().
sreal* sreal_mul | ( | ) |
*R = *A * *B. Return R.
References sreal::exp, HOST_WIDE_INT, normalize(), sreal::sig, sreal::sig_hi, sreal::sig_lo, sreal_compare(), and swap().
Referenced by estimate_bb_frequencies(), and propagate_freq().
sreal* sreal_sub | ( | ) |
*R = *A - *B. Return R.
References copy(), sreal::exp, normalize(), shift_right(), sreal::sig, sreal::sig_hi, sreal::sig_lo, and sreal_compare().
Referenced by estimate_bb_frequencies(), and propagate_freq().
HOST_WIDE_INT sreal_to_int | ( | ) |
Return integer value of *R.
References sreal::exp, sreal::sig, sreal::sig_hi, and sreal::sig_lo.
Referenced by estimate_bb_frequencies().