From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7879) id 8B90C3858430; Wed, 15 Feb 2023 10:12:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B90C3858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676455974; bh=wxZCLexHOTLHbnoAzLVD02SKWPVPgUexWxK+QcN5Y3o=; h=From:To:Subject:Date:From; b=enT0hak++Q603t7Ywj+bjWY3hcu+w1NeUmCzlADWKXqhq10o5t/3R/NmrBQQVWzdK ay1UEg/bPeAMk7hIdg5FshlLMKVWd7YD0ExIDHLUz981r8iPTNQtkapFVBgHRz8hkt d8PyxyN4jK0YTdU0wM5QZJMYg8bpDyF3RWf/JSRs= 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: ec8ec09f9414be871e322fecf4ebf53e3687bd22 X-Git-Newrev: 3d96be861227aa9ff4c1fa036eba9f98a2848dd7 Message-Id: <20230215101254.8B90C3858430@sourceware.org> Date: Wed, 15 Feb 2023 10:12:54 +0000 (GMT) List-Id: https://gcc.gnu.org/g:3d96be861227aa9ff4c1fa036eba9f98a2848dd7 commit 3d96be861227aa9ff4c1fa036eba9f98a2848dd7 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 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 + +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 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);