diff options
Diffstat (limited to 'llvm/lib/Target/Lanai/InstPrinter')
| -rw-r--r-- | llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp | 20 | ||||
| -rw-r--r-- | llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.h | 1 |
2 files changed, 19 insertions, 2 deletions
diff --git a/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp b/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp index 4a1dcd881b5..82b720cea8d 100644 --- a/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp +++ b/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp @@ -284,6 +284,22 @@ void LanaiInstPrinter::printMemSplsOperand(const MCInst *MI, int OpNo, void LanaiInstPrinter::printCCOperand(const MCInst *MI, int OpNo, raw_ostream &OS) { - const int CC = static_cast<const int>(MI->getOperand(OpNo).getImm()); - OS << lanaiCondCodeToString(static_cast<LPCC::CondCode>(CC)); + LPCC::CondCode CC = + static_cast<LPCC::CondCode>(MI->getOperand(OpNo).getImm()); + // Handle the undefined value here for printing so we don't abort(). + if (CC >= LPCC::UNKNOWN) + OS << "<und>"; + else + OS << lanaiCondCodeToString(CC); +} + +void LanaiInstPrinter::printPredicateOperand(const MCInst *MI, unsigned OpNo, + raw_ostream &OS) { + LPCC::CondCode CC = + static_cast<LPCC::CondCode>(MI->getOperand(OpNo).getImm()); + // Handle the undefined value here for printing so we don't abort(). + if (CC >= LPCC::UNKNOWN) + OS << "<und>"; + else if (CC != LPCC::ICC_T) + OS << "." << lanaiCondCodeToString(CC); } diff --git a/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.h b/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.h index 4bd5bb0e7fc..1c9d186ad81 100644 --- a/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.h +++ b/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.h @@ -29,6 +29,7 @@ public: const MCSubtargetInfo &STI) override; void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, const char *Modifier = 0); + void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); void printMemRiOperand(const MCInst *MI, int OpNo, raw_ostream &O, const char *Modifier = 0); void printMemRrOperand(const MCInst *MI, int OpNo, raw_ostream &O, |

