mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
MC: Make TargetAsmBackend available to the AsmStreamer.
- Treaty talks on the non-proliferation of MC objects broke down. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121949 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1d6547eb49
commit
745dacc91d
@ -426,6 +426,10 @@ namespace llvm {
|
||||
/// \param CE - If given, a code emitter to use to show the instruction
|
||||
/// encoding inline with the assembly. This method takes ownership of \arg CE.
|
||||
///
|
||||
/// \param TAB - If given, a target asm backend to use to show the fixup
|
||||
/// information in conjunction with encoding information. This method takes
|
||||
/// ownership of \arg TAB.
|
||||
///
|
||||
/// \param ShowInst - Whether to show the MCInst representation inline with
|
||||
/// the assembly.
|
||||
MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
|
||||
@ -433,6 +437,7 @@ namespace llvm {
|
||||
bool useLoc,
|
||||
MCInstPrinter *InstPrint = 0,
|
||||
MCCodeEmitter *CE = 0,
|
||||
TargetAsmBackend *TAB = 0,
|
||||
bool ShowInst = false);
|
||||
|
||||
/// createMachOStreamer - Create a machine code streamer which will generate
|
||||
|
@ -46,6 +46,7 @@ namespace llvm {
|
||||
bool useLoc,
|
||||
MCInstPrinter *InstPrint,
|
||||
MCCodeEmitter *CE,
|
||||
TargetAsmBackend *TAB,
|
||||
bool ShowInst);
|
||||
|
||||
/// Target - Wrapper for Target specific information.
|
||||
@ -95,6 +96,7 @@ namespace llvm {
|
||||
bool useLoc,
|
||||
MCInstPrinter *InstPrint,
|
||||
MCCodeEmitter *CE,
|
||||
TargetAsmBackend *TAB,
|
||||
bool ShowInst);
|
||||
|
||||
private:
|
||||
@ -323,10 +325,11 @@ namespace llvm {
|
||||
bool useLoc,
|
||||
MCInstPrinter *InstPrint,
|
||||
MCCodeEmitter *CE,
|
||||
TargetAsmBackend *TAB,
|
||||
bool ShowInst) const {
|
||||
// AsmStreamerCtorFn is default to llvm::createAsmStreamer
|
||||
return AsmStreamerCtorFn(Ctx, OS, isVerboseAsm, useLoc,
|
||||
InstPrint, CE, ShowInst);
|
||||
InstPrint, CE, TAB, ShowInst);
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
@ -143,14 +143,17 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
|
||||
// Create a code emitter if asked to show the encoding.
|
||||
MCCodeEmitter *MCE = 0;
|
||||
if (ShowMCEncoding)
|
||||
TargetAsmBackend *TAB = 0;
|
||||
if (ShowMCEncoding) {
|
||||
MCE = getTarget().createCodeEmitter(*this, *Context);
|
||||
TAB = getTarget().createAsmBackend(TargetTriple);
|
||||
}
|
||||
|
||||
MCStreamer *S = getTarget().createAsmStreamer(*Context, Out,
|
||||
getVerboseAsm(),
|
||||
hasMCUseLoc(),
|
||||
InstPrinter,
|
||||
MCE,
|
||||
MCE, TAB,
|
||||
ShowMCInst);
|
||||
AsmStreamer.reset(S);
|
||||
break;
|
||||
|
@ -23,8 +23,9 @@
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||
#include "llvm/Target/TargetAsmBackend.h"
|
||||
#include "llvm/Target/TargetAsmInfo.h"
|
||||
#include "llvm/Target/TargetLoweringObjectFile.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@ -34,6 +35,7 @@ class MCAsmStreamer : public MCStreamer {
|
||||
const MCAsmInfo &MAI;
|
||||
OwningPtr<MCInstPrinter> InstPrinter;
|
||||
OwningPtr<MCCodeEmitter> Emitter;
|
||||
OwningPtr<TargetAsmBackend> AsmBackend;
|
||||
|
||||
SmallString<128> CommentToEmit;
|
||||
raw_svector_ostream CommentStream;
|
||||
@ -48,10 +50,12 @@ public:
|
||||
MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os,
|
||||
bool isVerboseAsm,
|
||||
bool useLoc,
|
||||
MCInstPrinter *printer, MCCodeEmitter *emitter, bool showInst)
|
||||
MCInstPrinter *printer, MCCodeEmitter *emitter,
|
||||
TargetAsmBackend *asmbackend,
|
||||
bool showInst)
|
||||
: MCStreamer(Context), OS(os), MAI(Context.getAsmInfo()),
|
||||
InstPrinter(printer), Emitter(emitter), CommentStream(CommentToEmit),
|
||||
IsVerboseAsm(isVerboseAsm),
|
||||
InstPrinter(printer), Emitter(emitter), AsmBackend(asmbackend),
|
||||
CommentStream(CommentToEmit), IsVerboseAsm(isVerboseAsm),
|
||||
ShowInst(showInst), UseLoc(useLoc) {
|
||||
if (InstPrinter && IsVerboseAsm)
|
||||
InstPrinter->setCommentStream(CommentStream);
|
||||
@ -893,8 +897,8 @@ void MCAsmStreamer::Finish() {
|
||||
MCStreamer *llvm::createAsmStreamer(MCContext &Context,
|
||||
formatted_raw_ostream &OS,
|
||||
bool isVerboseAsm, bool useLoc,
|
||||
MCInstPrinter *IP,
|
||||
MCCodeEmitter *CE, bool ShowInst) {
|
||||
MCInstPrinter *IP, MCCodeEmitter *CE,
|
||||
TargetAsmBackend *TAB, bool ShowInst) {
|
||||
return new MCAsmStreamer(Context, OS, isVerboseAsm, useLoc,
|
||||
IP, CE, ShowInst);
|
||||
IP, CE, TAB, ShowInst);
|
||||
}
|
||||
|
@ -540,7 +540,8 @@ namespace llvm {
|
||||
formatted_raw_ostream &OS,
|
||||
bool isVerboseAsm, bool useLoc,
|
||||
MCInstPrinter *IP,
|
||||
MCCodeEmitter *CE, bool ShowInst) {
|
||||
MCCodeEmitter *CE, TargetAsmBackend *TAB,
|
||||
bool ShowInst) {
|
||||
return new PTXMCAsmStreamer(Context, OS, isVerboseAsm, useLoc,
|
||||
IP, CE, ShowInst);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace llvm {
|
||||
bool isVerboseAsm, bool useLoc,
|
||||
MCInstPrinter *InstPrint,
|
||||
MCCodeEmitter *CE,
|
||||
TargetAsmBackend *TAB,
|
||||
bool ShowInst);
|
||||
}
|
||||
|
||||
|
@ -340,10 +340,14 @@ static int AssembleInput(const char *ProgName) {
|
||||
MCInstPrinter *IP =
|
||||
TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI);
|
||||
MCCodeEmitter *CE = 0;
|
||||
if (ShowEncoding)
|
||||
TargetAsmBackend *TAB = 0;
|
||||
if (ShowEncoding) {
|
||||
CE = TheTarget->createCodeEmitter(*TM, Ctx);
|
||||
TAB = TheTarget->createAsmBackend(TripleName);
|
||||
}
|
||||
Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/true,
|
||||
/*useLoc*/ true, IP, CE, ShowInst));
|
||||
/*useLoc*/ true, IP, CE, TAB,
|
||||
ShowInst));
|
||||
} else if (FileType == OFT_Null) {
|
||||
Str.reset(createNullStreamer(Ctx));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user