sparc: remove uninterpreted (and often wrongly used) MATCH_SIZE_NEUTRAL match flag...
[libfirm] / ir / be / beilpsched.h
index 277e337..62192a0 100644 (file)
@@ -1,11 +1,40 @@
-#ifndef _BEILPSCHED_H_
-#define _BEILPSCHED_H_
-
-#include "firm_config.h"
+/*
+ * Copyright (C) 1995-2008 University of Karlsruhe.  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.
+ */
 
-#include "bemachine.h"
+/**
+ * @file
+ * @brief       ILP based instruction scheduling.
+ * @author      Christian Wuerdig
+ * @date        22.10.2006
+ * @version     $Id$
+ *
+ * An ILP scheduler based on
+ * "ILP-based Instruction Scheduling for IA-64"
+ * by Daniel Kaestner and Sebastian Winkel
+ * extended with register pressure constraints by Christian Wuerdig
+ */
+#ifndef FIRM_BE_BEILPSCHED_H
+#define FIRM_BE_BEILPSCHED_H
 
-typedef struct _ilp_sched_selector_t ilp_sched_selector_t;
+#include "irgraph.h"
+#include "irnode.h"
+#include "be_types.h"
 
 /**
  * A selector interface which is used by the ILP schedule framework.
@@ -13,7 +42,7 @@ typedef struct _ilp_sched_selector_t ilp_sched_selector_t;
  * from the backend or they pass back information to the backend about
  * the state of scheduling.
  */
-struct _ilp_sched_selector_t {
+struct _ilp_sched_selector_if_t {
 
        /**
         * This function is called before the scheduling of the irg.
@@ -63,26 +92,36 @@ struct _ilp_sched_selector_t {
         * @param cycle      The cycle at which the node is scheduled.
         * @param block_env  The block scheduling environment.
         */
-       void (*node_scheduled)(const void *self, ir_node *irn, unsigned cycle, void *block_env);
+       void (*node_scheduled)(const void *self, const ir_node *irn, unsigned cycle, void *block_env);
+};
+
+/**
+ * The actual ILP schedule selector.
+ */
+struct _ilp_sched_selector_t {
+       ilp_sched_selector_if_t *impl;
 };
 
-#define BE_ILP_SCHED_CALL(func, self, obj, env) \
-       do {                                        \
-               if ((self)->func)                       \
-                       (self)->func((self), (obj), (env)); \
+/**
+ * Some helper macros.
+ */
+#define BE_ILP_SCHED_CALL(func, self, obj, env)       \
+       do {                                              \
+               if ((self) && (self)->impl->func)             \
+                       (self)->impl->func((self), (obj), (env)); \
        } while (0)
 
-#define BE_ILP_SCHED_CALL2(func, self, obj, obj2, env)  \
-       do {                                                \
-               if ((self)->func)                               \
-                       (self)->func((self), (obj), (obj2), (env)); \
+#define BE_ILP_SCHED_CALL2(func, self, obj, obj2, env)        \
+       do {                                                      \
+               if ((self) && (self)->impl->func)                     \
+                       (self)->impl->func((self), (obj), (obj2), (env)); \
        } while (0)
 
 #define BE_ILP_SCHED_CALL_ENVRET(func, self, obj, defret) \
-       ((self)->func ? (self)->func((self), (obj)) : (defret))
+       ((self) && (self)->impl->func ? (self)->impl->func((self), (obj)) : (defret))
 
 #define BE_ILP_SCHED_CALL_RET(func, self, obj, env, defret) \
-       ((self)->func ? (self)->func((self), (obj), (env)) : (defret))
+       ((self) && (self)->impl->func ? (self)->impl->func((self), (obj), (env)) : (defret))
 
 /**
  * Convenience macros for all functions.
@@ -107,20 +146,8 @@ struct _ilp_sched_selector_t {
        BE_ILP_SCHED_CALL2(node_scheduled, self, irn, cycle, block_env)
 
 /**
- * Perform ILP scheduling on given birg.
+ * Perform ILP scheduling on given irg.
  */
-void be_ilp_sched(const be_irg_t *birg);
-
-#ifdef WITH_LIBCORE
-
-#include <libcore/lc_opts.h>
-#include <libcore/lc_opts_enum.h>
-
-/**
- * Register ILP scheduler options.
- */
-void ilpsched_register_options(lc_opt_entry_t *grp);
-
-#endif /* WITH_LIBCORE */
+void be_ilp_sched(ir_graph *irg);
 
-#endif /* _BEILPSCHED_H_ */
+#endif