| 39 | } |
| 40 | |
| 41 | void GcnDecodeContext::decodeInstruction(GcnCodeSlice& code) |
| 42 | { |
| 43 | const uint32_t token = code.at(0); |
| 44 | |
| 45 | GcnInstEncoding encoding = getInstructionEncoding(token); |
| 46 | LOG_ASSERT(encoding != GcnInstEncoding::ILLEGAL, "illegal encoding %d", encoding); |
| 47 | uint32_t encodingLen = getEncodingLength(encoding); |
| 48 | |
| 49 | // Clear the instruction |
| 50 | m_instruction = GcnShaderInstruction(); |
| 51 | // Decode |
| 52 | if (encodingLen == sizeof(uint32_t)) |
| 53 | { |
| 54 | decodeInstruction32(encoding, code); |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | decodeInstruction64(encoding, code); |
| 59 | } |
| 60 | |
| 61 | // Update instruction meta info. |
| 62 | updateInstructionMeta(encoding); |
| 63 | |
| 64 | // Detect literal constant. |
| 65 | // Only 32 bits instructions may have literal constant. |
| 66 | // Note: |
| 67 | // Literal constant decode must be performed after meta info updated. |
| 68 | if (encodingLen == sizeof(uint32_t)) |
| 69 | { |
| 70 | decodeLiteralConstant(encoding, code); |
| 71 | } |
| 72 | |
| 73 | repairOperandType(); |
| 74 | } |
| 75 | |
| 76 | GcnInstEncoding GcnDecodeContext::getInstructionEncoding(uint32_t hexInstruction) |
| 77 | { |
no test coverage detected