aboutsummaryrefslogtreecommitdiff
path: root/gcc/misc.h
blob: 2842617bb6eec975da0b143ac0178f773f3a0cbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// -*- C++ -*-

// Miscellaneous support routines not intended for upstream merge.

// Class to report any possible changes to the IL while folding.
//
// When environment variable EVRP_TRAPS is set, it points to the
// output file to dump any IL changes to.  If EVRP_TRAPS is not set,
// any diagnostics are dumped to stderr and a trap occurs at the first
// change.

class gimple_state
{
public:
  gimple_state ();
  ~gimple_state ();
  gimple *set_orig_stmt (gimple *stmt);
  void maybe_dump_differences_and_trap (gimple *new_stmt, tree lhs = NULL);

private:
  gimple *orig_stmt;
  gimple *untainted_stmt;
  FILE *out;
  bool accumulate_changes;
};

// Hook for pretty printer to highlight a particular statement.

class highlighter
{
public:
  void set (gimple *untainted_stmt = 0,
	    gimple *old_stmt = 0, gimple *new_stmt = 0,
	    tree lhs = 0);
  void on (class pretty_printer *, int spc, gimple *);
  void off (class pretty_printer *, int spc, gimple *);
private:
  gimple *untainted_stmt;
  gimple *old_stmt;
  gimple *new_stmt;
  tree lhs;
};

extern class highlighter highlighter;

// Class to assert that the new range is at least as good as the old
// one.

class vr_comparison
{
public:
  vr_comparison (const irange *, const irange *, class vr_values * = 0);
  void compare (tree name, edge);
  void compare (gimple *);
private:
  void compare ();
  void dump_differences_and_trap () const;
  void dump_differences (FILE *) const;
  void dump_improvements (FILE *) const;
  bool new_range_is_same () const;
  bool new_range_is_better () const;
  tree m_name;
  edge m_edge;
  gimple *m_stmt;
  const irange *m_old_range;
  const irange *m_new_range;
  class vr_values *m_vr_values;
};