| 3086 | } |
| 3087 | |
| 3088 | AtomicInstructionInfo Module::GetAtomicInfo(const Instruction& insn) const { |
| 3089 | AtomicInstructionInfo info; |
| 3090 | |
| 3091 | // All atomics have a pointer referenced |
| 3092 | const uint32_t pointer_index = insn.Opcode() == spv::OpAtomicStore ? 1 : 3; |
| 3093 | const Instruction* access = FindDef(insn.Word(pointer_index)); |
| 3094 | const Instruction* pointer = FindDef(access->Word(1)); |
| 3095 | info.storage_class = pointer->StorageClass(); |
| 3096 | |
| 3097 | const bool is_untyped = (pointer->Opcode() == spv::OpTypeUntypedPointerKHR); |
| 3098 | |
| 3099 | const Instruction* data_type = nullptr; |
| 3100 | if (is_untyped) { |
| 3101 | if (insn.Opcode() == spv::OpAtomicStore) { |
| 3102 | const Instruction* value_id = FindDef(insn.Word(4)); |
| 3103 | data_type = FindDef(value_id->TypeId()); |
| 3104 | } else { |
| 3105 | data_type = FindDef(insn.TypeId()); |
| 3106 | } |
| 3107 | } else { |
| 3108 | data_type = FindDef(pointer->Word(3)); |
| 3109 | } |
| 3110 | |
| 3111 | if (data_type->IsVector()) { |
| 3112 | info.vector_size = GetNumComponentsInBaseType(data_type); |
| 3113 | data_type = FindDef(data_type->Word(2)); |
| 3114 | } |
| 3115 | |
| 3116 | info.type = data_type->Opcode(); |
| 3117 | info.bit_width = data_type->GetBitWidth(); |
| 3118 | |
| 3119 | return info; |
| 3120 | } |
| 3121 | |
| 3122 | spv::StorageClass Module::StorageClass(const Instruction& insn) const { |
| 3123 | spv::StorageClass storage_class = spv::StorageClassMax; |
no test coverage detected