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

Method GetIRCallingConvention

IDEHelper/Compiler/BfModule.cpp:18479–18505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18477}
18478
18479BfIRCallingConv BfModule::GetIRCallingConvention(BfMethodInstance* methodInstance)
18480{
18481 auto methodDef = methodInstance->mMethodDef;
18482 BfTypeInstance* owner = NULL;
18483 if (!methodDef->mIsStatic)
18484 owner = methodInstance->GetThisType()->ToTypeInstance();
18485 if (owner == NULL)
18486 owner = methodInstance->GetOwner();
18487
18488 if ((mCompiler->mOptions.mMachineType != BfMachineType_x86) || (mCompiler->mOptions.mPlatformType != BfPlatformType_Windows))
18489 return BfIRCallingConv_CDecl;
18490 if (methodInstance->mCallingConvention == BfCallingConvention_Stdcall)
18491 return BfIRCallingConv_StdCall;
18492 if (methodInstance->mCallingConvention == BfCallingConvention_Fastcall)
18493 return BfIRCallingConv_FastCall;
18494 if (!methodDef->mIsStatic)
18495 {
18496 if (owner->mIsCRepr)
18497 return BfIRCallingConv_ThisCall;
18498 if ((!owner->IsValuelessType()) &&
18499 ((!owner->IsSplattable()) || (methodDef->HasNoThisSplat())))
18500 return BfIRCallingConv_ThisCall;
18501 }
18502 return BfIRCallingConv_CDecl;
18503
18504 //return GetIRCallingConvention(owner, methodInstance->mMethodDef);
18505}
18506
18507void BfModule::SetupIRMethod(BfMethodInstance* methodInstance, BfIRFunction func, bool isInlined)
18508{

Callers 4

MangleMethod · 0.80
CreateCallMethod · 0.80
VisitMethod · 0.80
GetMethodFlagsMethod · 0.80

Calls 6

HasNoThisSplatMethod · 0.80
ToTypeInstanceMethod · 0.45
GetThisTypeMethod · 0.45
GetOwnerMethod · 0.45
IsValuelessTypeMethod · 0.45
IsSplattableMethod · 0.45

Tested by

no test coverage detected