Use the new script to sort the includes of every file under lib.
[oota-llvm.git] / lib / MC / MCInstPrinter.cpp
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/ADT/StringRef.h"
12 #include "llvm/MC/MCAsmInfo.h"
13 #include "llvm/MC/MCInstrInfo.h"
14 #include "llvm/Support/ErrorHandling.h"
15 #include "llvm/Support/raw_ostream.h"
16 using namespace llvm;
17
18 MCInstPrinter::~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.
23 StringRef MCInstPrinter::getOpcodeName(unsigned Opcode) const {
24   return MII.getName(Opcode);
25 }
26
27 void MCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
28   llvm_unreachable("Target should implement this");
29 }
30
31 void 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
40 /// Utility functions to make adding mark ups simpler.
41 StringRef MCInstPrinter::markup(StringRef s) const {
42   if (getUseMarkup())
43     return s;
44   else
45     return "";
46 }
47 StringRef MCInstPrinter::markup(StringRef a, StringRef b) const {
48   if (getUseMarkup())
49     return a;
50   else
51     return b;
52 }