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

Method ConstToMemory

IDEHelper/Compiler/BfIRBuilder.cpp:4338–4357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4336}
4337
4338BfIRValue BfIRBuilder::ConstToMemory(BfIRValue constVal)
4339{
4340 auto constant = GetConstant(constVal);
4341 BfIRValue* value = NULL;
4342 if (mConstMemMap.TryGetValue(constVal.mId, &value))
4343 return *value;
4344
4345 BfIRType constType;
4346 if (constant->mConstType == BfConstType_Agg)
4347 constType = ((BfConstantAgg*)constant)->mType;
4348 else if (constant->mConstType == BfConstType_AggZero)
4349 constType = constant->mIRType;
4350 else if (constant->mTypeCode == BfTypeCode_NullPtr)
4351 constType = constant->mIRType;
4352 else
4353 BF_FATAL("Invalid const type for ConstToMemory");
4354 auto memVal = CreateGlobalVariable(constType, true, BfIRLinkageType_Internal, constVal, StrFormat("__constMem%d", constVal.mId));
4355 mConstMemMap[constVal.mId] = memVal;
4356 return memVal;
4357}
4358
4359BfIRValue BfIRBuilder::GetConfigConst(BfIRConfigConst constType, BfTypeCode typeCode)
4360{

Callers 1

Calls 1

TryGetValueMethod · 0.80

Tested by

no test coverage detected