OSDN Git Service

Add framework support for darwin.
[pf3gnuchains/gcc-fork.git] / gcc / value-prof.h
1 /* Definitions for transformations based on profile information for values.
2    Copyright (C) 2003 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING.  If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.  */
20
21 /* Supported histogram types.  */
22 enum hist_type
23 {
24   HIST_TYPE_INTERVAL,   /* Measures histogram of values inside a specified
25                            interval.  */
26   HIST_TYPE_POW2,       /* Histogram of power of 2 values.  */
27   HIST_TYPE_SINGLE_VALUE, /* Tries to identify the value that is (almost)
28                            always constant.  */
29   HIST_TYPE_CONST_DELTA /* Tries to identify the (almost) always constant
30                            difference between two evaluations of a value.  */
31 };
32
33 #define COUNTER_FOR_HIST_TYPE(TYPE) ((int) (TYPE) + GCOV_FIRST_VALUE_COUNTER)
34 #define HIST_TYPE_FOR_COUNTER(COUNTER) \
35   ((enum hist_type) ((COUNTER) - GCOV_FIRST_VALUE_COUNTER))
36
37 /* The value to measure.  */
38 struct histogram_value
39 {
40   rtx value;            /* The value to profile.  */
41   enum machine_mode mode; /* And its mode.  */
42   rtx seq;              /* Insns required to count the profiled value.  */
43   rtx insn;             /* Insn before that to measure.  */
44   enum hist_type type;  /* Type of information to measure.  */
45   unsigned n_counters;  /* Number of required counters.  */
46   union
47     {
48       struct
49         {
50           int int_start;        /* First value in interval.  */
51           int steps;            /* Number of values in it.  */
52           int may_be_less;      /* May the value be below?  */
53           int may_be_more;      /* Or above.  */
54         } intvl;        /* Interval histogram data.  */
55       struct
56         {
57           int may_be_other;     /* If the value may be non-positive or not 2^k.  */
58         } pow2;         /* Power of 2 histogram data.  */
59     } hdata;            /* Profiled information specific data.  */
60 };
61
62 extern void find_values_to_profile (unsigned *, struct histogram_value **);
63 extern void free_profiled_values (unsigned, struct histogram_value *);
64 extern bool value_profile_transformations (void);