Ejemplo n.º 1
0
void Optimize(FunctionSymbol fsym)
{
	BBlock bb;

	bb = fsym->entryBB;
	while (bb != NULL)
	{
		PeepHole(bb);
		bb = bb->next;
	}

	bb = fsym->entryBB;
	while (bb != NULL)
	{
		EliminateCode(bb);
		ExamineJump(bb);
		bb = bb->next;
	}

	bb = fsym->entryBB;
	while (bb != NULL)
	{
		bb = TryMergeBBlock(bb, bb->next);
	}
}
Ejemplo n.º 2
0
/* 优化 */
void Optimize (FunctionSymbol fsym)
{
	BBlock bb;

	for (bb = fsym->entryBB; bb; bb = bb->next) {

        /* 窥孔优化 */
		PeepHole (bb);
	}

	for (bb = fsym->entryBB; bb; bb = bb->next) {

        /* 消除无用代码 */
		EliminateCode (bb);
        /* 检查跳转 */
		ExamineJump (bb);
	}

	for (bb = fsym->entryBB; bb; ) {

        /* 合并块 */
		bb = TryMergeBBlock (bb, bb->next);
	}
}