From 569b35fd18df0735bdee043d5b24ff46d41aae66 Mon Sep 17 00:00:00 2001 From: Erick Ochoa Date: Wed, 2 Dec 2020 11:41:20 +0100 Subject: stack to vec --- gcc/ipa-type-escape-analysis.c | 22 ++++++++++++---------- gcc/ipa-type-escape-analysis.h | 3 ++- 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 *whitelisted2) : _type_escaper (types), _whitelisted2(whitelisted2) + expr_escaper (tpartitions_t &types, hash_map *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 _stack; + vec _stack2; // Reason to propagate across all subexpressions. Reason _r; -- cgit v1.2.3