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;
|
2011-04-07 21:20:06 +00:00
|
|
|
|
|
|
|
/// The current set of available features.
|
|
|
|
unsigned AvailableFeatures;
|
2009-09-14 01:43:38 +00:00
|
|
|
public:
|
2010-04-04 05:04:31 +00:00
|
|
|
MCInstPrinter(const MCAsmInfo &mai)
|
2011-04-07 21:20:06 +00:00
|
|
|
: CommentStream(0), MAI(mai), AvailableFeatures(0) {}
|
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
|
|
|
|
2011-09-15 18:36:29 +00:00
|
|
|
/// printAnnotations - Print the annotation comments attached to specified
|
|
|
|
/// MCInst to the specified raw_ostream.
|
|
|
|
void printAnnotations(const MCInst *MI, raw_ostream &OS);
|
|
|
|
|
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
|
|
|
|
2011-06-02 02:34:55 +00:00
|
|
|
/// printRegName - Print the assembler register name.
|
|
|
|
virtual void printRegName(raw_ostream &OS, unsigned RegNo) const;
|
2011-04-07 21:20:06 +00:00
|
|
|
|
|
|
|
unsigned getAvailableFeatures() const { return AvailableFeatures; }
|
|
|
|
void setAvailableFeatures(unsigned Value) { AvailableFeatures = Value; }
|
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
|