add a parameter to limit the maximum size of methods when inlining, otherwise some...
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 5 May 2008 10:46:08 +0000 (10:46 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 5 May 2008 10:46:08 +0000 (10:46 +0000)
[r19511]

include/libfirm/irgopt.h
ir/opt/opt_inline.c

index 30d63d2..91dc6ac 100644 (file)
@@ -189,9 +189,12 @@ void inline_leave_functions(int maxsize, int leavesize, int size, int ignore_run
  * Heuristic inliner. Calculates a benefice value for every call and inlines
  * those calls with a value higher than the threshold.
  *
+ *  @param maxsize     Do not inline any calls if a method has more than
+ *                     maxsize firm nodes.  It may reach this limit by
+ *                     inlineing.
  * @param threshold    inlining threshold
  */
-void inline_functions(int inline_threshold);
+void inline_functions(int maxsize, int inline_threshold);
 
 /** Code Placement.
  *
index b0fde7d..b290406 100644 (file)
@@ -1864,7 +1864,7 @@ static int calc_inline_benefice(ir_node *call, ir_graph *callee, unsigned *local
  * Heuristic inliner. Calculates a benifice value for every call and inlines
  * those calls with a value higher than the threshold.
  */
-void inline_functions(int inline_threshold) {
+void inline_functions(int maxsize, int inline_threshold) {
        inline_irg_env   *env;
        int              i, n_irgs;
        ir_graph         *rem;
@@ -1916,6 +1916,8 @@ void inline_functions(int inline_threshold) {
                        int        benefice;
                        unsigned   local_adr;
 
+                       if (env->n_nodes > maxsize) break;
+
                        call   = entry->call;
                        callee = entry->callee;