void generate_RETURN(quad *quad){ quad->taddress = nextInstructionLabel(); instruction *t = (instruction *)malloc(sizeof(instruction)); instruction *t1 = (instruction *)malloc(sizeof(instruction)); t->arg1 = malloc(sizeof(vmarg)); t->result = malloc(sizeof(vmarg)); t1->result = malloc(sizeof(vmarg)); funcs *fun; if(quad->result!=NULL){ t->opcode = assign_v; make_retvaloperand(t->result); make_operand(quad->result, t->arg1); reset_operand(t->arg2); t->srcLine = quad->line; emitVmarg(t); } fun = topSym(); fun->nodeR = appendR(fun->nodeR,nextInstructionLabel()); t1->opcode = jump_v; reset_operand(t1->arg1); reset_operand(t1->arg2); t->arg1 = malloc(sizeof(vmarg)); make_retvaloperand(t1->result); (t1->result)->type = label_a; t1->srcLine = quad->line; emitVmarg(t1); }
void generate_GETRETVAL(quad* quad) { quad->taddress = nextinstructionlabel(); struct instruction t; t.opcode = assign_v; make_operand(quad->result, &t.result); make_retvaloperand(&t.arg1); emit_instruction(&t); }
void generate_GETRETVAL(quad *q){ instruction * t = (instruction *) malloc (sizeof(instruction)); q->taddress = NEXTINSTRUCTIONLABEL; t->srcLine= q->line; t->opcode = assign_v; if(q->result) make_operand(q->result,&(t->result)); make_retvaloperand(&(t->arg1)); emit_t(t); }
void generate_GETRETVAL(quad *q) { q->taddress = nextinstructionlabel(); instruction t; init_instruction(&t); t.srcLine = q->line; t.opcode = assign_v; make_operand(q->arg1, t.arg1); make_retvaloperand(t.result); emit_icode(t); }
void generate_RETURN(quad *q){ SymbolTableEntry *f; instruction * t = (instruction *) malloc (sizeof(instruction)); q->taddress = NEXTINSTRUCTIONLABEL; t->srcLine= q->line; t->opcode = assign_v; if(q->result) make_operand(q->result, &(t->arg1)); make_retvaloperand(&(t->result)); emit_t(t); f = top_func(funcStack); LIST_INSERT(f->returnList, LABELSTATEMENT(NEXTINSTRUCTIONLABEL), returnElem, ADD_2_BACK); t = (instruction *) malloc (sizeof(instruction)); t->opcode = jump_v; RESET_OPERAND(&(t->arg1)); RESET_OPERAND(&(t->arg2)); t->result.type = label_a; emit_t(t); }
void generate_RETURN(quad* quad){ quad->taddress = nextinstructionlabel(); struct instruction t; t.opcode = assign_v; make_retvaloperand(&t.result); t.arg2.type=nil_a; make_operand(quad->arg1, &t.arg1); emit_instruction(&t); struct userfunc* f; f = functop(funcstack); f->returnList = (struct userfunc*)malloc(sizeof(struct userfunc)); append(f->returnList, nextinstructionlabel()); t.opcode = jump_v; reset_operand(&t.arg1); t.arg1.type = nil_a; reset_operand(&t.arg2); t.result.type = label_a; //printf("%d LABEL_A\n",f->returnList->address); emit_instruction(&t); }
void generate_RETURN(quad *q) { q->taddress = nextinstructionlabel(); instruction t1, t2; init_instruction(&t1); init_instruction(&t2); t1.srcLine = q->line; t1.opcode = assign_v; make_retvaloperand(t1.result); make_operand(q->arg1, t1.arg1); emit_icode(t1); SymbolTableEntry *f = top_func(funcstack); append(f->returnList, nextinstructionlabel()); t2.opcode = jump_v; t2.srcLine = q->line; t2.result->type = label_a; emit_icode(t2); }