mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-21 09:40:22 +00:00
rearrange MCContext ownership. Before LLVMTargetMachine created it
and passing off ownership to AsmPrinter. Now MachineModuleInfo creates it and owns it by value. This allows us to use MCSymbols more consistently throughout the rest of the code generator, and simplifies a bit of code. This also allows MachineFunction to keep an MCContext reference handy, and cleans up the TargetRegistry interfaces for AsmPrinters. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98450 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
355471741b
commit
11d53c129f
@ -143,8 +143,7 @@ namespace llvm {
|
||||
|
||||
protected:
|
||||
explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T);
|
||||
MCStreamer &Streamer);
|
||||
|
||||
public:
|
||||
virtual ~AsmPrinter();
|
||||
|
@ -71,6 +71,7 @@ struct MachineFunctionInfo {
|
||||
class MachineFunction {
|
||||
Function *Fn;
|
||||
const TargetMachine &Target;
|
||||
MCContext &Ctx;
|
||||
|
||||
// RegInfo - Information about each register in use in the function.
|
||||
MachineRegisterInfo *RegInfo;
|
||||
@ -121,13 +122,16 @@ class MachineFunction {
|
||||
// The alignment of the function.
|
||||
unsigned Alignment;
|
||||
|
||||
MachineFunction(const MachineFunction &); // intentionally unimplemented
|
||||
void operator=(const MachineFunction&); // intentionally unimplemented
|
||||
MachineFunction(const MachineFunction &); // DO NOT IMPLEMENT
|
||||
void operator=(const MachineFunction&); // DO NOT IMPLEMENT
|
||||
|
||||
public:
|
||||
MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum);
|
||||
MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum,
|
||||
MCContext &Ctx);
|
||||
~MachineFunction();
|
||||
|
||||
MCContext &getContext() const { return Ctx; }
|
||||
|
||||
/// getFunction - Return the LLVM function that this machine code represents
|
||||
///
|
||||
Function *getFunction() const { return Fn; }
|
||||
|
@ -31,20 +31,18 @@
|
||||
#ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H
|
||||
#define LLVM_CODEGEN_MACHINEMODULEINFO_H
|
||||
|
||||
#include "llvm/GlobalValue.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/GlobalValue.h"
|
||||
#include "llvm/Metadata.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/UniqueVector.h"
|
||||
#include "llvm/CodeGen/MachineLocation.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/ValueHandle.h"
|
||||
#include "llvm/System/DataTypes.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -52,7 +50,6 @@ namespace llvm {
|
||||
// Forward declarations.
|
||||
class Constant;
|
||||
class GlobalVariable;
|
||||
class MCSymbol;
|
||||
class MDNode;
|
||||
class MachineBasicBlock;
|
||||
class MachineFunction;
|
||||
@ -100,6 +97,9 @@ struct LandingPadInfo {
|
||||
/// schemes and reformated for specific use.
|
||||
///
|
||||
class MachineModuleInfo : public ImmutablePass {
|
||||
/// Context - This is the MCContext used for the entire code generator.
|
||||
MCContext Context;
|
||||
|
||||
/// ObjFileMMI - This is the object-file-format-specific implementation of
|
||||
/// MachineModuleInfoImpl, which lets targets accumulate whatever info they
|
||||
/// want.
|
||||
@ -163,7 +163,8 @@ public:
|
||||
VariableDbgInfoMapTy;
|
||||
VariableDbgInfoMapTy VariableDbgInfo;
|
||||
|
||||
MachineModuleInfo();
|
||||
MachineModuleInfo(); // DUMMY CONSTRUCTOR, DO NOT CALL.
|
||||
MachineModuleInfo(const MCAsmInfo &MAI); // Real constructor.
|
||||
~MachineModuleInfo();
|
||||
|
||||
bool doInitialization();
|
||||
@ -172,6 +173,9 @@ public:
|
||||
/// EndFunction - Discard function meta information.
|
||||
///
|
||||
void EndFunction();
|
||||
|
||||
const MCContext &getContext() const { return Context; }
|
||||
MCContext &getContext() { return Context; }
|
||||
|
||||
/// getInfo - Keep track of various per-function pieces of information for
|
||||
/// backends that would like to do so.
|
||||
|
@ -30,6 +30,7 @@ class TargetJITInfo;
|
||||
class TargetLowering;
|
||||
class TargetFrameInfo;
|
||||
class JITCodeEmitter;
|
||||
class MCContext;
|
||||
class TargetRegisterInfo;
|
||||
class PassManagerBase;
|
||||
class PassManager;
|
||||
@ -229,13 +230,13 @@ class LLVMTargetMachine : public TargetMachine {
|
||||
protected: // Can only create subclasses.
|
||||
LLVMTargetMachine(const Target &T, const std::string &TargetTriple);
|
||||
|
||||
private:
|
||||
/// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
|
||||
/// both emitting to assembly files or machine code output.
|
||||
///
|
||||
bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level,
|
||||
bool DisableVerify);
|
||||
bool DisableVerify, MCContext *&OutCtx);
|
||||
|
||||
private:
|
||||
virtual void setCodeModelForJIT();
|
||||
virtual void setCodeModelForStatic();
|
||||
|
||||
|
@ -62,9 +62,7 @@ namespace llvm {
|
||||
const std::string &Features);
|
||||
typedef AsmPrinter *(*AsmPrinterCtorTy)(formatted_raw_ostream &OS,
|
||||
TargetMachine &TM,
|
||||
MCContext &Ctx,
|
||||
MCStreamer &Streamer,
|
||||
const MCAsmInfo *MAI);
|
||||
MCStreamer &Streamer);
|
||||
typedef TargetAsmBackend *(*AsmBackendCtorTy)(const Target &T,
|
||||
const std::string &TT);
|
||||
typedef TargetAsmLexer *(*AsmLexerCtorTy)(const Target &T,
|
||||
@ -235,13 +233,12 @@ namespace llvm {
|
||||
}
|
||||
|
||||
/// createAsmPrinter - Create a target specific assembly printer pass. This
|
||||
/// takes ownership of the MCContext and MCStreamer objects but not the MAI.
|
||||
/// takes ownership of the MCStreamer object.
|
||||
AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *MAI) const {
|
||||
MCStreamer &Streamer) const {
|
||||
if (!AsmPrinterCtorFn)
|
||||
return 0;
|
||||
return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI);
|
||||
return AsmPrinterCtorFn(OS, TM, Streamer);
|
||||
}
|
||||
|
||||
const MCDisassembler *createMCDisassembler() const {
|
||||
@ -650,9 +647,8 @@ namespace llvm {
|
||||
|
||||
private:
|
||||
static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *MAI) {
|
||||
return new AsmPrinterImpl(OS, TM, Ctx, Streamer, MAI);
|
||||
MCStreamer &Streamer) {
|
||||
return new AsmPrinterImpl(OS, TM, Streamer);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -55,12 +55,13 @@ using namespace llvm;
|
||||
STATISTIC(EmittedInsts, "Number of machine instrs printed");
|
||||
|
||||
char AsmPrinter::ID = 0;
|
||||
|
||||
AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
MCStreamer &Streamer)
|
||||
: MachineFunctionPass(&ID), O(o),
|
||||
TM(tm), MAI(T), TRI(tm.getRegisterInfo()),
|
||||
OutContext(Ctx), OutStreamer(Streamer),
|
||||
TM(tm), MAI(tm.getMCAsmInfo()), TRI(tm.getRegisterInfo()),
|
||||
OutContext(Streamer.getContext()),
|
||||
OutStreamer(Streamer),
|
||||
LastMI(0), LastFn(0), Counter(~0U), SetCounter(0), PrevDLT(NULL) {
|
||||
DW = 0; MMI = 0;
|
||||
VerboseAsm = Streamer.isVerboseAsm();
|
||||
@ -72,7 +73,6 @@ AsmPrinter::~AsmPrinter() {
|
||||
delete I->second;
|
||||
|
||||
delete &OutStreamer;
|
||||
delete &OutContext;
|
||||
}
|
||||
|
||||
/// getFunctionNumber - Return a unique ID for the current function.
|
||||
@ -94,12 +94,16 @@ const MCSection *AsmPrinter::getCurrentSection() const {
|
||||
void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
AU.addRequired<MachineModuleInfo>();
|
||||
AU.addRequired<GCModuleInfo>();
|
||||
if (VerboseAsm)
|
||||
AU.addRequired<MachineLoopInfo>();
|
||||
}
|
||||
|
||||
bool AsmPrinter::doInitialization(Module &M) {
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
MMI->AnalyzeModule(M);
|
||||
|
||||
// Initialize TargetLoweringObjectFile.
|
||||
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
||||
.Initialize(OutContext, TM);
|
||||
@ -128,9 +132,6 @@ bool AsmPrinter::doInitialization(Module &M) {
|
||||
<< '\n' << MAI->getCommentString()
|
||||
<< " End of file scope inline assembly\n";
|
||||
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
if (MMI)
|
||||
MMI->AnalyzeModule(M);
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
if (DW)
|
||||
DW->BeginModule(&M, MMI, O, this, MAI);
|
||||
|
@ -13,16 +13,15 @@
|
||||
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Assembly/PrintModulePass.h"
|
||||
#include "llvm/CodeGen/AsmPrinter.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/CodeGen/GCStrategy.h"
|
||||
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/GCStrategy.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
@ -116,11 +115,12 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
CodeGenOpt::Level OptLevel,
|
||||
bool DisableVerify) {
|
||||
// Add common CodeGen passes.
|
||||
if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
|
||||
MCContext *Context = 0;
|
||||
if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify, Context))
|
||||
return true;
|
||||
assert(Context != 0 && "Failed to get MCContext");
|
||||
|
||||
const MCAsmInfo &MAI = *getMCAsmInfo();
|
||||
OwningPtr<MCContext> Context(new MCContext(MAI));
|
||||
OwningPtr<MCStreamer> AsmStreamer;
|
||||
|
||||
formatted_raw_ostream *LegacyOutput;
|
||||
@ -166,16 +166,14 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
break;
|
||||
}
|
||||
|
||||
// Create the AsmPrinter, which takes ownership of Context and AsmStreamer
|
||||
// if successful.
|
||||
// Create the AsmPrinter, which takes ownership of AsmStreamer if successful.
|
||||
FunctionPass *Printer =
|
||||
getTarget().createAsmPrinter(*LegacyOutput, *this, *Context, *AsmStreamer,
|
||||
getMCAsmInfo());
|
||||
getTarget().createAsmPrinter(*LegacyOutput, *this, *AsmStreamer);
|
||||
if (Printer == 0)
|
||||
return true;
|
||||
|
||||
// If successful, createAsmPrinter took ownership of AsmStreamer and Context.
|
||||
Context.take(); AsmStreamer.take();
|
||||
// If successful, createAsmPrinter took ownership of AsmStreamer.
|
||||
AsmStreamer.take();
|
||||
|
||||
PM.add(Printer);
|
||||
|
||||
@ -199,7 +197,8 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
|
||||
setCodeModelForJIT();
|
||||
|
||||
// Add common CodeGen passes.
|
||||
if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
|
||||
MCContext *Ctx = 0;
|
||||
if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify, Ctx))
|
||||
return true;
|
||||
|
||||
addCodeEmitter(PM, OptLevel, JCE);
|
||||
@ -208,8 +207,7 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
|
||||
return false; // success!
|
||||
}
|
||||
|
||||
static void printNoVerify(PassManagerBase &PM,
|
||||
const char *Banner) {
|
||||
static void printNoVerify(PassManagerBase &PM, const char *Banner) {
|
||||
if (PrintMachineCode)
|
||||
PM.add(createMachineFunctionPrinterPass(dbgs(), Banner));
|
||||
}
|
||||
@ -229,7 +227,8 @@ static void printAndVerify(PassManagerBase &PM,
|
||||
///
|
||||
bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
||||
CodeGenOpt::Level OptLevel,
|
||||
bool DisableVerify) {
|
||||
bool DisableVerify,
|
||||
MCContext *&OutContext) {
|
||||
// Standard LLVM-Level Passes.
|
||||
|
||||
// Before running any passes, run the verifier to determine if the input
|
||||
@ -252,8 +251,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
||||
|
||||
// Turn exception handling constructs into something the code generators can
|
||||
// handle.
|
||||
switch (getMCAsmInfo()->getExceptionHandlingType())
|
||||
{
|
||||
switch (getMCAsmInfo()->getExceptionHandlingType()) {
|
||||
case ExceptionHandling::SjLj:
|
||||
// SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both
|
||||
// Dwarf EH prepare needs to be run after SjLj prepare. Otherwise,
|
||||
@ -293,6 +291,13 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
||||
PM.add(createVerifierPass());
|
||||
|
||||
// Standard Lower-Level Passes.
|
||||
|
||||
// Install a MachineModuleInfo class, which is an immutable pass that holds
|
||||
// all the per-module stuff we're generating, including MCContext.
|
||||
MachineModuleInfo *MMI = new MachineModuleInfo(*getMCAsmInfo());
|
||||
PM.add(MMI);
|
||||
OutContext = &MMI->getContext(); // Return the MCContext specifically by-ref.
|
||||
|
||||
|
||||
// Set up a MachineFunction for the rest of CodeGen to work on.
|
||||
PM.add(new MachineFunctionAnalysis(*this, OptLevel));
|
||||
|
@ -85,8 +85,8 @@ void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
|
||||
}
|
||||
|
||||
MachineFunction::MachineFunction(Function *F, const TargetMachine &TM,
|
||||
unsigned FunctionNum)
|
||||
: Fn(F), Target(TM) {
|
||||
unsigned FunctionNum, MCContext &ctx)
|
||||
: Fn(F), Target(TM), Ctx(ctx) {
|
||||
if (TM.getRegisterInfo())
|
||||
RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
|
||||
MachineRegisterInfo(*TM.getRegisterInfo());
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
using namespace llvm;
|
||||
|
||||
// Register this pass with PassInfo directly to avoid having to define
|
||||
@ -36,7 +37,8 @@ MachineFunctionAnalysis::~MachineFunctionAnalysis() {
|
||||
|
||||
bool MachineFunctionAnalysis::runOnFunction(Function &F) {
|
||||
assert(!MF && "MachineFunctionAnalysis already initialized!");
|
||||
MF = new MachineFunction(&F, TM, NextFnNum++);
|
||||
MF = new MachineFunction(&F, TM, NextFnNum++,
|
||||
getAnalysis<MachineModuleInfo>().getContext());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -47,4 +49,5 @@ void MachineFunctionAnalysis::releaseMemory() {
|
||||
|
||||
void MachineFunctionAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<MachineModuleInfo>();
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ using namespace llvm::dwarf;
|
||||
|
||||
// Handle the Pass registration stuff necessary to use TargetData's.
|
||||
static RegisterPass<MachineModuleInfo>
|
||||
X("machinemoduleinfo", "Module Information");
|
||||
X("machinemoduleinfo", "Machine Module Information");
|
||||
char MachineModuleInfo::ID = 0;
|
||||
|
||||
// Out of line virtual method.
|
||||
@ -37,17 +37,21 @@ MachineModuleInfoImpl::~MachineModuleInfoImpl() {}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
MachineModuleInfo::MachineModuleInfo()
|
||||
: ImmutablePass(&ID)
|
||||
, ObjFileMMI(0)
|
||||
, CurCallSite(0)
|
||||
, CallsEHReturn(0)
|
||||
, CallsUnwindInit(0)
|
||||
, DbgInfoAvailable(false) {
|
||||
MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI)
|
||||
: ImmutablePass(&ID), Context(MAI),
|
||||
ObjFileMMI(0), CurCallSite(0), CallsEHReturn(0), CallsUnwindInit(0),
|
||||
DbgInfoAvailable(false) {
|
||||
// Always emit some info, by default "no personality" info.
|
||||
Personalities.push_back(NULL);
|
||||
}
|
||||
|
||||
MachineModuleInfo::MachineModuleInfo()
|
||||
: ImmutablePass(&ID), Context(*(MCAsmInfo*)0) {
|
||||
assert(0 && "This MachineModuleInfo constructor should never be called, MMI "
|
||||
"should always be explicitly constructed by LLVMTargetMachine");
|
||||
abort();
|
||||
}
|
||||
|
||||
MachineModuleInfo::~MachineModuleInfo() {
|
||||
delete ObjFileMMI;
|
||||
}
|
||||
|
@ -75,9 +75,8 @@ namespace {
|
||||
|
||||
public:
|
||||
explicit ARMAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, T), AFI(NULL), MCP(NULL) {
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer), AFI(NULL), MCP(NULL) {
|
||||
Subtarget = &TM.getSubtarget<ARMSubtarget>();
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,8 @@ namespace {
|
||||
///
|
||||
|
||||
explicit AlphaAsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: AsmPrinter(o, tm, Ctx, Streamer, T) {}
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(o, tm, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Alpha Assembly Printer";
|
||||
|
@ -40,9 +40,8 @@ namespace {
|
||||
class BlackfinAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
BlackfinAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *MAI)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, MAI) {}
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Blackfin Assembly Printer";
|
||||
|
@ -39,9 +39,8 @@ namespace {
|
||||
class SPUAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
explicit SPUAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T) :
|
||||
AsmPrinter(O, TM, Ctx, Streamer, T) {}
|
||||
MCStreamer &Streamer) :
|
||||
AsmPrinter(O, TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "STI CBEA SPU Assembly Printer";
|
||||
|
@ -53,9 +53,8 @@ namespace {
|
||||
const MBlazeSubtarget *Subtarget;
|
||||
public:
|
||||
explicit MBlazeAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T )
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, T) {
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {
|
||||
Subtarget = &TM.getSubtarget<MBlazeSubtarget>();
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,8 @@ namespace {
|
||||
class MSP430AsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
MSP430AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *MAI)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, MAI) {}
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "MSP430 Assembly Printer";
|
||||
|
@ -51,9 +51,8 @@ namespace {
|
||||
const MipsSubtarget *Subtarget;
|
||||
public:
|
||||
explicit MipsAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, T) {
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {
|
||||
Subtarget = &TM.getSubtarget<MipsSubtarget>();
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,10 @@ using namespace llvm;
|
||||
#include "PIC16GenAsmWriter.inc"
|
||||
|
||||
PIC16AsmPrinter::PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, T), DbgInfo(O, T) {
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer), DbgInfo(O, TM.getMCAsmInfo()) {
|
||||
PTLI = static_cast<PIC16TargetLowering*>(TM.getTargetLowering());
|
||||
PMAI = static_cast<const PIC16MCAsmInfo*>(T);
|
||||
PMAI = static_cast<const PIC16MCAsmInfo*>(TM.getMCAsmInfo());
|
||||
PTOF = (PIC16TargetObjectFile *)&PTLI->getObjFileLowering();
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,7 @@ namespace llvm {
|
||||
class VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
explicit PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T);
|
||||
MCStreamer &Streamer);
|
||||
private:
|
||||
virtual const char *getPassName() const {
|
||||
return "PIC16 Assembly Printer";
|
||||
|
@ -61,9 +61,8 @@ namespace {
|
||||
uint64_t LabelID;
|
||||
public:
|
||||
explicit PPCAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, T),
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer),
|
||||
Subtarget(TM.getSubtarget<PPCSubtarget>()), LabelID(0) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
@ -324,9 +323,8 @@ namespace {
|
||||
class PPCLinuxAsmPrinter : public PPCAsmPrinter {
|
||||
public:
|
||||
explicit PPCLinuxAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: PPCAsmPrinter(O, TM, Ctx, Streamer, T) {}
|
||||
MCStreamer &Streamer)
|
||||
: PPCAsmPrinter(O, TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Linux PPC Assembly Printer";
|
||||
@ -350,9 +348,8 @@ namespace {
|
||||
formatted_raw_ostream &OS;
|
||||
public:
|
||||
explicit PPCDarwinAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: PPCAsmPrinter(O, TM, Ctx, Streamer, T), OS(O) {}
|
||||
MCStreamer &Streamer)
|
||||
: PPCAsmPrinter(O, TM, Streamer), OS(O) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Darwin PPC Assembly Printer";
|
||||
@ -858,13 +855,12 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
|
||||
///
|
||||
static AsmPrinter *createPPCAsmPrinterPass(formatted_raw_ostream &o,
|
||||
TargetMachine &tm,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *tai) {
|
||||
MCStreamer &Streamer) {
|
||||
const PPCSubtarget *Subtarget = &tm.getSubtarget<PPCSubtarget>();
|
||||
|
||||
if (Subtarget->isDarwin())
|
||||
return new PPCDarwinAsmPrinter(o, tm, Ctx, Streamer, tai);
|
||||
return new PPCLinuxAsmPrinter(o, tm, Ctx, Streamer, tai);
|
||||
return new PPCDarwinAsmPrinter(o, tm, Streamer);
|
||||
return new PPCLinuxAsmPrinter(o, tm, Streamer);
|
||||
}
|
||||
|
||||
// Force static initialization.
|
||||
|
@ -31,9 +31,8 @@ namespace {
|
||||
class SparcAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
explicit SparcAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, T) {}
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Sparc Assembly Printer";
|
||||
|
@ -41,9 +41,8 @@ namespace {
|
||||
class SystemZAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
SystemZAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *MAI)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, MAI) {}
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "SystemZ Assembly Printer";
|
||||
|
@ -36,9 +36,8 @@ class VISIBILITY_HIDDEN X86AsmPrinter : public AsmPrinter {
|
||||
const X86Subtarget *Subtarget;
|
||||
public:
|
||||
explicit X86AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, T) {
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer) {
|
||||
Subtarget = &TM.getSubtarget<X86Subtarget>();
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,8 @@ namespace {
|
||||
const XCoreSubtarget &Subtarget;
|
||||
public:
|
||||
explicit XCoreAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *T)
|
||||
: AsmPrinter(O, TM, Ctx, Streamer, T),
|
||||
MCStreamer &Streamer)
|
||||
: AsmPrinter(O, TM, Streamer),
|
||||
Subtarget(TM.getSubtarget<XCoreSubtarget>()) {}
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user