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

Method ProcessStore

source/opt/ssa_rewrite_pass.cpp:302–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302void SSARewriter::ProcessStore(Instruction* inst, BasicBlock* bb) {
303 auto opcode = inst->opcode();
304 assert((opcode == spv::Op::OpStore || opcode == spv::Op::OpVariable) &&
305 "Expecting a store or a variable definition instruction.");
306
307 uint32_t var_id = 0;
308 uint32_t val_id = 0;
309 if (opcode == spv::Op::OpStore) {
310 (void)pass_->GetPtr(inst, &var_id);
311 val_id = inst->GetSingleWordInOperand(kStoreValIdInIdx);
312 } else if (inst->NumInOperands() >= 2) {
313 var_id = inst->result_id();
314 val_id = inst->GetSingleWordInOperand(kVariableInitIdInIdx);
315 }
316 if (pass_->IsTargetVar(var_id)) {
317 WriteVariable(var_id, bb, val_id);
318 pass_->context()->get_debug_info_mgr()->AddDebugValueForVariable(
319 inst, var_id, val_id, inst);
320
321#if SSA_REWRITE_DEBUGGING_LEVEL > 1
322 std::cerr << "\tFound store '%" << var_id << " = %" << val_id << "': "
323 << inst->PrettyPrint(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES)
324 << "\n";
325#endif
326 }
327}
328
329bool SSARewriter::ProcessLoad(Instruction* inst, BasicBlock* bb) {
330 // Get the pointer that we are using to load from.

Callers

nothing calls this directly

Calls 10

GetPtrMethod · 0.80
NumInOperandsMethod · 0.80
IsTargetVarMethod · 0.80
get_debug_info_mgrMethod · 0.80
opcodeMethod · 0.45
result_idMethod · 0.45
contextMethod · 0.45
PrettyPrintMethod · 0.45

Tested by

no test coverage detected