Wrap optimize_graph_df in opt_manage framework
authorAndreas Zwinkau <zwinkau@kit.edu>
Fri, 4 Nov 2011 12:58:09 +0000 (13:58 +0100)
committerAndreas Zwinkau <zwinkau@kit.edu>
Fri, 4 Nov 2011 14:23:33 +0000 (15:23 +0100)
include/libfirm/irgopt.h
ir/opt/local.c [new file with mode: 0644]

index 8bde4b9..aa08cb6 100644 (file)
@@ -56,6 +56,11 @@ FIRM_API void local_optimize_graph(ir_graph *irg);
  *
  * @return non-zero if the optimization could be applied, 0 else
  */
+FIRM_API void local_opts(ir_graph *irg);
+
+/** Same functionality as local_opts above, but without framework wrapper
+ * @deprecated
+ */
 FIRM_API int optimize_graph_df(ir_graph *irg);
 
 /**
diff --git a/ir/opt/local.c b/ir/opt/local.c
new file mode 100644 (file)
index 0000000..e1f0ab2
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2011 Karlsruhe Institute of Technology.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @brief   Apply local opts until fixpoint
+ * @author  Andreas Zwinkau
+ */
+#include "irgopt.h"
+#include "opt_manage.h"
+
+static optdesc_t opt_local = {
+       "localopts",
+       0, // TODO optimize_graph_df handles preconditions itself
+       optimize_graph_df,
+};
+
+void local_opts(ir_graph *irg)
+{
+       perform_irg_optimization(irg, &opt_local);
+}