| 19965 | } |
| 19966 | |
| 19967 | void BfModule::ProcessMethod_SetupParams(BfMethodInstance* methodInstance, BfType* thisType, bool wantsDIData, SizedArrayImpl<BfIRMDNode>* diParams) |
| 19968 | { |
| 19969 | auto methodDef = methodInstance->mMethodDef; |
| 19970 | auto methodDeclaration = methodDef->mMethodDeclaration; |
| 19971 | |
| 19972 | bool isThisStruct = false; |
| 19973 | if (thisType != NULL) |
| 19974 | isThisStruct = thisType->IsStruct() && !thisType->IsTypedPrimitive(); |
| 19975 | |
| 19976 | int argIdx = 0; |
| 19977 | |
| 19978 | if ((!mIsComptimeModule) && (argIdx == methodInstance->GetStructRetIdx())) |
| 19979 | argIdx++; |
| 19980 | |
| 19981 | auto rootMethodState = mCurMethodState->GetRootMethodState(); |
| 19982 | |
| 19983 | if (!methodDef->mIsStatic) |
| 19984 | { |
| 19985 | BfTypeCode loweredTypeCode = BfTypeCode_None; |
| 19986 | BfTypeCode loweredTypeCode2 = BfTypeCode_None; |
| 19987 | |
| 19988 | BfLocalVariable* paramVar = rootMethodState->mBumpAlloc.Alloc<BfLocalVariable>(); |
| 19989 | paramVar->mIsBumpAlloc = true; |
| 19990 | paramVar->mResolvedType = thisType; |
| 19991 | paramVar->mName.Reference("this"); |
| 19992 | if (!thisType->IsValuelessType()) |
| 19993 | paramVar->mValue = mBfIRBuilder->GetArgument(argIdx); |
| 19994 | else |
| 19995 | paramVar->mValue = mBfIRBuilder->GetFakeVal(); |
| 19996 | |
| 19997 | if ((!mIsComptimeModule) && (thisType->IsSplattable()) && (methodInstance->AllowsSplatting(-1))) |
| 19998 | { |
| 19999 | if (!thisType->IsTypedPrimitive()) |
| 20000 | paramVar->mIsSplat = true; |
| 20001 | } |
| 20002 | else if ((!mIsComptimeModule) && (!methodDef->mIsMutating) && (!methodInstance->ForcingThisPtr())) |
| 20003 | paramVar->mIsLowered = thisType->GetLoweredType(BfTypeUsage_Parameter, &loweredTypeCode, &loweredTypeCode2) != BfTypeCode_None; |
| 20004 | |
| 20005 | auto thisTypeInst = thisType->ToTypeInstance(); |
| 20006 | paramVar->mIsStruct = isThisStruct; |
| 20007 | paramVar->mAddr = BfIRValue(); |
| 20008 | paramVar->mIsThis = true; |
| 20009 | paramVar->mParamIdx = -1; |
| 20010 | if ((methodDef->mMethodType == BfMethodType_Ctor) && (mCurTypeInstance->IsStruct())) |
| 20011 | { |
| 20012 | paramVar->mAssignedKind = BfLocalVarAssignKind_None; |
| 20013 | } |
| 20014 | else |
| 20015 | { |
| 20016 | paramVar->mAssignedKind = BfLocalVarAssignKind_Unconditional; |
| 20017 | } |
| 20018 | |
| 20019 | paramVar->mReadFromId = -1; |
| 20020 | paramVar->Init(); |
| 20021 | if (methodDeclaration == NULL) |
| 20022 | UseDefaultSrcPos(); |
| 20023 | AddLocalVariableDef(paramVar); |
| 20024 | if (!thisType->IsValuelessType()) |
nothing calls this directly
no test coverage detected