[PATCH] D51728: [ARC] Prevent InstPrinter from crashing on unknown condition codes.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 6 13:00:04 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341581: [ARC] Prevent InstPrinter from crashing on unknown condition codes. (authored by tkrasnukha, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D51728?vs=164272&id=164273#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51728
Files:
llvm/trunk/lib/Target/ARC/InstPrinter/ARCInstPrinter.cpp
llvm/trunk/test/MC/Disassembler/ARC/br.txt
Index: llvm/trunk/test/MC/Disassembler/ARC/br.txt
===================================================================
--- llvm/trunk/test/MC/Disassembler/ARC/br.txt
+++ llvm/trunk/test/MC/Disassembler/ARC/br.txt
@@ -27,3 +27,5 @@
# CHECK: b -68
0xbd 0x07 0xcf 0xff
+# CHECK: b{unknown-cc} 4096
+0x00 0x00 0x9e 0x00
\ No newline at end of file
Index: llvm/trunk/lib/Target/ARC/InstPrinter/ARCInstPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/ARC/InstPrinter/ARCInstPrinter.cpp
+++ llvm/trunk/lib/Target/ARC/InstPrinter/ARCInstPrinter.cpp
@@ -20,15 +20,20 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
#define DEBUG_TYPE "asm-printer"
#include "ARCGenAsmWriter.inc"
+template <class T>
+static const char *BadConditionCode(T cc) {
+ DEBUG(dbgs() << "Unknown condition code passed: " << cc << "\n");
+ return "{unknown-cc}";
+}
+
static const char *ARCBRCondCodeToString(ARCCC::BRCondCode BRCC) {
switch (BRCC) {
case ARCCC::BREQ:
@@ -44,7 +49,7 @@
case ARCCC::BRHS:
return "hs";
}
- llvm_unreachable("Unhandled ARCCC::BRCondCode");
+ return BadConditionCode(BRCC);
}
static const char *ARCCondCodeToString(ARCCC::CondCode CC) {
@@ -86,7 +91,7 @@
case ARCCC::Z:
return "z";
}
- llvm_unreachable("Unhandled ARCCC::CondCode");
+ return BadConditionCode(CC);
}
void ARCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51728.164273.patch
Type: text/x-patch
Size: 1606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180906/70dbde8e/attachment.bin>
More information about the llvm-commits
mailing list