From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7879) id 0AA913825BD4; Fri, 10 Jun 2022 14:20:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AA913825BD4 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Filip Kastl To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/pheeck/heads/sccp)] sccp.cc created, pass added to passes.def X-Act-Checkin: gcc X-Git-Author: Filip Kastl X-Git-Refname: refs/users/pheeck/heads/sccp X-Git-Oldrev: 5940b4e59f8e198dbf7e8b733561ef72a9ba2cbc X-Git-Newrev: 57a0f82598c873c40ee2d1b8b51cea564e0a5840 Message-Id: <20220610142055.0AA913825BD4@sourceware.org> Date: Fri, 10 Jun 2022 14:20:55 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2022 14:20:55 -0000 https://gcc.gnu.org/g:57a0f82598c873c40ee2d1b8b51cea564e0a5840 commit 57a0f82598c873c40ee2d1b8b51cea564e0a5840 Author: Filip Kastl 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 375d3d62d51..6cdcbb0b3a0 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 + +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 +. */ + +// 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 606d1d60b85..f7a1588fafe 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -396,6 +396,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);