MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / IsInlinableFunctionCall

Method IsInlinableFunctionCall

source/opt/inline_pass.cpp:717–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715}
716
717bool InlinePass::IsInlinableFunctionCall(const Instruction* inst) {
718 if (inst->opcode() != spv::Op::OpFunctionCall) return false;
719 const uint32_t calleeFnId =
720 inst->GetSingleWordOperand(kSpvFunctionCallFunctionId);
721 const auto ci = inlinable_.find(calleeFnId);
722 if (ci == inlinable_.cend()) return false;
723
724 if (early_return_funcs_.find(calleeFnId) != early_return_funcs_.end()) {
725 // We rely on the merge-return pass to handle the early return case
726 // in advance.
727 std::string message =
728 "The function '" + id2function_[calleeFnId]->DefInst().PrettyPrint() +
729 "' could not be inlined because the return instruction "
730 "is not at the end of the function. This could be fixed by "
731 "running merge-return before inlining.";
732 consumer()(SPV_MSG_WARNING, "", {0, 0, 0}, message.c_str());
733 return false;
734 }
735
736 return true;
737}
738
739void InlinePass::UpdateSucceedingPhis(
740 std::vector<std::unique_ptr<BasicBlock>>& new_blocks) {

Callers

nothing calls this directly

Calls 6

GetSingleWordOperandMethod · 0.80
c_strMethod · 0.80
opcodeMethod · 0.45
cendMethod · 0.45
endMethod · 0.45
PrettyPrintMethod · 0.45

Tested by

no test coverage detected