2009-09-14 01:43:38 +00:00
|
|
|
//===-- MCInstPrinter.h - Convert an MCInst to target assembly syntax -----===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_MC_MCINSTPRINTER_H
|
|
|
|
#define LLVM_MC_MCINSTPRINTER_H
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class MCInst;
|
|
|
|
class raw_ostream;
|
2009-09-14 01:49:26 +00:00
|
|
|
class MCAsmInfo;
|
2010-02-11 22:39:10 +00:00
|
|
|
class StringRef;
|
2009-09-14 01:49:26 +00:00
|
|
|
|
2009-09-14 01:43:38 +00:00
|
|
|
/// MCInstPrinter - This is an instance of a target assembly language printer
|
|
|
|
/// that converts an MCInst to valid target assembly syntax.
|
|
|
|
class MCInstPrinter {
|
2009-09-14 01:49:26 +00:00
|
|
|
protected:
|
2010-02-10 00:10:18 +00:00
|
|
|
/// CommentStream - a stream that comments can be emitted to if desired.
|
|
|
|
/// Each comment must end with a newline. This will be null if verbose
|
|
|
|
/// assembly emission is disable.
|
|
|
|
raw_ostream *CommentStream;
|
2009-09-14 01:49:26 +00:00
|
|
|
const MCAsmInfo &MAI;
|
2009-09-14 01:43:38 +00:00
|
|
|
public:
|
2010-04-04 05:04:31 +00:00
|
|
|
MCInstPrinter(const MCAsmInfo &mai)
|
|
|
|
: CommentStream(0), MAI(mai) {}
|
2010-09-17 21:23:56 +00:00
|
|
|
|
2009-09-14 01:43:38 +00:00
|
|
|
virtual ~MCInstPrinter();
|
2010-02-10 00:10:18 +00:00
|
|
|
|
|
|
|
/// setCommentStream - Specify a stream to emit comments to.
|
|
|
|
void setCommentStream(raw_ostream &OS) { CommentStream = &OS; }
|
2010-09-17 21:23:56 +00:00
|
|
|
|
2010-04-04 05:04:31 +00:00
|
|
|
/// printInst - Print the specified MCInst to the specified raw_ostream.
|
2009-09-14 01:43:38 +00:00
|
|
|
///
|
2010-04-04 05:04:31 +00:00
|
|
|
virtual void printInst(const MCInst *MI, raw_ostream &OS) = 0;
|
2010-09-17 21:23:56 +00:00
|
|
|
|
2010-02-11 22:39:10 +00:00
|
|
|
/// getOpcodeName - Return the name of the specified opcode enum (e.g.
|
|
|
|
/// "MOV32ri") or empty if we can't resolve it.
|
|
|
|
virtual StringRef getOpcodeName(unsigned Opcode) const;
|
2011-03-05 18:43:32 +00:00
|
|
|
|
|
|
|
/// getRegName - Return the assembler register name.
|
|
|
|
virtual StringRef getRegName(unsigned RegNo) const;
|
2009-09-14 01:43:38 +00:00
|
|
|
};
|
2010-09-17 21:23:56 +00:00
|
|
|
|
2009-09-14 01:43:38 +00:00
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif
|