diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-09-13 10:37:49 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-09-13 10:37:49 -0700 |
commit | e252b51ccde010cbd2a146485d8045103cd99533 (patch) | |
tree | e060f101cdc32bf5e520de8e5275db9d4236b74c /gcc/tree-switch-conversion.h | |
parent | f10c7c4596dda99d2ee872c995ae4aeda65adbdf (diff) | |
parent | 104c05c5284b7822d770ee51a7d91946c7e56d50 (diff) | |
download | gcc-e252b51ccde010cbd2a146485d8045103cd99533.zip gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.gz gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.bz2 |
Merge from trunk revision 104c05c5284b7822d770ee51a7d91946c7e56d50.
Diffstat (limited to 'gcc/tree-switch-conversion.h')
-rw-r--r-- | gcc/tree-switch-conversion.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h index d76f19b..a375e52 100644 --- a/gcc/tree-switch-conversion.h +++ b/gcc/tree-switch-conversion.h @@ -180,6 +180,13 @@ public: return tree_int_cst_equal (get_low (), get_high ()); } + /* Return number of comparisons needed for the case. */ + unsigned + get_comparison_count () + { + return m_range_p ? 2 : 1; + } + /* Low value of the case. */ tree m_low; @@ -267,9 +274,12 @@ public: static vec<cluster *> find_jump_tables (vec<cluster *> &clusters); /* Return true when cluster starting at START and ending at END (inclusive) - can build a jump-table. */ + can build a jump-table. COMPARISON_COUNT is number of comparison + operations needed if the clusters are expanded as decision tree. + MAX_RATIO tells about the maximum code growth (in percent). */ static bool can_be_handled (const vec<cluster *> &clusters, unsigned start, - unsigned end); + unsigned end, unsigned HOST_WIDE_INT max_ratio, + unsigned HOST_WIDE_INT comparison_count); /* Return true if cluster starting at START and ending at END (inclusive) is profitable transformation. */ |