AMDGPU: Move disassembler support check to constructor

Don't check for unsupported targets for every instruction.

llvm-svn: 361406
This commit is contained in:
Matt Arsenault 2019-05-22 16:28:48 +00:00
parent ca64ef2043
commit 418e23e33c
1 changed files with 6 additions and 5 deletions

View File

@ -61,7 +61,12 @@ AMDGPUDisassembler::AMDGPUDisassembler(const MCSubtargetInfo &STI,
MCContext &Ctx, MCContext &Ctx,
MCInstrInfo const *MCII) : MCInstrInfo const *MCII) :
MCDisassembler(STI, Ctx), MCII(MCII), MRI(*Ctx.getRegisterInfo()), MCDisassembler(STI, Ctx), MCII(MCII), MRI(*Ctx.getRegisterInfo()),
TargetMaxInstBytes(Ctx.getAsmInfo()->getMaxInstLength(&STI)) {} TargetMaxInstBytes(Ctx.getAsmInfo()->getMaxInstLength(&STI)) {
// ToDo: AMDGPUDisassembler supports only VI ISA.
if (!STI.getFeatureBits()[AMDGPU::FeatureGCN3Encoding] && !isGFX10())
report_fatal_error("Disassembly not yet supported for subtarget");
}
inline static MCDisassembler::DecodeStatus inline static MCDisassembler::DecodeStatus
addOperand(MCInst &Inst, const MCOperand& Opnd) { addOperand(MCInst &Inst, const MCOperand& Opnd) {
@ -189,10 +194,6 @@ DecodeStatus AMDGPUDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
CommentStream = &CS; CommentStream = &CS;
bool IsSDWA = false; bool IsSDWA = false;
// ToDo: AMDGPUDisassembler supports only VI ISA.
if (!STI.getFeatureBits()[AMDGPU::FeatureGCN3Encoding] && !isGFX10())
report_fatal_error("Disassembly not yet supported for subtarget");
unsigned MaxInstBytesNum = std::min((size_t)TargetMaxInstBytes, Bytes_.size()); unsigned MaxInstBytesNum = std::min((size_t)TargetMaxInstBytes, Bytes_.size());
Bytes = Bytes_.slice(0, MaxInstBytesNum); Bytes = Bytes_.slice(0, MaxInstBytesNum);