Lines Matching refs:src_inst
174 void MapInsts(const opt::Instruction* src_inst, in MapInsts() argument
176 assert(src_inst->HasResultId() == dst_inst->HasResultId()); in MapInsts()
177 if (src_inst->HasResultId()) { in MapInsts()
178 MapIds(src_inst->result_id(), dst_inst->result_id()); in MapInsts()
180 src_to_dst_.MapInsts(src_inst, dst_inst); in MapInsts()
181 dst_to_src_.MapInsts(dst_inst, src_inst); in MapInsts()
418 bool DoOperandsMatch(const opt::Instruction* src_inst,
422 bool DoInstructionsMatch(const opt::Instruction* src_inst,
427 bool DoInstructionsMatchFuzzy(const opt::Instruction* src_inst,
430 bool DoDebugAndAnnotationInstructionsMatch(const opt::Instruction* src_inst,
434 bool MatchOpTypeStruct(const opt::Instruction* src_inst,
437 bool MatchOpConstant(const opt::Instruction* src_inst,
439 bool MatchOpSpecConstant(const opt::Instruction* src_inst,
441 bool MatchOpVariable(const opt::Instruction* src_inst,
444 bool MatchPerVertexVariable(const opt::Instruction* src_inst,
483 void MatchVariablesUsedByMatchedInstructions(const opt::Instruction* src_inst,
525 const opt::Instruction* MappedDstInst(const opt::Instruction* src_inst);
713 const opt::Instruction* src_inst = src_id_to_.inst_map_[src_id]; in MatchIds() local
716 if (match(src_inst, dst_inst)) { in MatchIds()
747 const opt::Instruction* src_inst = sorted_src_insts[src_cur]; in MatchPreambleInstructions() local
750 int compare = ComparePreambleInstructions(src_inst, dst_inst, src_, dst_); in MatchPreambleInstructions()
752 id_map_.MapInsts(src_inst, dst_inst); in MatchPreambleInstructions()
865 for (const opt::Instruction& src_inst : src_insts) { in MatchDebugAndAnnotationInstructions() local
873 if (DoDebugAndAnnotationInstructionsMatch(&src_inst, &dst_inst)) { in MatchDebugAndAnnotationInstructions()
874 id_map_.MapInsts(&src_inst, &dst_inst); in MatchDebugAndAnnotationInstructions()
1021 bool Differ::DoOperandsMatch(const opt::Instruction* src_inst, in DoOperandsMatch() argument
1026 assert(src_inst->opcode() == dst_inst->opcode()); in DoOperandsMatch()
1032 const opt::Operand& src_operand = src_inst->GetInOperand(in_operand_index); in DoOperandsMatch()
1041 bool Differ::DoInstructionsMatch(const opt::Instruction* src_inst, in DoInstructionsMatch() argument
1046 if (MappedDstInst(src_inst) != dst_inst) { in DoInstructionsMatch()
1050 assert(src_inst->opcode() == dst_inst->opcode()); in DoInstructionsMatch()
1051 if (src_inst->NumOperands() != dst_inst->NumOperands()) { in DoInstructionsMatch()
1055 for (uint32_t operand_index = 0; operand_index < src_inst->NumOperands(); in DoInstructionsMatch()
1057 const opt::Operand& src_operand = src_inst->GetOperand(operand_index); in DoInstructionsMatch()
1109 bool Differ::DoInstructionsMatchFuzzy(const opt::Instruction* src_inst, in DoInstructionsMatchFuzzy() argument
1114 if (src_inst->opcode() != dst_inst->opcode()) { in DoInstructionsMatchFuzzy()
1119 if (src_inst->opcode() == spv::Op::OpExtInst) { in DoInstructionsMatchFuzzy()
1120 if (!DoOperandsMatch(src_inst, dst_inst, 0, 2)) { in DoInstructionsMatchFuzzy()
1125 assert(src_inst->HasResultType() == dst_inst->HasResultType()); in DoInstructionsMatchFuzzy()
1126 if (src_inst->HasResultType() && in DoInstructionsMatchFuzzy()
1127 !DoIdsMatchFuzzy(src_inst->type_id(), dst_inst->type_id())) { in DoInstructionsMatchFuzzy()
1133 if (src_inst->NumInOperandWords() != dst_inst->NumInOperandWords()) { in DoInstructionsMatchFuzzy()
1139 in_operand_index < src_inst->NumInOperandWords(); ++in_operand_index) { in DoInstructionsMatchFuzzy()
1140 const opt::Operand& src_operand = src_inst->GetInOperand(in_operand_index); in DoInstructionsMatchFuzzy()
1157 const opt::Instruction* src_inst, const opt::Instruction* dst_inst) { in DoDebugAndAnnotationInstructionsMatch() argument
1158 if (src_inst->opcode() != dst_inst->opcode()) { in DoDebugAndAnnotationInstructionsMatch()
1162 switch (src_inst->opcode()) { in DoDebugAndAnnotationInstructionsMatch()
1166 return DoesOperandMatch(src_inst->GetOperand(0), dst_inst->GetOperand(0)); in DoDebugAndAnnotationInstructionsMatch()
1168 return DoOperandsMatch(src_inst, dst_inst, 0, 2); in DoDebugAndAnnotationInstructionsMatch()
1172 return DoOperandsMatch(src_inst, dst_inst, 0, 1); in DoDebugAndAnnotationInstructionsMatch()
1174 return DoOperandsMatch(src_inst, dst_inst, 0, 2); in DoDebugAndAnnotationInstructionsMatch()
1176 return DoOperandsMatch(src_inst, dst_inst, 0, 2); in DoDebugAndAnnotationInstructionsMatch()
1178 return DoOperandsMatch(src_inst, dst_inst, 0, 3); in DoDebugAndAnnotationInstructionsMatch()
1251 bool Differ::MatchOpTypeStruct(const opt::Instruction* src_inst, in MatchOpTypeStruct() argument
1254 const uint32_t src_type_id = src_inst->result_id(); in MatchOpTypeStruct()
1294 if (src_inst->NumInOperandWords() != dst_inst->NumInOperandWords()) { in MatchOpTypeStruct()
1297 return DoOperandsMatch(src_inst, dst_inst, 0, in MatchOpTypeStruct()
1298 src_inst->NumInOperandWords()); in MatchOpTypeStruct()
1310 bool Differ::MatchOpConstant(const opt::Instruction* src_inst, in MatchOpConstant() argument
1317 if (!DoesOperandMatch(src_inst->GetOperand(0), dst_inst->GetOperand(0))) { in MatchOpConstant()
1322 if (!IsIntType(src_id_to_, src_inst->type_id()) || in MatchOpConstant()
1332 const opt::Operand& src_value_operand = src_inst->GetOperand(2); in MatchOpConstant()
1344 if (IsFloatType(src_id_to_, src_inst->type_id()) && flexibility == 1) { in MatchOpConstant()
1361 bool Differ::MatchOpSpecConstant(const opt::Instruction* src_inst, in MatchOpSpecConstant() argument
1363 const uint32_t src_id = src_inst->result_id(); in MatchOpSpecConstant()
1387 if (src_inst->opcode() == spv::Op::OpSpecConstantOp) { in MatchOpSpecConstant()
1388 if (src_inst->NumInOperandWords() == dst_inst->NumInOperandWords()) { in MatchOpSpecConstant()
1389 return DoOperandsMatch(src_inst, dst_inst, 0, in MatchOpSpecConstant()
1390 src_inst->NumInOperandWords()); in MatchOpSpecConstant()
1397 bool Differ::MatchOpVariable(const opt::Instruction* src_inst, in MatchOpVariable() argument
1400 const uint32_t src_id = src_inst->result_id(); in MatchOpVariable()
1412 return MatchPerVertexVariable(src_inst, dst_inst); in MatchOpVariable()
1498 bool Differ::MatchPerVertexVariable(const opt::Instruction* src_inst, in MatchPerVertexVariable() argument
1501 spv::StorageClass(src_inst->GetSingleWordInOperand(0)); in MatchPerVertexVariable()
1730 [this](const opt::Instruction* src_inst, in MatchFunctionBodies()
1732 return DoInstructionsMatchFuzzy(src_inst, dst_inst); in MatchFunctionBodies()
1762 const opt::Instruction* src_inst = src_body[src_cur++]; in MatchIdsInFunctionBodies() local
1769 id_map_.MapInsts(src_inst, dst_inst); in MatchIdsInFunctionBodies()
1773 MatchVariablesUsedByMatchedInstructions(src_inst, dst_inst, flexibility); in MatchIdsInFunctionBodies()
1786 const opt::Instruction* src_inst, const opt::Instruction* dst_inst, in MatchVariablesUsedByMatchedInstructions() argument
1790 assert(src_inst->opcode() == dst_inst->opcode()); in MatchVariablesUsedByMatchedInstructions()
1791 switch (src_inst->opcode()) { in MatchVariablesUsedByMatchedInstructions()
1801 const uint32_t src_pointer_id = src_inst->GetSingleWordInOperand(0); in MatchVariablesUsedByMatchedInstructions()
2112 MatchIds(potential_id_map, [](const opt::Instruction* src_inst, in MatchExtInstImportIds()
2115 const opt::Operand& src_name = src_inst->GetOperand(1); in MatchExtInstImportIds()
2139 for (const opt::Instruction& src_inst : src_->entry_points()) { in MatchEntryPointIds() local
2140 uint32_t execution_model = src_inst.GetSingleWordOperand(0); in MatchEntryPointIds()
2141 src_entry_points_map[execution_model].push_back(&src_inst); in MatchEntryPointIds()
2166 for (const opt::Instruction* src_inst : src_insts) { in MatchEntryPointIds() local
2170 const opt::Operand& src_name = src_inst->GetOperand(2); in MatchEntryPointIds()
2174 uint32_t src_id = src_inst->GetSingleWordOperand(1); in MatchEntryPointIds()
2177 id_map_.MapInsts(src_inst, dst_inst); in MatchEntryPointIds()
2282 const opt::Instruction* src_inst, in MatchTypeIds()
2284 const spv::Op src_op = src_inst->opcode(); in MatchTypeIds()
2308 assert(src_inst->NumInOperandWords() == in MatchTypeIds()
2310 return DoOperandsMatch(src_inst, dst_inst, 0, in MatchTypeIds()
2311 src_inst->NumInOperandWords()); in MatchTypeIds()
2319 if (src_inst->NumInOperandWords() != dst_inst->NumInOperandWords()) { in MatchTypeIds()
2322 return DoOperandsMatch(src_inst, dst_inst, 0, in MatchTypeIds()
2323 src_inst->NumInOperandWords()); in MatchTypeIds()
2329 if (!DoOperandsMatch(src_inst, dst_inst, 0, 1)) { in MatchTypeIds()
2333 if (AreIdenticalUintConstants(src_inst->GetSingleWordInOperand(1), in MatchTypeIds()
2340 return DoOperandsMatch(src_inst, dst_inst, 1, 1); in MatchTypeIds()
2343 return MatchOpTypeStruct(src_inst, dst_inst, flexibility); in MatchTypeIds()
2372 const opt::Instruction* src_inst, in MatchConstants()
2374 const spv::Op src_op = src_inst->opcode(); in MatchConstants()
2388 return MatchOpConstant(src_inst, dst_inst, flexibility); in MatchConstants()
2396 if (src_inst->NumInOperandWords() != dst_inst->NumInOperandWords()) { in MatchConstants()
2399 return DoesOperandMatch(src_inst->GetOperand(0), in MatchConstants()
2401 DoOperandsMatch(src_inst, dst_inst, 0, in MatchConstants()
2402 src_inst->NumInOperandWords()); in MatchConstants()
2407 assert(src_inst->NumInOperandWords() == in MatchConstants()
2409 return DoOperandsMatch(src_inst, dst_inst, 0, in MatchConstants()
2410 src_inst->NumInOperandWords()); in MatchConstants()
2413 return DoesOperandMatch(src_inst->GetOperand(0), in MatchConstants()
2422 return MatchOpSpecConstant(src_inst, dst_inst); in MatchConstants()
2452 [this, flexibility](const opt::Instruction* src_inst, in MatchVariableIds()
2454 assert(src_inst->opcode() == spv::Op::OpVariable); in MatchVariableIds()
2457 return MatchOpVariable(src_inst, dst_inst, flexibility); in MatchVariableIds()
2571 const opt::Instruction* src_inst) { in MappedDstInst() argument
2572 return MappedInstImpl(src_inst, id_map_.SrcToDstMap(), dst_id_to_); in MappedDstInst()
2661 const opt::Instruction* src_inst = IterInst(src_iter); in OutputSection() local
2662 const opt::Instruction* matched_dst_inst = MappedDstInst(src_inst); in OutputSection()
2668 [this, src_inst, matched_dst_inst]() { in OutputSection()
2669 return DoInstructionsMatch(src_inst, matched_dst_inst); in OutputSection()
2671 [this, src_inst, &write_inst]() { in OutputSection()
2672 write_inst(*src_inst, src_id_to_, *src_inst); in OutputSection()