コード例 #1
0
ファイル: icode.c プロジェクト: rousojohn/AlphaCompiler
void generate_relational(iopcode op, quad *q)
{
	instruction t;
	init_instruction(&t);
	
	t.opcode = op; // # WARNING

	t.srcLine = q->line;

	make_operand(q->arg1, t.arg1);
	make_operand(q->arg2, t.arg2);

	t.result->type = label_a;

	if(q->label < currproccessedquad())
	{
		t.result->val = quads[q->label].taddress;
	}
	else
	{
		add_incomplete_jump(nextinstructionlabel(), q->label);
	}
	q->taddress = nextinstructionlabel();
	emit_icode(t);
}
コード例 #2
0
void generate_relational (int op,quad* quad) {
	struct instruction t;
	t.opcode = op;
	// printf("arg1:%d,arg2:%d\n", quad->arg1->boolConst,quad->arg2->boolConst);
	make_operand(quad->arg1, &t.arg1);
	make_operand(quad->arg2, &t.arg2);
	t.result.type = label_a;
	if (quad->label < currprocessedquad())
		t.result.val = (quads+quad->label)->taddress;
	else
		add_incomplete_jump(nextinstructionlabel(), quad->label);
	quad->taddress = nextinstructionlabel();
	emit_instruction(&t);
}