public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/pheeck/heads/sccp)] sccp.cc created, pass added to passes.def
@ 2022-06-10 14:20 Filip Kastl
0 siblings, 0 replies; 2+ messages in thread
From: Filip Kastl @ 2022-06-10 14:20 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:57a0f82598c873c40ee2d1b8b51cea564e0a5840
commit 57a0f82598c873c40ee2d1b8b51cea564e0a5840
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 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 <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 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/pheeck/heads/sccp)] sccp.cc created, pass added to passes.def
@ 2023-02-15 10:12 Filip Kastl
0 siblings, 0 replies; 2+ messages in thread
From: Filip Kastl @ 2023-02-15 10:12 UTC (permalink / raw)
To: gcc-cvs
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-15 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 14:20 [gcc(refs/users/pheeck/heads/sccp)] sccp.cc created, pass added to passes.def Filip Kastl
2023-02-15 10:12 Filip Kastl
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).