summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-12-02 11:41:20 +0100
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-12-02 11:41:20 +0100
commit569b35fd18df0735bdee043d5b24ff46d41aae66 (patch)
tree8c1f72b73727a7c199a332a47bfc35dfffef4388
parenta04e79625145e6cfcb804fff17db24a3910e1cba (diff)
stack to vec
-rw-r--r--gcc/ipa-type-escape-analysis.c22
-rw-r--r--gcc/ipa-type-escape-analysis.h3
2 files changed, 14 insertions, 11 deletions
diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c
index f465721d2bf..b22eaee4fef 100644
--- a/gcc/ipa-type-escape-analysis.c
+++ b/gcc/ipa-type-escape-analysis.c
@@ -2238,7 +2238,8 @@ expr_escaper::update (tree t, Reason r)
void
expr_escaper::_walk_pre (tree e)
{
- _stack.push (e);
+ //_stack.push (e);
+ _stack2.safe_push (e);
tree t = TREE_TYPE (e);
gcc_assert (t);
@@ -2248,7 +2249,8 @@ expr_escaper::_walk_pre (tree e)
void
expr_escaper::_walk_post (__attribute__ ((unused)) tree e)
{
- _stack.pop ();
+ //_stack.pop ();
+ _stack2.pop ();
}
/* Capture casting on LHS. */
@@ -2258,16 +2260,16 @@ expr_escaper::_walk_SSA_NAME_pre (tree e)
tree ssa_type = TREE_TYPE (e);
- if (_stack.size () < 4)
+ if (_stack2.length () < 4)
return;
- tree this_expr = _stack.top ();
- _stack.pop ();
- tree twice = _stack.top ();
- _stack.pop ();
- tree prev_expr = _stack.top ();
- _stack.push (twice);
- _stack.push (this_expr);
+ tree this_expr = _stack2.last ();
+ _stack2.pop ();
+ tree twice = _stack2.last ();
+ _stack2.pop ();
+ tree prev_expr = _stack2.last ();
+ _stack2.safe_push (twice);
+ _stack2.safe_push (this_expr);
if (TREE_CODE (prev_expr) != MEM_REF)
return;
diff --git a/gcc/ipa-type-escape-analysis.h b/gcc/ipa-type-escape-analysis.h
index f552ebea598..7573f06225e 100644
--- a/gcc/ipa-type-escape-analysis.h
+++ b/gcc/ipa-type-escape-analysis.h
@@ -907,7 +907,7 @@ private:
class expr_escaper : public expr_walker
{
public:
- expr_escaper (tpartitions_t &types, hash_map<tree, bool> *whitelisted2) : _type_escaper (types), _whitelisted2(whitelisted2)
+ expr_escaper (tpartitions_t &types, hash_map<tree, bool> *whitelisted2) : _type_escaper (types), _whitelisted2(whitelisted2), _stack2(vNULL)
{};
/* Main interface: T escapes because R. */
@@ -932,6 +932,7 @@ private:
// The bottom of the stack is the expression called on the update
// function.
std::stack<tree> _stack;
+ vec<tree> _stack2;
// Reason to propagate across all subexpressions.
Reason _r;