Ejemplo n.º 1
0
/* Live register analysis {{{ */
void Node::LiveRegisterAnalysis(Node_list& nodes)
{
	bool changed;

	do
	{
//		message(".");
		changed = false;

		for (Node_list::reverse_iterator item = nodes.rbegin();
				item != nodes.rend();
				item++)
		{
			Node_ptr node = *item;
			
			BoolArray prev_live_in = node->mLiveIn;
			BoolArray prev_live_out = node->mLiveOut;
			
			for (int i = 0; i < node->SuccessorCount(); i++)
			{
				if (node->Successor(i).get())
					node->mLiveOut |= node->Successor(i)->mLiveIn;
			}

			node->mLiveIn = node->Uses() | (node->mLiveOut & ~node->Definitions());

			if ((prev_live_in != node->mLiveIn) || (prev_live_out != node->mLiveOut))
				changed = true;
		}
	
	} while (changed);
}/*}}}*/
Ejemplo n.º 2
0
	void operator() (Node_ptr node)
	{
		for (int i = 0; i < node->SuccessorCount(); i++)
		{
			Node_map::iterator item = mMap.find( node->SuccessorAddress(i) );
			if (mMap.end() != item)
			{
				bool success = node->ConnectSuccessor(i, item->second);
				if (!success)
				{
					message("Failed to connect successor\n");
				}
			}
			else
			{
				message("%p Unable to find successor block with address %p\n",
						node->Address(),
						node->SuccessorAddress(i) );
			}
		}
	}