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

Method ApplySimdFeatures

IDEHelper/Compiler/BfIRCodeGen.cpp:6221–6253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6219}
6220
6221void BfIRCodeGen::ApplySimdFeatures()
6222{
6223 Array<std::tuple<llvm::Function*, BfIRSimdType>> functionsToProcess;
6224
6225 for (auto pair : mFunctionsUsingSimd)
6226 functionsToProcess.Add({ pair.mKey, pair.mValue });
6227
6228 while (functionsToProcess.Count() > 0)
6229 {
6230 auto tuple = functionsToProcess.front();
6231 functionsToProcess.RemoveAt(0);
6232
6233 auto function = std::get<0>(tuple);
6234 auto simdType = std::get<1>(tuple);
6235
6236 auto currentSimdType = GetSimdTypeFromFunction(function);
6237 simdType = simdType > currentSimdType ? simdType : currentSimdType;
6238
6239 function->addFnAttr("target-features", GetSimdTypeString(simdType).c_str());
6240
6241 if (function->hasFnAttribute(llvm::Attribute::AlwaysInline))
6242 {
6243 for (auto user : function->users())
6244 {
6245 if (auto call = llvm::dyn_cast<llvm::CallInst>(user))
6246 {
6247 auto func = call->getFunction();
6248 functionsToProcess.Add({ func, simdType });
6249 }
6250 }
6251 }
6252 }
6253}
6254
6255int BfIRCodeGen::GetIntrinsicId(const StringImpl& name)
6256{

Callers

nothing calls this directly

Calls 5

CountMethod · 0.80
frontMethod · 0.80
AddMethod · 0.45
RemoveAtMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected