summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.cpp')
-rw-r--r--llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.cpp b/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.cpp
index 8eefae5ee491..f34b698e9af2 100644
--- a/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.cpp
+++ b/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.cpp
@@ -178,3 +178,30 @@ void ARCInstPrinter::printBRCCPredicateOperand(const MCInst *MI, unsigned OpNum,
assert(Op.isImm() && "Predicate operand is immediate.");
O << ARCBRCondCodeToString((ARCCC::BRCondCode)Op.getImm());
}
+
+void ARCInstPrinter::printCCOperand(const MCInst *MI, int OpNum,
+ raw_ostream &O) {
+ O << ARCCondCodeToString((ARCCC::CondCode)MI->getOperand(OpNum).getImm());
+}
+
+void ARCInstPrinter::printU6ShiftedBy(unsigned ShiftBy, const MCInst *MI,
+ int OpNum, raw_ostream &O) {
+ const MCOperand &MO = MI->getOperand(OpNum);
+ if (MO.isImm()) {
+ unsigned Value = MO.getImm();
+ unsigned Value2 = Value >> ShiftBy;
+ if (Value2 > 0x3F || (Value2 << ShiftBy != Value)) {
+ errs() << "!!! Instruction has out-of-range U6 immediate operand:\n"
+ << " Opcode is " << MI->getOpcode() << "; operand value is "
+ << Value;
+ if (ShiftBy)
+ errs() << " scaled by " << (1 << ShiftBy) << "\n";
+ assert(false && "instruction has wrong format");
+ }
+ }
+ printOperand(MI, OpNum, O);
+}
+
+void ARCInstPrinter::printU6(const MCInst *MI, int OpNum, raw_ostream &O) {
+ printU6ShiftedBy(0, MI, OpNum, O);
+}