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

Method HandleNextCmd

IDEHelper/Backend/BeIRCodeGen.cpp:1135–3741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133}
1134
1135void BeIRCodeGen::HandleNextCmd()
1136{
1137 if (mFailed)
1138 {
1139 mStream->SetReadPos(mStream->GetSize());
1140 return;
1141 }
1142
1143 int curId = mCmdCount;
1144
1145 BfIRCmd cmd = (BfIRCmd)mStream->Read();
1146 mCmdCount++;
1147
1148#ifdef CODEGEN_TRACK
1149 gBEMemReporter.BeginSection(gIRCmdNames[cmd]);
1150 gBEMemReporter.Add(1);
1151#endif
1152
1153 switch (cmd)
1154 {
1155 case BfIRCmd_Module_Start:
1156 {
1157 CMD_PARAM(String, moduleName);
1158 CMD_PARAM(int, ptrSize);
1159 CMD_PARAM(bool, isOptimized);
1160
1161 BF_ASSERT(mBeModule == NULL);
1162 mPtrSize = ptrSize;
1163 mIsOptimized = isOptimized;
1164 mBeContext = new BeContext();
1165 mBeModule = new BeModule(moduleName, mBeContext);
1166 mBeModule->mBeIRCodeGen = this;
1167 mBeContext->mPointerSize = ptrSize;
1168
1169 for (auto constInt : mConfigConsts)
1170 {
1171 auto constVal = mBeModule->mAlloc.Alloc<BeConstant>();
1172 constVal->mType = mBeContext->GetPrimitiveType(BeTypeCode_Int32);
1173 constVal->mInt64 = constInt;
1174 mBeModule->mConfigConsts32.Add(constVal);
1175
1176 constVal = mBeModule->mAlloc.Alloc<BeConstant>();
1177 constVal->mType = mBeContext->GetPrimitiveType(BeTypeCode_Int64);
1178 constVal->mInt64 = constInt;
1179 mBeModule->mConfigConsts64.Add(constVal);
1180 }
1181 }
1182 break;
1183 case BfIRCmd_Module_SetTargetTriple:
1184 {
1185 CMD_PARAM(String, targetTriple);
1186 CMD_PARAM(String, targetCPU);
1187 mBeModule->mTargetTriple = targetTriple;
1188 mBeModule->mTargetCPU = targetCPU;
1189 }
1190 break;
1191 case BfIRCmd_Module_AddModuleFlag:
1192 {

Callers

nothing calls this directly

Calls 15

FailFunction · 0.85
ReadFunction · 0.85
SetReadPosMethod · 0.80
BeginSectionMethod · 0.80
CreateStructMethod · 0.80
SetStructBodyMethod · 0.80
CreateVectorTypeMethod · 0.80
AreTypesEqualMethod · 0.80
CreateCmpMethod · 0.80
CreateBinaryOpMethod · 0.80
CreateGEPMethod · 0.80
GetConstantNullMethod · 0.80

Tested by

no test coverage detected