MCInstPrinter.cpp revision c97ef618d2d849a272a353c2b4343fc5902cd921
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/MCInstrInfo.h" 12#include "llvm/MC/MCAsmInfo.h" 13#include "llvm/ADT/StringRef.h" 14#include "llvm/Support/ErrorHandling.h" 15#include "llvm/Support/raw_ostream.h" 16using namespace llvm; 17 18MCInstPrinter::~MCInstPrinter() { 19} 20 21/// getOpcodeName - Return the name of the specified opcode enum (e.g. 22/// "MOV32ri") or empty if we can't resolve it. 23StringRef MCInstPrinter::getOpcodeName(unsigned Opcode) const { 24 return MII.getName(Opcode); 25} 26 27void MCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const { 28 llvm_unreachable("Target should implement this"); 29} 30 31void MCInstPrinter::printAnnotation(raw_ostream &OS, StringRef Annot) { 32 if (!Annot.empty()) { 33 if (CommentStream) 34 (*CommentStream) << Annot; 35 else 36 OS << " " << MAI.getCommentString() << " " << Annot; 37 } 38} 39