bescripts: Remove unused execution unit specification.
[libfirm] / ir / be / bessaconstr.h
index 2516d63..951edc8 100644 (file)
@@ -1,12 +1,39 @@
+/*
+ * 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.
+ */
+
 /**
  * @file
- * @brief     Introduce several copies for one node.
- * @author    Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
- * @date      30.03.2007
- * @version   $Id$
- * Copyright: (c) Universitaet Karlsruhe
- * Licence:   This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
-
+ * @brief       SSA construction for a set of nodes
+ * @author      Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
+ * @date        30.03.2007
+ *
+ * The problem: Given a value and a set of "copies" that are known to
+ * represent the same abstract value, rewire all usages of the original value
+ * to their closest copy while introducing phis as necessary.
+ *
+ * Algorithm: Mark all blocks in the iterated dominance frontiers of the value
+ * and its copies. Link the copies ordered by dominance to the blocks.  Then
+ * we search for each use all definitions in the current block, if none is
+ * found, then we search one in the immediate dominator. If we are in a block
+ * of the dominance frontier, create a phi and do the same search for all
+ * phi arguments.
+ *
  * A copy in this context means, that you want to introduce several new
  * abstract values (in Firm: nodes) for which you know, that they
  * represent the same concrete value. This is the case if you
  * This function reroutes all uses of the original value to the copies in the
  * corresponding dominance subtrees and creates Phi functions where necessary.
  */
-#ifndef FIRM_BE_SSACONSTR_H
-#define FIRM_BE_SSACONSTR_H
+#ifndef FIRM_BE_BESSACONSTR_H
+#define FIRM_BE_BESSACONSTR_H
 
-#include <stdlib.h>
-#include "bedomfront.h"
-#include "irnode.h"
+#include <stdbool.h>
+#include "firm_types.h"
 #include "irnodeset.h"
 #include "belive.h"
-#include "beirg.h"
+#include "bitset.h"
 #include "pdeq.h"
+#include "irnodemap.h"
+#include "obst.h"
 
 typedef struct be_ssa_construction_env_t {
-       ir_graph                   *irg;
-       const be_dom_front_info_t  *domfronts;
-       ir_mode                    *mode;
-       waitq                      *worklist;
-       const ir_nodeset_t         *ignore_uses;
-       ir_node                   **new_phis;
-       int                         iterated_domfront_calculated;
+       ir_graph                    *irg;
+       ir_mode                     *mode;
+       const arch_register_req_t   *phi_req;
+       waitq                       *worklist;
+       ir_node                    **new_phis;
+       bool                         iterated_domfront_calculated;
+       ir_nodemap                   infos;
+       struct obstack               obst;
 } be_ssa_construction_env_t;
 
 /**
- * Initializes an ssa construction environment.
+ * Initializes an SSA construction environment.
+ *
+ * @param env    an empty SSA construction environment
+ * @param irg    the graph
  */
-void be_ssa_construction_init(be_ssa_construction_env_t *env, be_irg_t *birg);
+void be_ssa_construction_init(be_ssa_construction_env_t *env, ir_graph *irg);
 
 void be_ssa_construction_add_copy(be_ssa_construction_env_t *env,
                                   ir_node *value);
@@ -50,11 +82,8 @@ void be_ssa_construction_add_copy(be_ssa_construction_env_t *env,
 void be_ssa_construction_add_copies(be_ssa_construction_env_t *env,
                                     ir_node **copies, size_t copies_len);
 
-void be_ssa_construction_set_ignore_uses(be_ssa_construction_env_t *env,
-                                         const ir_nodeset_t *ignore_uses);
-
 /**
- * Reconstructs the ssa form for all users of node @p node
+ * Reconstructs the SSA form for all users of node @p node
  */
 void be_ssa_construction_fix_users(be_ssa_construction_env_t *env,
                                    ir_node *node);
@@ -72,8 +101,8 @@ void be_ssa_construction_update_liveness_phis(be_ssa_construction_env_t *env,
 ir_node **be_ssa_construction_get_new_phis(be_ssa_construction_env_t *env);
 
 /**
- * Destroys an ssa construction environment.
+ * Destroys an SSA construction environment.
  */
 void be_ssa_construction_destroy(be_ssa_construction_env_t *env);
 
-#endif
+#endif /* FIRM_BE_BESSACONSTR_H */