aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-06-22 10:56:18 +0200
committerMartin Liska <marxin@gcc.gnu.org>2018-06-22 08:56:18 +0000
commite08bf12576ebab5ab1f0f368b03f86fc2cd463c0 (patch)
treee5853583a3e2128fb8d218e0d319e8ffed5ba27d /gcc
parent635b738209f66b9305e8f56de4e168e08c57ee62 (diff)
downloadgcc-e08bf12576ebab5ab1f0f368b03f86fc2cd463c0.zip
gcc-e08bf12576ebab5ab1f0f368b03f86fc2cd463c0.tar.gz
gcc-e08bf12576ebab5ab1f0f368b03f86fc2cd463c0.tar.bz2
Make symbol_summary::get and call_summary::get pure.
2018-06-22 Martin Liska <mliska@suse.cz> * symbol-summary.h (get): Make it pure and inline move functionality from ::get function. (get): Remove and inline into ::get and ::get_create. (get_create): Move code from ::get function. From-SVN: r261882
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/symbol-summary.h74
2 files changed, 25 insertions, 56 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6660f16..242c27d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-06-22 Martin Liska <mliska@suse.cz>
+
+ * symbol-summary.h (get): Make it pure and inline move
+ functionality from ::get function.
+ (get): Remove and inline into ::get and ::get_create.
+ (get_create): Move code from ::get function.
+
2018-06-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/85994
diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
index bf32810..26e9773 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -90,13 +90,19 @@ public:
does not exist it will be created. */
T* get_create (cgraph_node *node)
{
- return get (node->get_uid (), true);
+ bool existed;
+ T **v = &m_map.get_or_insert (node->get_uid (), &existed);
+ if (!existed)
+ *v = allocate_new ();
+
+ return *v;
}
/* Getter for summary callgraph node pointer. */
- T* get (cgraph_node *node)
+ T* get (cgraph_node *node) ATTRIBUTE_PURE
{
- return get (node->get_uid (), false);
+ T **v = m_map.get (node->get_uid ());
+ return v == NULL ? NULL : *v;
}
/* Remove node from summary. */
@@ -152,9 +158,6 @@ protected:
private:
typedef int_hash <int, 0, -1> map_hash;
- /* Getter for summary callgraph ID. */
- T *get (int uid, bool lazy_insert);
-
/* Indicates if insertion hook is enabled. */
bool m_insertion_enabled;
/* Indicates if the summary is released. */
@@ -274,28 +277,6 @@ function_summary<T *>::symtab_duplication (cgraph_node *node,
}
template <typename T>
-T*
-function_summary<T *>::get (int uid, bool lazy_insert)
-{
- gcc_checking_assert (uid > 0);
-
- if (lazy_insert)
- {
- bool existed;
- T **v = &m_map.get_or_insert (uid, &existed);
- if (!existed)
- *v = allocate_new ();
-
- return *v;
- }
- else
- {
- T **v = m_map.get (uid);
- return v == NULL ? NULL : *v;
- }
-}
-
-template <typename T>
void
gt_ggc_mx(function_summary<T *>* const &summary)
{
@@ -387,13 +368,19 @@ public:
If a summary for an edge does not exist, it will be created. */
T* get_create (cgraph_edge *edge)
{
- return get (edge->get_uid (), true);
+ bool existed;
+ T **v = &m_map.get_or_insert (edge->get_uid (), &existed);
+ if (!existed)
+ *v = allocate_new ();
+
+ return *v;
}
/* Getter for summary callgraph edge pointer. */
- T* get (cgraph_edge *edge)
+ T* get (cgraph_edge *edge) ATTRIBUTE_PURE
{
- return get (edge->get_uid (), false);
+ T **v = m_map.get (edge->get_uid ());
+ return v == NULL ? NULL : *v;
}
/* Remove edge from summary. */
@@ -437,9 +424,6 @@ protected:
private:
typedef int_hash <int, 0, -1> map_hash;
- /* Getter for summary callgraph ID. */
- T *get (int uid, bool lazy_insert);
-
/* Main summary store, where summary ID is used as key. */
hash_map <map_hash, T *> m_map;
/* Internal summary removal hook pointer. */
@@ -458,28 +442,6 @@ private:
};
template <typename T>
-T*
-call_summary<T *>::get (int uid, bool lazy_insert)
-{
- gcc_checking_assert (uid > 0);
-
- if (lazy_insert)
- {
- bool existed;
- T **v = &m_map.get_or_insert (uid, &existed);
- if (!existed)
- *v = allocate_new ();
-
- return *v;
- }
- else
- {
- T **v = m_map.get (uid);
- return v == NULL ? NULL : *v;
- }
-}
-
-template <typename T>
void
call_summary<T *>::release ()
{