Lines Matching defs:start

159     bool spirvbin_t::isStripOp(spv::Op opCode, unsigned start) const
168 const std::string name = literalString(start + 2);
383 [&](spv::Op opCode, unsigned start) {
385 if (isStripOp(opCode, start))
386 stripInst(start);
396 [&](spv::Op opCode, unsigned start) {
403 if (idPosR.find(asId(start+1)) == idPosR.end())
404 stripInst(start);
439 [&](spv::Op opCode, unsigned start) {
440 unsigned word = start+1;
449 idPosR[resultId] = start;
463 const spv::Id target = asId(start+1);
464 const std::string name = literalString(start+2);
468 ++fnCalls[asId(start + 3)];
470 entryPoint = asId(start + 2);
477 fnStart = start;
478 fnRes = asId(start + 2);
482 error("function end without function start");
486 fnPos[fnRes] = range_t(fnStart, start + asWordCount(start));
492 assert(asId(start + 2) != spv::NoResult);
493 typeConstPos.insert(start);
495 assert(asId(start + 1) != spv::NoResult);
496 typeConstPos.insert(start);
751 // Build local table of instruction start positions
753 [&](spv::Op, unsigned start) { instPos.push_back(start); return true; },
767 const unsigned start = instPos[entry];
768 const spv::Op opCode = asOpCode(start);
771 fnId = asId(start + 2);
778 const unsigned word = start + (spv::InstructionDesc[opCode].hasType() ? 2 : 1);
810 [&](spv::Op opCode, unsigned start) {
816 fnId = asId(start + 2);
878 [&](spv::Op opCode, unsigned start) {
880 if ((opCode == spv::OpVariable && asWordCount(start) == 4) &&
881 (spv[start+3] == spv::StorageClassUniform ||
882 spv[start+3] == spv::StorageClassUniformConstant ||
883 spv[start+3] == spv::StorageClassInput))
884 fnLocalVars.insert(asId(start+2));
886 if (opCode == spv::OpAccessChain && fnLocalVars.count(asId(start+3)) > 0)
887 fnLocalVars.insert(asId(start+2));
889 if (opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0) {
890 idMap[asId(start+2)] = asId(start+3);
891 stripInst(start);
908 [&](spv::Op opCode, unsigned start) {
910 if ((opCode == spv::OpVariable && asWordCount(start) == 4) &&
911 (spv[start+3] == spv::StorageClassOutput))
912 fnLocalVars.insert(asId(start+2));
914 if (opCode == spv::OpStore && fnLocalVars.count(asId(start+1)) > 0) {
915 idMap[asId(start+2)] = asId(start+1);
916 stripInst(start);
947 [&](spv::Op opCode, unsigned start) {
948 const int wordCount = asWordCount(start);
955 if ((opCode == spv::OpVariable && spv[start+3] == spv::StorageClassFunction && asWordCount(start) == 4)) {
956 fnLocalVars.insert(asId(start+2));
961 if ((opCode == spv::OpAccessChain || opCode == spv::OpInBoundsAccessChain) && fnLocalVars.count(asId(start+3)) > 0) {
962 fnLocalVars.erase(asId(start+3));
963 idMap.erase(asId(start+3));
967 if (opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0) {
968 const spv::Id varId = asId(start+3);
977 if (wordCount > 4 && (spv[start+4] & spv::MemoryAccessVolatileMask)) {
993 if (opCode == spv::OpStore && fnLocalVars.count(asId(start+1)) > 0) {
994 const spv::Id varId = asId(start+1);
997 idMap[varId] = asId(start+2);
1005 if (wordCount > 3 && (spv[start+3] & spv::MemoryAccessVolatileMask)) {
1006 fnLocalVars.erase(asId(start+3));
1007 idMap.erase(asId(start+3));
1037 [&](spv::Op opCode, unsigned start) {
1038 if (opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0)
1039 idMap[asId(start+2)] = idMap[asId(start+3)];
1063 [&](spv::Op opCode, unsigned start) {
1064 if ((opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0) ||
1065 (opCode == spv::OpStore && fnLocalVars.count(asId(start+1)) > 0) ||
1066 (opCode == spv::OpVariable && fnLocalVars.count(asId(start+2)) > 0)) {
1068 stripInst(start);
1111 [&](spv::Op opCode, unsigned start) {
1113 const auto call_it = fnCalls.find(asId(start + 3));
1144 [&](spv::Op opCode, unsigned start) {
1146 ++varUseCount[asId(start+2)];
1149 const int wordCount = asWordCount(start);
1151 ++varUseCount[asId(start+i)];
1166 [&](spv::Op opCode, unsigned start) {
1169 id = asId(start+2);
1171 id = asId(start+1);
1174 stripInst(start);
1260 // Compare literals in range [start,end)
1294 // Return start position in SPV of given Id. error if not found.