2009-09-14 03:43:38 +02: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 03:49:26 +02:00
|
|
|
class MCAsmInfo;
|
2010-02-11 23:39:10 +01:00
|
|
|
class StringRef;
|
2009-09-14 03:49:26 +02:00
|
|
|
|
2009-09-14 03:43:38 +02: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 03:49:26 +02:00
|
|
|
protected:
|
2010-02-10 01:10:18 +01: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 03:49:26 +02:00
|
|
|
const MCAsmInfo &MAI;
|
2009-09-14 03:43:38 +02:00
|
|
|
public:
|
2010-04-04 07:04:31 +02:00
|
|
|
MCInstPrinter(const MCAsmInfo &mai)
|
|
|
|
: CommentStream(0), MAI(mai) {}
|
2009-09-14 03:43:38 +02:00
|
|
|
|
|
|
|
virtual ~MCInstPrinter();
|
2010-02-10 01:10:18 +01:00
|
|
|
|
|
|
|
/// setCommentStream - Specify a stream to emit comments to.
|
|
|
|
void setCommentStream(raw_ostream &OS) { CommentStream = &OS; }
|
2009-09-14 03:43:38 +02:00
|
|
|
|
2010-04-04 07:04:31 +02:00
|
|
|
/// printInst - Print the specified MCInst to the specified raw_ostream.
|
2009-09-14 03:43:38 +02:00
|
|
|
///
|
2010-04-04 07:04:31 +02:00
|
|
|
virtual void printInst(const MCInst *MI, raw_ostream &OS) = 0;
|
2010-02-11 23:39:10 +01: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;
|
2009-09-14 03:43:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif
|