diff options
author | Andrew Macleod <amacleod@gcc.gnu.org> | 2018-03-13 18:07:07 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@gcc.gnu.org> | 2018-03-13 18:07:07 +0000 |
commit | d100d74b92d9ceacba77755482a0a85bf8798366 (patch) | |
tree | 10fa3a231b829c7677951d96e2635e6fed18e60e /gcc | |
parent | 7a4c8da51f1aed8c3c8c3e04687c96d5d15b248e (diff) | |
download | gcc-d100d74b92d9ceacba77755482a0a85bf8798366.zip gcc-d100d74b92d9ceacba77755482a0a85bf8798366.tar.gz gcc-d100d74b92d9ceacba77755482a0a85bf8798366.tar.bz2 |
hide gori_map inside ssa-range-bb.c
From-SVN: r258496
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ssa-range-bb.c | 40 | ||||
-rw-r--r-- | gcc/ssa-range-bb.h | 36 |
2 files changed, 42 insertions, 34 deletions
diff --git a/gcc/ssa-range-bb.c b/gcc/ssa-range-bb.c index 1981f8b..729e1e3 100644 --- a/gcc/ssa-range-bb.c +++ b/gcc/ssa-range-bb.c @@ -58,7 +58,33 @@ last_stmt_gori (basic_block bb) return stmt; return NULL; } + +/* GORI_MAP is used to determine what ssa-names in a block can generate range + information, and provides tools for the block ranger to enable it to + efficiently calculate these ranges. + GORI stands for "Generates Outgoing Range Information." */ +class gori_map +{ + vec<bitmap> outgoing; /* BB: Outgoing ranges generated. */ + vec<bitmap> incoming; /* BB: ranges coming in. */ + vec<bitmap> def_chain; /* SSA_NAME : def chain components. */ + void calculate_gori (basic_block bb); + bool in_chain_p (unsigned name, unsigned def); + bitmap imports (basic_block bb); + bitmap exports (basic_block bb); + bitmap calc_def_chain (tree name, basic_block bb); + void process_stmt (gimple *stmt, bitmap result, basic_block bb); +public: + gori_map (); + ~gori_map (); + bool in_chain_p (tree name, tree def, basic_block bb = NULL); + bool is_export_p (tree name, basic_block bb); + bool is_import_p (tree name, basic_block bb); + tree single_import (tree name); + void dump (FILE *f); + void dump (FILE *f, basic_block bb); +}; gori_map::gori_map () { @@ -431,8 +457,8 @@ block_ranger::process_logical (range_stmt& stmt, irange& r, tree name, op1 = stmt.operand1 (); op2 = stmt.operand2 (); - op1_in_chain = gori.in_chain_p (name, op1); - op2_in_chain = gori.in_chain_p (name, op2); + op1_in_chain = gori->in_chain_p (name, op1); + op2_in_chain = gori->in_chain_p (name, op2); /* If neither operand is derived, then this stmt tells us nothing. */ if (!op1_in_chain && !op2_in_chain) @@ -514,8 +540,8 @@ block_ranger::get_range (range_stmt& stmt, irange& r, tree name, /* Reaching this point means NAME is not in this stmt, but one of the names in it ought to be derived from it. */ - op1_in_chain = gori.in_chain_p (name, op1); - op2_in_chain = op2 && gori.in_chain_p (name, op2); + op1_in_chain = gori->in_chain_p (name, op1); + op2_in_chain = op2 && gori->in_chain_p (name, op2); /* If neither operand is derived, then this stmt tells us nothing. */ if (!op1_in_chain && !op2_in_chain) @@ -597,12 +623,14 @@ block_ranger::get_range_from_stmt (gimple *stmt, irange& r, tree name, block_ranger::block_ranger () { + gori = new gori_map (); initialize_global_ssa_range_cache (); } block_ranger::~block_ranger () { destroy_global_ssa_range_cache (); + delete gori; } void @@ -613,7 +641,7 @@ block_ranger::dump (FILE *f) return; fprintf (f, "\nDUMPING GORI MAP\n"); - gori.dump (f); + gori->dump (f); fprintf (f, "\n"); fprintf (f, "\nDUMPING Globals table\n"); @@ -672,7 +700,7 @@ block_ranger::get_derived_range_stmt (range_stmt& stmt, tree name, basic_block b bool block_ranger::range_p (basic_block bb, tree name) { - return gori.is_export_p (name, bb); + return gori->is_export_p (name, bb); } diff --git a/gcc/ssa-range-bb.h b/gcc/ssa-range-bb.h index bac2c90..c90b02c 100644 --- a/gcc/ssa-range-bb.h +++ b/gcc/ssa-range-bb.h @@ -25,33 +25,13 @@ along with GCC; see the file COPYING3. If not see #include "range-op.h" #include "ssa-range-stmt.h" -class gori_map -{ - vec<bitmap> outgoing; /* BB: Outgoing ranges generated. */ - vec<bitmap> incoming; /* BB: ranges coming in. */ - vec<bitmap> def_chain; /* SSA_NAME : def chain components. */ - void calculate_gori (basic_block bb); - bool in_chain_p (unsigned name, unsigned def); - bitmap imports (basic_block bb); - bitmap exports (basic_block bb); - bitmap calc_def_chain (tree name, basic_block bb); - void process_stmt (gimple *stmt, bitmap result, basic_block bb); -public: - gori_map (); - ~gori_map (); - bool in_chain_p (tree name, tree def, basic_block bb = NULL); - bool is_export_p (tree name, basic_block bb); - bool is_import_p (tree name, basic_block bb); - tree single_import (tree name); - void dump (FILE *f); - void dump (FILE *f, basic_block bb); -}; - - +/* This is the primary interface class for the range generator at the basic + block level. It allows the client to query a range for an ssa-name within + a basic block, either on an outgoing edge, or on an individual statement. */ class block_ranger { - gori_map gori; /* Generates Outgoing Range Info. */ + class gori_map *gori; /* Generates Outgoing Range Info. */ bool logical_expr_p (tree_code code, tree type) const; bool eval_logical (irange& r, range_stmt &stmt, const irange& lhs, const irange& op1_true, const irange& op1_false, @@ -70,16 +50,16 @@ public: bool range_p (basic_block bb, tree name); /* What is the static calculated range of NAME on outgoing edge E. */ bool range_on_edge (irange& r, tree name, edge e); - /* What infomation does stmt g provide about name. */ + /* What range does NAME have on entry to statement g. */ bool range_on_stmt (irange& r, tree name, gimple *g); - /* What infomation does stmt g provide about the defintion. */ + /* What infomation does stmt g provide about the lhs. */ bool range_of_def (irange& r, gimple *g); - /* What does g provide about the lhs if name has range_for_name. */ + /* What does g provide about the lhs if NAME has RANGE_FOR_NAME. */ bool range_of_def (irange& r, gimple *g, tree name, const irange& range_for_name); void dump (FILE *f); - void exercise (FILE *f); /* do a full mapping pass, dump if provided. */ + void exercise (FILE *f); }; #endif /* GCC_SSA_RANGE_BB_H */ |