@@ -101,52 +101,6 @@ void reduceStackToLiveness(StackLayoutGenerator::StackType& _stack, std::set<SSA
101101	}
102102}
103103
104- void  junkShuffler (StackLayoutGenerator::StackType& _stack)
105- {
106- 	//  goal is to have the junk in one block at the bottom
107- 	auto  numJunk = ranges::count_if (_stack, [](auto  const & _slot) { return  std::holds_alternative<ssa::JunkSlot>(_slot); });
108- 	size_t  i = 0 ;
109- 	while  (numJunk > 0  && i < numJunk)
110- 	{
111- 		if  (std::holds_alternative<ssa::JunkSlot>(_stack.data ()[i]))
112- 		{
113- 			//  we have a block of i junk slots at the bottom
114- 			++i;
115- 			continue ;
116- 		}
117- 
118- 		if  (std::holds_alternative<ssa::JunkSlot>(_stack.top ()))
119- 		{
120- 			//  todo it might be cheaper to swap or to pop
121- 			//  if we can reach the non-junk slot, swap it up, else pop the junk
122- 
123- 			{
124- 				_stack.pop ();
125- 				--numJunk;
126- 				continue ;
127- 			}
128- 		}
129- 
130- 		//  find the next best junk
131- 		std::optional<size_t > junk (std::nullopt );
132- 		for  (size_t  junkDepth = 1 ; junkDepth < std::min (static_cast <size_t >(17 ), _stack.size ()); ++junkDepth)
133- 			if  (std::holds_alternative<ssa::JunkSlot>(_stack.slot (junkDepth)))
134- 			{
135- 				junk = junkDepth;
136- 				break ;
137- 			}
138- 
139- 		if  (junk)
140- 		{
141- 			_stack.swap (*junk);
142- 			continue ;
143- 		}
144- 
145- 		//  give up if there's no more junk in reach
146- 		break ;
147- 	}
148- }
149- 
150104}
151105
152106StackLayoutGenerator::StackLayoutGenerator (LivenessAnalysis const & _liveness, TerminationPathAnalysis const & _junkBlockFinder):
@@ -431,10 +385,6 @@ void StackLayoutGenerator::visitBlock(SSACFG::BlockId const& _blockId)
431385				requiredStackTop.emplace_back (FunctionReturnLabel{&call->call .get ()});
432386		requiredStackTop += operation.inputs ;
433387
434- 		static  auto  constexpr  slotIsCompatible = [](Slot const & _source, Slot const & _target)
435- 		{
436- 			return  std::holds_alternative<JunkSlot>(_target) || _source == _target;
437- 		};
438388
439389		for  (size_t  depth = 0 ; depth < stack.size (); ++depth)
440390			if  (!liveOutWithoutOutputsSet.contains (stack.slot (depth)) && ranges::find (requiredStackTop, stack.slot (depth)) == ranges::end (requiredStackTop))
0 commit comments