/*
- * Project: libFIRM
- * File name: ir/opt/escape_ana.h
- * Purpose: escape analysis and optimization
- * Author: Michael Beck
- * Modified by:
- * Created: 03.11.2005
- * CVS-ID: $Id$
- * Copyright: (c) 1999-2005 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
+ * @brief escape analysis and optimization
+ * @author Michael Beck
+ * @date 03.11.2005
+ * @version $Id$
*/
-#ifndef _IR_OPT_ESCAPE_ANA_H_
-#define _IR_OPT_ESCAPE_ANA_H_
+#ifndef FIRM_OPT_IR_OPT_ESCAPE_ANA_H
+#define FIRM_OPT_IR_OPT_ESCAPE_ANA_H
#include "firm_types.h"
+/**
+ * A callback that checks whether a entity is an allocation
+ * routine.
+ */
+typedef int (*check_alloc_entity_func)(ir_entity *ent);
+
/**
* Do simple and fast escape analysis for one graph.
*
- * @param irg the graph
+ * @param irg the graph
+ * @param callback a callback function to check whether a
+ * given entity is a allocation call
*/
-void escape_enalysis_irg(ir_graph *irg);
+void escape_enalysis_irg(ir_graph *irg, check_alloc_entity_func callback);
/**
* Do simple and fast escape analysis for all graphs.
* @param run_scalar_replace if this flag in non-zero, scalar
* replacement optimization is run on graphs with removed
* allocation
+ * @param callback a callback function to check whether a
+ * given entity is a allocation call
*
* This optimization removes allocation which are not used (rare) and replace
* allocation that can be proved dead at the end of the graph which stack variables.
*
* This is most effective on Java where no other stack variables exists.
*/
-void escape_analysis(int run_scalar_replace);
+void escape_analysis(int run_scalar_replace, check_alloc_entity_func callback);
-#endif /* _IR_OPT_ESCAPE_ANA_H_ */
+#endif