aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-04-03 11:52:58 +0200
committerAldy Hernandez <aldyh@redhat.com>2020-04-03 13:27:57 +0200
commit277d95af38df39caebf22c570ba05196fea462dc (patch)
treeec9073f1a4adbbddbad85649e65c3c2f2089fc5d /gcc
parente6db00c130fd95ed804387ff70da813eef8da58e (diff)
downloadgcc-277d95af38df39caebf22c570ba05196fea462dc.zip
gcc-277d95af38df39caebf22c570ba05196fea462dc.tar.gz
gcc-277d95af38df39caebf22c570ba05196fea462dc.tar.bz2
Misc header cleanups.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gimple-range-cache.cc35
-rw-r--r--gcc/gimple-range-cache.h42
-rw-r--r--gcc/gimple-range-cfg.h3
-rw-r--r--gcc/gimple-range-gori.cc3
-rw-r--r--gcc/gimple-range-gori.h3
-rw-r--r--gcc/gimple-ranger.cc81
6 files changed, 86 insertions, 81 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index bfcc890..89a2a35 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-range-stmt.h"
#include "gimple-range-cache.h"
-// During contructor, Allocate the vector of ssa_names.
+// During contructor, allocate the vector of ssa_names.
non_null_ref::non_null_ref ()
{
@@ -64,11 +64,11 @@ non_null_ref::non_null_deref_p (tree name, basic_block bb)
return bitmap_bit_p (m_nn[v], bb->index);
}
-// Allocate an populate the bitmap for NAME. An ON bit for a block index
-// indicates there is a non-null reference in that block.
-// In order to populate the bitmap, a quick run of all the immediate uses
-// are made and the statement checked to see if a non-null dereference is made
-// on that statement.
+// Allocate an populate the bitmap for NAME. An ON bit for a block
+// index indicates there is a non-null reference in that block. In
+// order to populate the bitmap, a quick run of all the immediate uses
+// are made and the statement checked to see if a non-null dereference
+// is made on that statement.
void
non_null_ref::process_name (tree name)
@@ -111,13 +111,13 @@ non_null_ref::process_name (tree name)
m_nn[v] = b;
}
-// This class implements a cache of ranges indexed by basic block.
-// It represents all that is known about an SSA_NAME on entry to each block
-// It caches a range-for-type varying range so it doesnt need to be reformed all
-// the time. If a range is ever always associated with a type, we can use that
-// instead,.
-// Whenever varying is being set for a block, the cache simply points
-// to this cached one rather than create a new one each time.
+// This class implements a cache of ranges indexed by basic block. It
+// represents all that is known about an SSA_NAME on entry to each
+// block. It caches a range-for-type varying range so it doesn't need
+// to be reformed all the time. If a range is ever always associated
+// with a type, we can use that instead. Whenever varying is being
+// set for a block, the cache simply points to this cached one rather
+// than create a new one each time.
class ssa_block_ranges
{
@@ -190,8 +190,8 @@ ssa_block_ranges::set_bb_varying (const basic_block bb)
m_tab[bb->index] = m_type_range;
}
-// Return the range associated with block BB in R. Return false if there is no
-// range,
+// Return the range associated with block BB in R. Return false if
+// there is no range.
bool
ssa_block_ranges::get_bb_range (irange &r, const basic_block bb)
@@ -290,7 +290,8 @@ block_range_cache::set_bb_varying (tree name, const basic_block bb)
return get_block_ranges (name).set_bb_varying (bb);
}
-// Return the range for NAME on entry to BB in R. Return true if here is one.
+// Return the range for NAME on entry to BB in R. Return true if here
+// is one.
bool
block_range_cache::get_bb_range (irange &r, tree name, const basic_block bb)
@@ -414,7 +415,7 @@ ssa_global_cache::set_global_range (tree name, const irange &r)
m_tab.safe_grow_cleared (num_ssa_names + 1);
irange_storage *m = m_tab[v];
- // Ficme update in place it if fits.
+ // Fixme update in place it if fits.
// if (m && m->update (r, TREE_TYPE (name)))
// ;
// else
diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h
index b841ce2..7dfaf8f 100644
--- a/gcc/gimple-range-cache.h
+++ b/gcc/gimple-range-cache.h
@@ -32,8 +32,8 @@ class ssa_global_cache
public:
ssa_global_cache ();
~ssa_global_cache ();
- bool get_global_range (irange& r, tree name) const;
- void set_global_range (tree name, const irange&r);
+ bool get_global_range (irange &r, tree name) const;
+ void set_global_range (tree name, const irange &r);
void clear_global_range (tree name);
void clear ();
void dump (FILE *f = stderr);
@@ -41,25 +41,9 @@ private:
vec<irange_storage *> m_tab;
};
-// Class used to track non-null references of an ssa-name
-// A vector of bitmaps indexed by ssa-name is maintained. When indexed by
-// Basic Block, an on-bit indicates there is a non-null dereference for
-// that ssa_name in that basic block.
-
-class non_null_ref
-{
-public:
- non_null_ref ();
- ~non_null_ref ();
- bool non_null_deref_p (tree name, basic_block bb);
-private:
- vec <bitmap> m_nn;
- void process_name (tree name);
-};
-
-// This class manages a vector of pointers to ssa_block ranges.
-// THis provides the basis for the "range on entry" cache for
-// all ssa-names.
+// This class manages a vector of pointers to ssa_block ranges. It
+// provides the basis for the "range on entry" cache for all
+// SSA names.
class block_range_cache
{
@@ -67,7 +51,6 @@ public:
block_range_cache ();
~block_range_cache ();
- // Hide the details of the block cache with these wrappers
void set_bb_range (tree name, const basic_block bb, const irange &r);
void set_bb_varying (tree name, const basic_block bb);
bool get_bb_range (irange &r, tree name, const basic_block bb);
@@ -80,5 +63,20 @@ private:
ssa_block_ranges &get_block_ranges (tree name);
};
+// Class used to track non-null references of an SSA name. A vector
+// of bitmaps indexed by SSA name is maintained. When indexed by
+// basic block, an on-bit indicates there is a non-null dereference
+// for that SSA in that block.
+
+class non_null_ref
+{
+public:
+ non_null_ref ();
+ ~non_null_ref ();
+ bool non_null_deref_p (tree name, basic_block bb);
+private:
+ vec <bitmap> m_nn;
+ void process_name (tree name);
+};
#endif // GCC_SSA_RANGE_CACHE_H
diff --git a/gcc/gimple-range-cfg.h b/gcc/gimple-range-cfg.h
index 718a923..373fe1e 100644
--- a/gcc/gimple-range-cfg.h
+++ b/gcc/gimple-range-cfg.h
@@ -1,6 +1,7 @@
/* Header file for the gimple_ranger class.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
- Contributed by Andrew MacLeod <amacleod@redhat.com>.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@redhat.com>.
This file is part of GCC.
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index e3535c9..a591ba7 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -1,6 +1,7 @@
/* Gimple range GORI functions.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
- Contributed by Andrew MacLeod <amacleod@redhat.com>.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@redhat.com>.
This file is part of GCC.
diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h
index a393f47..4ec15aa 100644
--- a/gcc/gimple-range-gori.h
+++ b/gcc/gimple-range-gori.h
@@ -1,6 +1,7 @@
/* Header file for gimple range GORI structures.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
- Contributed by Andrew MacLeod <amacleod@redhat.com>.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@redhat.com>.
This file is part of GCC.
diff --git a/gcc/gimple-ranger.cc b/gcc/gimple-ranger.cc
index 1d3e872..812956d 100644
--- a/gcc/gimple-ranger.cc
+++ b/gcc/gimple-ranger.cc
@@ -126,7 +126,7 @@ global_ranger::range_on_entry (irange &r, basic_block bb, tree name)
// Start with any known range
gcc_assert (range_of_stmt (r, SSA_NAME_DEF_STMT (name), name));
- // Now see if there is any on_entry value which may refine it .
+ // Now see if there is any on_entry value which may refine it.
if (block_range (entry_range, bb, name))
r.intersect (entry_range);
}
@@ -142,9 +142,9 @@ global_ranger::range_on_exit (irange &r, basic_block bb, tree name)
gcc_checking_assert (bb != EXIT_BLOCK_PTR_FOR_FN (cfun));
gimple *s = last_stmt (bb);
- // If there is no statement in the block and this isnt the entry block,
- // go get the range_on_entry for this block.
- // For the entry block, a NULL stmt will return the global value for NAME.
+ // If there is no statement in the block and this isn't the entry
+ // block, go get the range_on_entry for this block. For the entry
+ // block, a NULL stmt will return the global value for NAME.
if (!s && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun))
range_on_entry (r, bb, name);
else
@@ -154,10 +154,10 @@ global_ranger::range_on_exit (irange &r, basic_block bb, tree name)
}
-// Calculate a range for statement S and return it in R. If NAME is provided
-// it represents the SSA_NAME on the LHS of the statement. It is only required
-// if there is more than one lhs/output.
-// Check the global cache for NAME first to see if the evaluation can be
+// Calculate a range for statement S and return it in R. If NAME is
+// provided it represents the SSA_NAME on the LHS of the statement.
+// It is only required if there is more than one lhs/output. Check
+// the global cache for NAME first to see if the evaluation can be
// avoided. If a range cannot be calculated, return false.
bool
@@ -192,8 +192,8 @@ global_ranger::range_of_stmt (irange &r, gimple *s, tree name)
}
-// Determine a range for OP on stmt S, returning the result in R.
-// If OP is not defined in BB, find the range on entry to this block.
+// Determine a range for OP on stmt S, returning the result in R. If
+// OP is not defined in BB, find the range on entry to this block.
void
global_ranger::range_of_ssa_name (irange &r, tree name, gimple *s)
@@ -237,8 +237,8 @@ global_ranger::range_from_import (irange &r, tree name, irange &import_range)
bool res = true;
tree import = m_gori_map.terminal_name (name);
- // This probably means the IL has changed underneath... just return false
- // until we have a more comprehensive solution
+ // This probably means the IL has changed underneath... just return
+ // false until we have a more comprehensive solution.
if (!import || (import_range.undefined_p () ||
useless_type_conversion_p (TREE_TYPE (import),
import_range.type ())))
@@ -316,9 +316,10 @@ global_ranger::export_global_ranges ()
for ( x = 1; x < num_ssa_names; x++)
{
tree name = ssa_name (x);
- if (name && !SSA_NAME_IN_FREE_LIST (name) &&
- gimple_range_ssa_p (name) && m_globals.get_global_range (r, name) &&
- !r.varying_p())
+ if (name && !SSA_NAME_IN_FREE_LIST (name)
+ && gimple_range_ssa_p (name)
+ && m_globals.get_global_range (r, name)
+ && !r.varying_p())
{
// Make sure the new range is a subset of the old range.
widest_irange old_range;
@@ -397,8 +398,9 @@ global_ranger::dump (FILE *f)
if (name && outgoing_edge_range_p (range, e, name))
{
gimple *s = SSA_NAME_DEF_STMT (name);
- // Only print the range if this is the def block,
- // or the on entry cache for either end of the edge is set.
+ // Only print the range if this is the def block, or
+ // the on entry cache for either end of the edge is
+ // set.
if ((s && bb == gimple_bb (s)) ||
block_range (range, bb, name, false) ||
block_range (range, e->dest, name, false))
@@ -501,7 +503,7 @@ global_ranger::block_range (irange &r, basic_block bb, tree name, bool calc)
def_bb = gimple_bb (def_stmt);;
if (!def_bb)
{
- // IF we get to the entry block, this better be a default def
+ // If we get to the entry block, this better be a default def
// or range_on_entry was called fo a block not dominated by
// the def. This would be a bug.
gcc_checking_assert (SSA_NAME_IS_DEFAULT_DEF (name));
@@ -521,11 +523,10 @@ global_ranger::block_range (irange &r, basic_block bb, tree name, bool calc)
// Return the static range for NAME on edge E in R. If there is no
-// range-on-entry cache for E->src, then return false.
-// If this is the def block, then see if the DEF can be evaluated with them
-// import name, otherwise use varying as the range.
-// If there is any outgoing range information on edge E, incorporate it
-// into the results.
+// range-on-entry cache for E->src, then return false. If this is the
+// def block, then see if the DEF can be evaluated with them import
+// name, otherwise use varying as the range. If there is any outgoing
+// range information on edge E, incorporate it into the results.
bool
global_ranger::edge_range (irange &r, edge e, tree name)
@@ -538,10 +539,10 @@ global_ranger::edge_range (irange &r, edge e, tree name)
if (src == def_bb)
{
- // Check to see if the import has a cache_entry, and if it does use that
- // in an evaluation to get a static starting value.
- // The import should have a range if the global range is requested
- // before any other lookups.
+ // Check to see if the import has a cache_entry, and if it does
+ // use that in an evaluation to get a static starting value.
+ // The import should have a range if the global range is
+ // requested before any other lookups.
tree term = (has_edge_range_p (e, name) ? m_gori_map.terminal_name (name)
: NULL_TREE);
if (!term || !(m_on_entry.get_bb_range (tmp, term, src) &&
@@ -556,9 +557,9 @@ global_ranger::edge_range (irange &r, edge e, tree name)
if (!m_on_entry.get_bb_range (r, name, src))
return false;
- // Check if pointers have any non-null dereferences.
- // Non-call exceptions mean we could throw in the middle of he block,
- // so just punt for now on those.
+ // Check if pointers have any non-null dereferences. Non-call
+ // exceptions mean we could throw in the middle of he block, so just
+ // punt for now on those.
if (r.varying_p () && m_non_null.non_null_deref_p (name, src) &&
!cfun->can_throw_non_call_exceptions)
r = range_nonzero (TREE_TYPE (name));
@@ -577,8 +578,8 @@ global_ranger::add_to_update (basic_block bb)
#define DEBUG_CACHE (0 && dump_file)
-// If there is anything in the iterative update_list, continue processing NAME
-// until the list of blocks is empty.
+// If there is anything in the iterative update_list, continue
+// processing NAME until the list of blocks is empty.
void
global_ranger::iterative_cache_update (tree name)
@@ -590,10 +591,11 @@ global_ranger::iterative_cache_update (tree name)
widest_irange current_range;
widest_irange e_range;
- // Process each block by seeing if it's calculated range on entry is the same
- // as it's cached value. IF there is a difference, update the cache to
- // reflect the new value, and check to see if any successors have cache
- // entries which may need to be checked for updates.
+ // Process each block by seeing if it's calculated range on entry is
+ // the same as it's cached value. IF there is a difference, update
+ // the cache to reflect the new value, and check to see if any
+ // successors have cache entries which may need to be checked for
+ // updates.
while (m_update_list.length () > 0)
{
@@ -671,8 +673,8 @@ if (DEBUG_CACHE) fprintf (dump_file, "BACK visiting block %d\n", node->index);
continue;
}
- // If the pred is entry but NOT def, then it is used before defined,
- // It'll get set to []. and no need to update it.
+ // If the pred is entry but NOT def, then it is used before
+ // defined, it'll get set to []. and no need to update it.
if (pred == ENTRY_BLOCK_PTR_FOR_FN (cfun))
continue;
@@ -690,7 +692,8 @@ if (DEBUG_CACHE) fprintf (dump_file, "BACK visiting block %d\n", node->index);
continue;
}
- // If the pred hasn't been visited (has no range), add it to the list.
+ // If the pred hasn't been visited (has no range), add it to
+ // the list.
gcc_checking_assert (!m_on_entry.bb_range_p (name, pred));
m_on_entry.set_bb_range (name, pred, undefined);
m_workback.quick_push (pred);