MCPcopy Create free account
hub / github.com/beefytech/Beef / DoInitInjectionPass

Method DoInitInjectionPass

IDEHelper/Backend/BeMCContext.cpp:6943–7024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6941}
6942
6943void BeMCContext::DoInitInjectionPass()
6944{
6945 BP_ZONE("BeMCContext::DoInitInjectionPass");
6946
6947 for (auto mcBlock : mBlocks)
6948 {
6949 mActiveBlock = mcBlock;
6950 for (int instIdx = 0; instIdx < (int)mcBlock->mInstructions.size(); instIdx++)
6951 {
6952 auto inst = mcBlock->mInstructions[instIdx];
6953 BfIRInitType pendingInitKind = BfIRInitType_NotNeeded;
6954
6955 if (inst->mKind == BeMCInstKind_DbgDecl)
6956 {
6957 int vregIdx = inst->mArg0.mVRegIdx;
6958 auto vregInfo = mVRegInfo[vregIdx];
6959 auto dbgVar = vregInfo->mDbgVariable;
6960
6961 if (!mVRegInitializedContext.IsSet(inst->mVRegsInitialized, vregIdx))
6962 {
6963 if ((dbgVar->mPendingInitType != BfIRInitType_NotNeeded) && (dbgVar->mPendingInitType != BfIRInitType_NotNeeded_AliveOnDecl))
6964 {
6965 pendingInitKind = dbgVar->mPendingInitType;
6966 // We don't need dynLife anymore since we're explicitly writing this
6967 //vregInfo->mHasDynLife = false;
6968 //AllocInst(BeMCInstKind_Def, inst->mArg0, instIdx);
6969 }
6970 }
6971 }
6972
6973 if (pendingInitKind != BfIRInitType_NotNeeded)
6974 {
6975 int vregIdx = inst->mArg0.mVRegIdx;
6976 auto dbgVar = mVRegInfo[vregIdx]->mDbgVariable;
6977 auto varType = mVRegInfo[vregIdx]->mType;
6978 auto initType = dbgVar->mPendingInitType;
6979
6980 if (varType->IsFloat())
6981 {
6982 BeMCOperand zeroVal;
6983 if (varType->mTypeCode == BeTypeCode_Float)
6984 zeroVal.mKind = BeMCOperandKind_Immediate_f32;
6985 else
6986 zeroVal.mKind = BeMCOperandKind_Immediate_f64;
6987 if (initType == BfIRInitType_Uninitialized)
6988 {
6989 if (varType->mTypeCode == BeTypeCode_Float)
6990 zeroVal.mImmF32 = NAN;
6991 else
6992 zeroVal.mImmF64 = NAN;
6993 }
6994 else
6995 {
6996 if (varType->mTypeCode == BeTypeCode_Float)
6997 zeroVal.mImmF32 = 0;
6998 else
6999 zeroVal.mImmF64 = 0;
7000 }

Callers

nothing calls this directly

Calls 4

IsNonVectorCompositeMethod · 0.80
sizeMethod · 0.45
IsSetMethod · 0.45
IsFloatMethod · 0.45

Tested by

no test coverage detected