OSDN Git Service

AMDGPU: Replace assert with report_fatal_error
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 15 Feb 2017 21:50:34 +0000 (21:50 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 15 Feb 2017 21:50:34 +0000 (21:50 +0000)
Also use a more refined condition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295239 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
test/MC/Disassembler/AMDGPU/si-support.txt [new file with mode: 0644]

index 2247cad..5733b9c 100644 (file)
@@ -138,7 +138,8 @@ DecodeStatus AMDGPUDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
   CommentStream = &CS;
 
   // ToDo: AMDGPUDisassembler supports only VI ISA.
-  assert(AMDGPU::isVI(STI) && "Can disassemble only VI ISA.");
+  if (!STI.getFeatureBits()[AMDGPU::FeatureGCN3Encoding])
+    report_fatal_error("Disassembly not yet supported for subtarget");
 
   const unsigned MaxInstBytesNum = (std::min)((size_t)8, Bytes_.size());
   Bytes = Bytes_.slice(0, MaxInstBytesNum);
diff --git a/test/MC/Disassembler/AMDGPU/si-support.txt b/test/MC/Disassembler/AMDGPU/si-support.txt
new file mode 100644 (file)
index 0000000..f3f5ab9
--- /dev/null
@@ -0,0 +1,4 @@
+# RUN: not llvm-mc -arch=amdgcn -mcpu=tahiti -disassemble < %s 2>&1 | FileCheck %s
+
+# CHECK: LLVM ERROR: Disassembly not yet supported for subtarget
+0x00 0x00 0x00 0x7e