xref: /llvm-project/llvm/lib/MC/MCInstPrinter.cpp (revision a2886c21d9a08d63c324cc61aa91ae0893507a31)
1 //===-- MCInstPrinter.cpp - Convert an MCInst to target assembly syntax ---===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/MC/MCInstPrinter.h"
11 #include "llvm/MC/MCAsmInfo.h"
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/Support/ErrorHandling.h"
14 #include "llvm/Support/raw_ostream.h"
15 using namespace llvm;
16 
17 MCInstPrinter::~MCInstPrinter() {
18 }
19 
20 /// getOpcodeName - Return the name of the specified opcode enum (e.g.
21 /// "MOV32ri") or empty if we can't resolve it.
22 StringRef MCInstPrinter::getOpcodeName(unsigned Opcode) const {
23   return "";
24 }
25 
26 void MCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
27   llvm_unreachable("Target should implement this");
28 }
29 
30 void MCInstPrinter::printAnnotation(raw_ostream &OS, StringRef Annot) {
31   if (!Annot.empty()) {
32     if (CommentStream)
33       (*CommentStream) << Annot;
34     else
35       OS << " " << MAI.getCommentString() << " " << Annot;
36   }
37 }
38