/*
- * Project: libFIRM
- * File name: ir/ana/irdom.h
- * Purpose: Construct and access dominator tree.
- * Author: Goetz Lindenmaier
- * Modified by:
- * Created: 2.2002
- * CVS-ID: $Id$
- * Copyright: (c) 2002-2003 Universität Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 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 irdom.h
- *
+ * @file
+ * @brief Construct and access dominator tree.
+ * @author Goetz Lindenmaier
+ * @date 2.2002
+ * @version $Id$
+ * @summary
* This file contains routines to construct and access dominator information.
*
* The dominator information is stored in three fields of block nodes:
* - dom_depth: a number giving the depth of the block in the dominator
* tree.
* - pre_num: Number in preorder traversal.
- *
- * @author Goetz Lindenmaier
*/
-#ifndef _IRDOM_H_
-#define _IRDOM_H_
+#ifndef FIRM_ANA_IRDOM_H
+#define FIRM_ANA_IRDOM_H
#include "firm_types.h"
*/
int block_dominates(const ir_node *a, const ir_node *b);
+/**
+ * Returns the smallest common dominator block of two nodes.
+ * @param a A node.
+ * @param b Another node.
+ * @return The first block dominating @p a and @p b
+ */
+ir_node *node_smallest_common_dominator(ir_node *a, ir_node *b);
+
+/**
+ * Returns the smallest common dominator block of all users of a node
+ * BEWARE: @p irn must not be a block
+ * If on or more users are Phi nodes, one can request special handling
+ * with @p handle_phi = 1. In this case the cfg predecessor block
+ * corresponding to the position of the irn in the argument list of the
+ * Phi is determined and treated as user.
+ *
+ * @param irn A node.
+ * @param handle_phi 1 if Phis should be handled different
+ * @return The first block dominating all users of @irn
+ */
+ir_node *node_users_smallest_common_dominator(ir_node *irn, int handle_phi);
+
/**
* Check, if a block post dominates another block.
* @param a The first block.
/** Frees the post dominator data structures. Sets the flag in irg to "dom_none". */
void free_postdom(ir_graph *irg);
-#endif /* _IRDOM_H_ */
+#endif