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

Method GetCallArgVReg

IDEHelper/Backend/BeMCContext.cpp:2805–2868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2803}
2804
2805BeMCOperand BeMCContext::GetCallArgVReg(int argIdx, BeTypeCode typeCode)
2806{
2807 int pIdx = argIdx;
2808
2809 BeMCNativeTypeCode vregType = BeMCNativeTypeCode_Int64;
2810 switch (typeCode)
2811 {
2812 case BeTypeCode_Int8:
2813 vregType = BeMCNativeTypeCode_Int8;
2814 break;
2815 case BeTypeCode_Int16:
2816 vregType = BeMCNativeTypeCode_Int16;
2817 break;
2818 case BeTypeCode_Int32:
2819 vregType = BeMCNativeTypeCode_Int32;
2820 break;
2821 case BeTypeCode_Int64:
2822 vregType = BeMCNativeTypeCode_Int64;
2823 break;
2824 case BeTypeCode_Float:
2825 vregType = BeMCNativeTypeCode_Float;
2826 break;
2827 case BeTypeCode_Double:
2828 vregType = BeMCNativeTypeCode_Double;
2829 break;
2830 case BeTypeCode_M128:
2831 vregType = BeMCNativeTypeCode_M128;
2832 break;
2833 case BeTypeCode_M256:
2834 vregType = BeMCNativeTypeCode_M256;
2835 break;
2836 case BeTypeCode_M512:
2837 vregType = BeMCNativeTypeCode_M512;
2838 break;
2839 default:
2840 typeCode = BeTypeCode_Int64;
2841 vregType = BeMCNativeTypeCode_Int64;
2842 break;
2843 }
2844
2845 Array<int>& callArgVRegs = mCallArgVRegs[vregType];
2846 while (pIdx >= (int)callArgVRegs.size())
2847 callArgVRegs.push_back(-1);
2848 if (callArgVRegs[pIdx] == -1)
2849 {
2850 auto nativeType = mModule->mContext->GetPrimitiveType(typeCode);
2851 auto nativePtrType = mModule->mContext->GetPointerTo(nativeType);
2852 auto mcArg = AllocVirtualReg(nativePtrType);
2853 auto vregInfo = mVRegInfo[mcArg.mVRegIdx];
2854 vregInfo->mMustExist = true;
2855 vregInfo->mIsExpr = true;
2856 vregInfo->mRelTo = BeMCOperand::FromReg(X64Reg_RSP);
2857 vregInfo->mRelOffset = BeMCOperand::FromImmediate(argIdx * 8);
2858 callArgVRegs[pIdx] = mcArg.mVRegIdx;
2859 mcArg.mKind = BeMCOperandKind_VRegLoad;
2860 return mcArg;
2861 }
2862 else

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.45
push_backMethod · 0.45
GetPrimitiveTypeMethod · 0.45
GetPointerToMethod · 0.45

Tested by

no test coverage detected