public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Filip Kastl <pheeck@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/pheeck/heads/sccp)] sccp.cc created, pass added to passes.def Date: Wed, 15 Feb 2023 10:12:54 +0000 (GMT) [thread overview] Message-ID: <20230215101254.8B90C3858430@sourceware.org> (raw) https://gcc.gnu.org/g:3d96be861227aa9ff4c1fa036eba9f98a2848dd7 commit 3d96be861227aa9ff4c1fa036eba9f98a2848dd7 Author: Filip Kastl <filip.kastl@gmail.com> Date: Fri Jun 10 13:34:51 2022 +0200 sccp.cc created, pass added to passes.def Diff: --- gcc/passes.def | 1 + gcc/sccp.cc | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ gcc/tree-pass.h | 1 + 3 files changed, 92 insertions(+) diff --git a/gcc/passes.def b/gcc/passes.def index 462e9afad61..5e102669a8d 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -77,6 +77,7 @@ along with GCC; see the file COPYING3. If not see PUSH_INSERT_PASSES_WITHIN (pass_all_early_optimizations) NEXT_PASS (pass_remove_cgraph_callee_edges); NEXT_PASS (pass_early_object_sizes); + NEXT_PASS (pass_sccp); /* TODO Kam pass umistit */ /* Don't record nonzero bits before IPA to avoid using too much memory. */ NEXT_PASS (pass_ccp, false /* nonzero_p */); diff --git a/gcc/sccp.cc b/gcc/sccp.cc new file mode 100644 index 00000000000..3985e5c2dab --- /dev/null +++ b/gcc/sccp.cc @@ -0,0 +1,90 @@ +/* TODO Popis passu + Strongly connected copy propagation pass + Copyright (C) 2022 Free Software Foundation, Inc. + Contributed by Filip Kastl <filip.kastl@gmail.com> + +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/>. */ + +// TODO Procistit includes + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "backend.h" +#include "target.h" +#include "tree.h" +#include "tree-pass.h" +#include "memmodel.h" +#include "tm_p.h" + +/* TODO Popisek passu */ + +namespace { + +const pass_data pass_data_adjust_alignment = +{ + GIMPLE_PASS, /* type */ + "sccp", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_NONE, /* tv_id */ + ( PROP_cfg | PROP_ssa ), /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_update_ssa | TODO_cleanup_cfg, /* todo_flags_finish */ +}; + +class pass_sccp : public gimple_opt_pass +{ +public: + pass_sccp (gcc::context *ctxt) + : gimple_opt_pass (pass_data_sccp, ctxt) + {} + + /* opt_pass methods: */ + virtual bool gate (function *) { return true; } // TODO Rozhodovat, jestli pass pustit + virtual unsigned int execute (function *); +}; // class pass_sccp + +unsigned +pass_sccp::execute (function *) +{ + basic_block bb; + + FOR_EACH_BB_FN (bb, cfun) + { + gphi_iterator i; + + for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i)) + { + gphi *phi = i.phi (); + + debug_gimple_stmt (phi); // debug phi na obrazovku + // dump_gimple_stmt ... do souboru + } + } + + return 0; // TODO Co tu mam vracet? +} + +} // anon namespace + +gimple_opt_pass * +make_pass_sccp (gcc::context *ctxt) +{ + return new pass_sccp (ctxt); +} diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 8480d41384b..9ce33ef7344 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -399,6 +399,7 @@ extern gimple_opt_pass *make_pass_iv_optimize (gcc::context *ctxt); extern gimple_opt_pass *make_pass_tree_loop_done (gcc::context *ctxt); extern gimple_opt_pass *make_pass_ch (gcc::context *ctxt); extern gimple_opt_pass *make_pass_ch_vect (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_sccp (gcc::context *ctxt); // TODO Kam extern gimple_opt_pass *make_pass_ccp (gcc::context *ctxt); extern gimple_opt_pass *make_pass_split_paths (gcc::context *ctxt); extern gimple_opt_pass *make_pass_build_ssa (gcc::context *ctxt);
next reply other threads:[~2023-02-15 10:12 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-15 10:12 Filip Kastl [this message] -- strict thread matches above, loose matches on Subject: below -- 2022-06-10 14:20 Filip Kastl
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=20230215101254.8B90C3858430@sourceware.org \ --to=pheeck@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).