(********************************************************************)
(*                                                                  *)
(*  stat.s7i      Statistics support.                               *)
(*  Copyright (C) 1990 - 1994, 2004 - 2014, 2022  Thomas Mertes     *)
(*                                                                  *)
(*  This file is part of the Seed7 compiler.                        *)
(*                                                                  *)
(*  This program is free software; you can redistribute it and/or   *)
(*  modify it under the terms of the GNU General Public License as  *)
(*  published by the Free Software Foundation; either version 2 of  *)
(*  the License, or (at your option) any later version.             *)
(*                                                                  *)
(*  This program is distributed in the hope that it will be useful, *)
(*  but WITHOUT ANY WARRANTY; without even the implied warranty of  *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *)
(*  GNU General Public License for more details.                    *)
(*                                                                  *)
(*  You should have received a copy of the GNU General Public       *)
(*  License along with this program; if not, write to the           *)
(*  Free Software Foundation, Inc., 51 Franklin Street,             *)
(*  Fifth Floor, Boston, MA  02110-1301, USA.                       *)
(*                                                                  *)
(********************************************************************)


var integer: countOptimizations            is 0;
var integer: countInlinedFunctions         is 0;
var integer: countEvaluations              is 0;
var integer: countDivisionChecks           is 0;
var integer: countOptimizedDivisionChecks  is 0;
var integer: countRangeChecks              is 0;
var integer: countOptimizedRangeChecks     is 0;
var integer: countNoRangeChecks            is 0;
var integer: countIndexChecks              is 0;
var integer: countOptimizedIndexChecks     is 0;
var integer: countSuppressedIndexChecks    is 0;
var integer: countOverflowChecks           is 0;
var integer: countOptimizedOverflowChecks  is 0;
var integer: countSuppressedOverflowChecks is 0;


const proc: countDivisionOptimizations (in expr_type: c_expr) is func
  begin
    incr(countOptimizedDivisionChecks);
    # writeln(c_expr.currentFile <& "(" <& c_expr.currentLine <& "): Division check optimized away.");
  end func;


const proc: countIndexOptimizations (in expr_type: c_expr) is func
  begin
    incr(countOptimizedIndexChecks);
    # writeln(c_expr.currentFile <& "(" <& c_expr.currentLine <& "): Index check optimized away.");
  end func;


const proc: countRangeOptimizations (in expr_type: c_expr) is func
  begin
    incr(countOptimizedRangeChecks);
    # writeln(c_expr.currentFile <& "(" <& c_expr.currentLine <& "): Range check optimized away.");
  end func;


const proc: countOverflowOptimizations (in expr_type: c_expr) is func
  begin
    incr(countOptimizedOverflowChecks);
    # writeln(c_expr.currentFile <& "(" <& c_expr.currentLine <& "): Overflow check optimized away.");
  end func;