private Result OnFetchReturn() { var retn = _node.As <ReturnNode>(); _variableContext.ReturningList.Add(retn); if (_functionDeclaration.ReturnCount != 0) { var ret = _functionDeclaration.GetReturn(0); var retClass = ret.VariableType.GetRegisterClass(); _variableContext.Begin(); for (var i = 0; i < 2; i++) { var op = retn.Operands[i]; if (!op.IsVariable()) { continue; } var vd = _compiler.GetVariableData(op.Id); var va = _variableContext.Merge(vd, 0, 0); if (retClass == vd.Info.RegisterClass) { // TODO: [COMPILER] Fix HLRet fetch. va.Flags |= VariableFlags.RReg; va.InRegs = i == 0 ? Utils.Mask(RegisterIndex.Ax) : Utils.Mask(RegisterIndex.Dx); _variableContext.InRegs.Or(retClass, va.InRegs); } else if (retClass == RegisterClass.Fp) { var fldFlag = ret.VariableType == VariableType.Fp32 ? VariableFlags.X86Fld4 : VariableFlags.X86Fld8; va.Flags |= VariableFlags.RMem | fldFlag; } else { // TODO: Fix possible other return type conversions. } } _variableContext.End(_node); } if (_next.IsFetched()) { return(Result.Break); } _unreachableList.Add(_next); return(Result.NextGroup); }