public override void CGenStmt(Env env, CGenState state) { ExprType ret_type = env.GetCurrentFunction().ret_t; Int32 stack_size = state.StackSize; // Evaluate the value. expr.CGenValue(env, state); // If the function returns a struct, copy it to the address given by 8(%ebp). if (expr.type is TStructOrUnion) { state.MOVL(Reg.EAX, Reg.ESI); state.MOVL(2 * ExprType.SIZEOF_POINTER, Reg.EBP, Reg.EDI); state.MOVL(expr.type.SizeOf, Reg.ECX); state.CGenMemCpy(); state.MOVL(2 * ExprType.SIZEOF_POINTER, Reg.EBP, Reg.EAX); } // Restore stack size. state.CGenForceStackSizeTo(stack_size); // Jump to end of the function. state.JMP(state.ReturnLabel); }