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

Method HandleParams

IDEHelper/Compiler/CeMachine.cpp:1998–2034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1996}
1997
1998void CeBuilder::HandleParams()
1999{
2000 auto beModule = mBeFunction->mModule;
2001// int regIdxOfs = 0;
2002// int paramOfs = 0;
2003 auto retType = mBeFunction->GetFuncType()->mReturnType;
2004
2005 int frameOffset = 0;
2006
2007 if (mCeFunction->mMaxReturnSize > 0)
2008 {
2009 mReturnVal.mKind = CeOperandKind_AllocaAddr;
2010 mReturnVal.mFrameOfs = frameOffset;
2011 frameOffset += mCeFunction->mMaxReturnSize;
2012 }
2013
2014 int paramOfs = 0;
2015 //for (int paramIdx = (int)mBeFunction->mParams.size() - 1; paramIdx >= 0; paramIdx--)
2016
2017 for (int paramIdx = 0; paramIdx < mBeFunction->mParams.size(); paramIdx++)
2018 {
2019 auto funcType = mBeFunction->GetFuncType();
2020 auto& typeParam = funcType->mParams[paramIdx + paramOfs];
2021 auto& param = mBeFunction->mParams[paramIdx + paramOfs];
2022 auto beArg = beModule->GetArgument(paramIdx + paramOfs);
2023 auto paramType = typeParam.mType;
2024
2025 CeOperand ceOperand;
2026 ceOperand.mKind = CeOperandKind_FrameOfs;
2027 ceOperand.mFrameOfs = frameOffset;
2028 ceOperand.mType = paramType;
2029
2030 frameOffset += paramType->mSize;
2031
2032 mValueToOperand[beArg] = ceOperand;
2033 }
2034}
2035
2036void CeBuilder::ProcessMethod(BfMethodInstance* methodInstance, BfMethodInstance* dupMethodInstance, bool forceIRWrites)
2037{

Callers

nothing calls this directly

Calls 3

GetFuncTypeMethod · 0.80
sizeMethod · 0.45
GetArgumentMethod · 0.45

Tested by

no test coverage detected