Chris Lattner | 65b0b29 | 2009-09-14 01:43:38 +0000 | [diff] [blame] | 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" |
Owen Anderson | 317eaf1 | 2011-09-21 00:25:23 +0000 | [diff] [blame] | 11 | #include "llvm/MC/MCAsmInfo.h" |
Chris Lattner | 7e85180 | 2010-02-11 22:39:10 +0000 | [diff] [blame] | 12 | #include "llvm/ADT/StringRef.h" |
Craig Topper | 8581438 | 2012-02-07 05:05:23 +0000 | [diff] [blame] | 13 | #include "llvm/Support/ErrorHandling.h" |
Owen Anderson | ede042d | 2011-09-15 18:36:29 +0000 | [diff] [blame] | 14 | #include "llvm/Support/raw_ostream.h" |
Chris Lattner | 65b0b29 | 2009-09-14 01:43:38 +0000 | [diff] [blame] | 15 | using namespace llvm; |
| 16 | |
| 17 | MCInstPrinter::~MCInstPrinter() { |
Edward O'Callaghan | aa5c1b7 | 2009-10-05 18:43:19 +0000 | [diff] [blame] | 18 | } |
Chris Lattner | 7e85180 | 2010-02-11 22:39:10 +0000 | [diff] [blame] | 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 | } |
Anton Korobeynikov | 57caad7 | 2011-03-05 18:43:32 +0000 | [diff] [blame] | 25 | |
Rafael Espindola | cde4ce4 | 2011-06-02 02:34:55 +0000 | [diff] [blame] | 26 | void MCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const { |
Craig Topper | 8581438 | 2012-02-07 05:05:23 +0000 | [diff] [blame] | 27 | llvm_unreachable("Target should implement this"); |
Anton Korobeynikov | 57caad7 | 2011-03-05 18:43:32 +0000 | [diff] [blame] | 28 | } |
Owen Anderson | ede042d | 2011-09-15 18:36:29 +0000 | [diff] [blame] | 29 | |
Owen Anderson | 98c5dda | 2011-09-15 23:38:46 +0000 | [diff] [blame] | 30 | void MCInstPrinter::printAnnotation(raw_ostream &OS, StringRef Annot) { |
Owen Anderson | 317eaf1 | 2011-09-21 00:25:23 +0000 | [diff] [blame] | 31 | if (!Annot.empty()) { |
| 32 | if (CommentStream) |
Kevin Enderby | 9e5887b | 2011-10-04 22:44:48 +0000 | [diff] [blame] | 33 | (*CommentStream) << Annot; |
Owen Anderson | 317eaf1 | 2011-09-21 00:25:23 +0000 | [diff] [blame] | 34 | else |
Kevin Enderby | 9e5887b | 2011-10-04 22:44:48 +0000 | [diff] [blame] | 35 | OS << " " << MAI.getCommentString() << " " << Annot; |
Owen Anderson | 317eaf1 | 2011-09-21 00:25:23 +0000 | [diff] [blame] | 36 | } |
Owen Anderson | ede042d | 2011-09-15 18:36:29 +0000 | [diff] [blame] | 37 | } |