MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / makeFunctionEntry

Method makeFunctionEntry

SPIRV/SpvBuilder.cpp:2697–2734  ·  view source on GitHub ↗

Comments in header

Source from the content-addressed store, hash-verified

2695
2696// Comments in header
2697Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const char* name, LinkageType linkType,
2698 const std::vector<Id>& paramTypes,
2699 const std::vector<std::vector<Decoration>>& decorations, Block** entry)
2700{
2701 // Make the function and initial instructions in it
2702 Id typeId = makeFunctionType(returnType, paramTypes);
2703 Id firstParamId = paramTypes.size() == 0 ? 0 : getUniqueIds((int)paramTypes.size());
2704 Id funcId = getUniqueId();
2705 Function* function = new Function(funcId, returnType, typeId, firstParamId, linkType, name, module);
2706
2707 // Set up the precisions
2708 setPrecision(function->getId(), precision);
2709 function->setReturnPrecision(precision);
2710 for (unsigned p = 0; p < (unsigned)decorations.size(); ++p) {
2711 for (int d = 0; d < (int)decorations[p].size(); ++d) {
2712 addDecoration(firstParamId + p, decorations[p][d]);
2713 function->addParamPrecision(p, decorations[p][d]);
2714 }
2715 }
2716
2717 // reset last debug scope
2718 if (emitNonSemanticShaderDebugInfo) {
2719 dirtyScopeTracker = true;
2720 }
2721
2722 // CFG
2723 assert(entry != nullptr);
2724 *entry = new Block(getUniqueId(), *function);
2725 function->addBlock(*entry);
2726 setBuildPoint(*entry);
2727
2728 if (name)
2729 addName(function->getId(), name);
2730
2731 functions.push_back(std::unique_ptr<Function>(function));
2732
2733 return function;
2734}
2735
2736void Builder::setupFunctionDebugInfo(Function* function, const char* name, const std::vector<Id>& paramTypes,
2737 const std::vector<char const*>& paramNames)

Callers 1

makeFunctionsMethod · 0.80

Calls 6

setReturnPrecisionMethod · 0.80
addParamPrecisionMethod · 0.80
addBlockMethod · 0.80
sizeMethod · 0.45
getIdMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected