コード例 #1
0
ファイル: gen.c プロジェクト: zhanglp92/splos_parser
/* 
 * CallInst     -> [VarName =] call VarName(Operand, Operand, ...)
 * */
void GenerateFunctionCall (Type ty, Symbol recv, Symbol faddr, Vector args, int callNum)
{
	ILArg   p;
	IRInst  inst;

	CALLOC(inst);
	if (recv) 
        recv->ref++;
	faddr->ref++;

	FOR_EACH_ITEM (ILArg, p, args)
		p->sym->ref++;
	ENDFOR

	inst->ty      = ty;
	inst->opcode  = CALL;
    inst->callNum = callNum;
    /* 返回值 */
	inst->opds[0] = recv;
	inst->opds[1] = faddr;
    /* 参数 */
	inst->opds[2] = (Symbol)args;
	AppendInst (inst);

    /* 给返回值创建临时变量 */
	if (recv != NULL)
		DefineTemp (recv, CALL, (Symbol)inst, NULL);
}
コード例 #2
0
static int
hc_decode_stat(hctransaction_t trans, struct stat *st, struct HCHead *head)
{
    struct HCLeaf *item;

    bzero(st, sizeof(*st));
    FOR_EACH_ITEM(item, trans, head)
	hc_decode_stat_item(st, item);
    return(0);
}