public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Ondrej Kubanek <kubaneko@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/kubaneko/heads/histogram)] loop counter prototype Date: Thu, 16 Feb 2023 16:26:34 +0000 (GMT) [thread overview] Message-ID: <20230216162634.C0D813858D33@sourceware.org> (raw) https://gcc.gnu.org/g:d208f89f5754737f170fa8fef8197ddb8c51782c commit d208f89f5754737f170fa8fef8197ddb8c51782c Author: Ondrej Kubanek <kubanek0ondrej@gmail.com> Date: Wed Jul 27 14:00:47 2022 +0200 loop counter prototype Diff: --- gcc/value-prof.cc | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/gcc/value-prof.cc b/gcc/value-prof.cc index 80b17f56661..06a584b392a 100644 --- a/gcc/value-prof.cc +++ b/gcc/value-prof.cc @@ -42,6 +42,8 @@ along with GCC; see the file COPYING3. If not see #include "gimple-pretty-print.h" #include "dumpfile.h" #include "builtins.h" +#include "cfgloop.h" +#include "tree-ssa-loop-manip.h" /* In this file value profile based optimizations are placed. Currently the following optimizations are implemented (for more detailed descriptions @@ -1913,6 +1915,30 @@ gimple_stringops_values_to_profile (gimple *gs, histogram_values *values) stmt, dest)); } +static void +gimple_histogram_values_to_profile(function *fun, histogram_values * values){ + for (auto loop : loops_list (fun, 0)){ + tree var; + gimple_stmt_iterator gsi; + gsi = gsi_last_bb (loop->latch); + create_iv (build_int_cst_type (var, 0), build_int_cst (var, 1), NULL_TREE, + loop, &gsi, true, &var, NULL); + auto_vec<edge> exits = get_loop_exit_edges (loop); + for ( auto exit : exits ){ + if (single_pred_p (exit->dest)){ + values->safe_push (gimple_alloc_histogram_value (fun, + HIST_TYPE_HISTOGRAM, + exit->src, var)); + } + //pridate ulozeni var do histogramu na zacated basic blocku exit->dest + // TREE_TYPE (name) + else + { + } + } + } +} + /* Find values inside STMT for that we want to measure histograms and adds them to list VALUES. */ @@ -1932,8 +1958,8 @@ gimple_find_values_to_profile (histogram_values *values) unsigned i; histogram_value hist = NULL; values->create (0); - FOR_EACH_BB_FN (bb, cfun) + gimple_histogram_values_to_profile(cfun, values); for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) gimple_values_to_profile (gsi_stmt (gsi), values); @@ -1948,10 +1974,6 @@ gimple_find_values_to_profile (histogram_values *values) hist->n_counters = hist->hdata.intvl.steps + 2; break; - - case HIST_TYPE_HISTOGRAM: - hist->n_counters = 69; - break; case HIST_TYPE_POW2: hist->n_counters = 2; break; @@ -1973,6 +1995,10 @@ gimple_find_values_to_profile (histogram_values *values) hist->n_counters = 1; break; + case HIST_TYPE_HISTOGRAM: + hist->n_counters = 69; + break; + default: gcc_unreachable (); }
next reply other threads:[~2023-02-16 16:26 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-16 16:26 Ondrej Kubanek [this message] 2023-02-23 23:20 Ondrej Kubanek
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230216162634.C0D813858D33@sourceware.org \ --to=kubaneko@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).