Commit 9d500f9a authored by Matthias Braun's avatar Matthias Braun
Browse files

put optimisation module init function declarations into firm_init.h; make loop...

put optimisation module init function declarations into firm_init.h; make loop inversion and loop peeling available in the public API.

[r26795]
parent 24a5c9dd
......@@ -878,4 +878,16 @@ int shape_blocks(ir_graph *irg);
*/
ir_graph_pass_t *shape_blocks_pass(const char *name);
/**
* Perform loop inversion on a given graph.
* Loop inversion transform a head controlled loop (like while(...) {} and
* for(...) {}) into a foot controlled loop (do {} while(...)).
*/
void do_loop_inversion(ir_graph *irg);
/**
* Perform loop peeling on a given graph.
*/
void do_loop_peeling(ir_graph *irg);
#endif
......@@ -47,16 +47,12 @@
#include "irgraph_t.h"
#include "type_t.h"
#include "entity_t.h"
#include "opt_inline_t.h"
#include "scalar_replace.h"
#include "firmstat.h"
#include "irarch.h"
#include "reassoc_t.h"
#include "funccall_t.h"
#include "irhooks.h"
#include "iredges_t.h"
#include "irmemory_t.h"
#include "tropt.h"
#include "opt_init.h"
#include "debugger.h"
#include "be_t.h"
......@@ -137,6 +133,7 @@ void ir_init(const firm_parameter_t *param)
firm_init_class_casts_opt();
/* memory disambiguation */
firm_init_memory_disambiguator();
firm_init_loop_opt();
/* Init architecture dependent optimizations. */
arch_dep_init(arch_dep_default_factory);
......
......@@ -27,7 +27,7 @@
#include <adt/raw_bitset.h>
#include "funccall_t.h"
#include "opt_init.h"
#include "irnode_t.h"
#include "irgraph_t.h"
......@@ -40,6 +40,7 @@
#include "ircons.h"
#include "iredges_t.h"
#include "irpass_t.h"
#include "iroptimize.h"
#include "analyze_irg_args.h"
#include "irhooks.h"
#include "debug.h"
......
......@@ -1147,7 +1147,7 @@ static void decision_maker(void)
unsigned do_peel = 0;
unsigned do_inversion = 1;
unsigned max_loop_opnodes = 2000000;
/* unsigned max_loop_opnodes = 2000000; */
head_inversion_node_limit = 99910;
......@@ -1184,10 +1184,11 @@ static void decision_maker(void)
if (loop_info.stores == 0 && loop_info.invariant_loads > 0)
do_peel = 1;
#else
(void) get_invariants;
#endif
do_peel = 1;
do_peel = 0;
do_inversion = 1;
/* Loop peeling */
......@@ -1300,7 +1301,6 @@ void loop_optimization(ir_graph *irg)
int sons, nr;
FIRM_DBG_REGISTER(dbg, "firm.opt.loop");
firm_dbg_set_mask(dbg, -1);
DB((dbg, LEVEL_1, " >>> loop optimization (Startnode %ld) <<<\n", get_irn_node_nr(get_irg_start(irg))));
......@@ -1308,6 +1308,7 @@ void loop_optimization(ir_graph *irg)
link_node_state_list = NULL;
/* preconditions */
edges_assure(irg);
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK|IR_RESOURCE_PHI_LIST);
collect_phiprojs(irg);
ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
......@@ -1333,6 +1334,19 @@ void loop_optimization(ir_graph *irg)
DB((dbg, LEVEL_1, " >>> loop optimization done (Startnode %ld) <<<\n", get_irn_node_nr(get_irg_start(irg))));
}
void firm_init_loop(void) {
void do_loop_inversion(ir_graph *irg)
{
/* TODO: add the code here that performs loop inversion only */
loop_optimization(irg);
}
void do_loop_peeling(ir_graph *irg)
{
/* TODO: add the code here that performs loop peeling only */
loop_optimization(irg);
}
void firm_init_loop_opt(void)
{
FIRM_DBG_REGISTER(dbg, "firm.opt.loop");
}
......@@ -19,16 +19,23 @@
/**
* @file
* @brief Optimization of function calls.
* @author Michael Beck
* @author Matthias Braun
* @brief Init functions for various optimisations
* @version $Id$
*/
#ifndef FUNCCALL_T_H
#define FUNCCALL_T_H
#ifndef FIRM_OPT_INIT_H
#define FIRM_OPT_INIT_H
#include "iroptimize.h"
void firm_init_inline(void);
/** initialize the funccall optimization */
void firm_init_funccalls(void);
#endif /* FUNCCALL_T_H */
void firm_init_reassociation(void);
void firm_init_scalar_replace(void);
void firm_init_class_casts_opt(void);
void firm_init_loop_opt(void);
#endif
......@@ -50,7 +50,7 @@
#include "irouts.h"
#include "irloop_t.h"
#include "irbackedge_t.h"
#include "opt_inline_t.h"
#include "opt_init.h"
#include "cgana.h"
#include "trouts.h"
#include "error.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.
*/
/**
* @file
* @brief Dead node elimination and Procedure Inlining.
* @version $Id: $
*/
#ifndef FIRM_OPT_INLINE_T_H
#define FIRM_OPT_INLINE_T_H
void firm_init_inline(void);
#endif
......@@ -36,6 +36,7 @@
#include "irgwalk.h"
#include "irouts.h"
#include "reassoc_t.h"
#include "opt_init.h"
#include "irhooks.h"
#include "irloop.h"
#include "pdeq.h"
......
......@@ -48,7 +48,4 @@
*/
ir_op_ops *firm_set_default_reassoc(ir_opcode code, ir_op_ops *ops);
/** Initialise the ressociation optimization */
void firm_init_reassociation(void);
#endif /* _REASSOC_T_H_ */
......@@ -29,6 +29,7 @@
#include "iroptimize.h"
#include "scalar_replace.h"
#include "opt_init.h"
#include "irflag_t.h"
#include "irouts.h"
#include "set.h"
......
......@@ -36,6 +36,4 @@
*/
int is_address_taken(ir_node *sel);
void firm_init_scalar_replace(void);
#endif /* FIRM_OPT_SCALAR_REPLACE_H */
......@@ -39,7 +39,7 @@
#include "irflag_t.h"
#include "xmalloc.h"
#include "debug.h"
#include "tropt.h"
#include "opt_init.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg;)
......
/*
* 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 Perform optimizations of the type representation.
* @version $Id: $
*/
#ifndef FIRM_OPT_TROPT_H
#define FIRM_OPT_TROPT_H
void firm_init_class_casts_opt(void);
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment