예제 #1
0
파일: gen.c 프로젝트: descent/ucc-code
void StartBBlock(BBlock bb)
{
	IRInst lasti;

	CurrentBB->next = bb;
	bb->prev = CurrentBB;
	lasti = CurrentBB->insth.prev;
	if (lasti->opcode != JMP && lasti->opcode != IJMP)
	{
		DrawCFGEdge(CurrentBB, bb);
	}
	CurrentBB = bb;
}
예제 #2
0
파일: gen.c 프로젝트: descent/ucc-code
void GenerateJump(BBlock dstBB)
{
	IRInst inst;

	ALLOC(inst);
	dstBB->ref++;
	DrawCFGEdge(CurrentBB, dstBB);
	inst->ty = T(VOID);
	inst->opcode = JMP;
	inst->opds[0] = (Symbol)dstBB;
	inst->opds[1] = inst->opds[2] = NULL;
	AppendInst(inst);
}
예제 #3
0
파일: gen.c 프로젝트: descent/ucc-code
void GenerateBranch(Type ty, BBlock dstBB, int opcode, Symbol src1, Symbol src2)
{
	IRInst inst;

	ALLOC(inst);
	dstBB->ref++;
	src1->ref++;
	if (src2) src2->ref++;
	DrawCFGEdge(CurrentBB, dstBB);
	inst->ty = ty;
	inst->opcode  = opcode;
	inst->opds[0] = (Symbol)dstBB;
	inst->opds[1] = src1;
	inst->opds[2] = src2;
	AppendInst(inst);
}
예제 #4
0
/* 将bb 设置成当前块 */
void StartBBlock (BBlock bb)
{
	IRInst lasti;

    /* 链接到基本块 */
	CurrentBB->next = bb;
	bb->prev = CurrentBB;

    /* 当前基本块的上一条指令 */
	lasti = CurrentBB->insth.prev;
	if (lasti->opcode != JMP && lasti->opcode != IJMP) {

		DrawCFGEdge (CurrentBB, bb);
	}
    /* 改变当前块的位置 */
	CurrentBB = bb;
}
예제 #5
0
파일: gen.c 프로젝트: descent/ucc-code
void GenerateIndirectJump(BBlock *dstBBs, int len, Symbol index)
{
	IRInst inst;
	int i;
	
	ALLOC(inst);
	index->ref++;
	for (i = 0; i < len; ++i)
	{
		dstBBs[i]->ref++;
		DrawCFGEdge(CurrentBB, dstBBs[i]);
	}
	inst->ty = T(VOID);
	inst->opcode = IJMP;
	inst->opds[0] = (Symbol)dstBBs;
	inst->opds[1] = index;
	inst->opds[2] = NULL;
	AppendInst(inst);
}