Unbreak cyclic deps

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73781 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2009-06-19 19:36:55 +00:00
parent b9c2f58229
commit e494b9e0d7
9 changed files with 104 additions and 40 deletions

View File

@ -21,16 +21,12 @@
using namespace llvm;
/// AlphaTargetMachineModule - Note that this is used on hosts that cannot link
/// in a library unless there are references into the library. In particular,
/// it seems that it is not possible to get things to work on Win32 without
/// this. Though it is unused, do not remove it.
extern "C" int AlphaTargetMachineModule;
int AlphaTargetMachineModule = 0;
// Register the targets
static RegisterTarget<AlphaTargetMachine> X("alpha", "Alpha [experimental]");
// No assembler printer by default
AlphaTargetMachine::AsmPrinterCtorFn AlphaTargetMachine::AsmPrinterCtor = 0;
// Force static initialization when called from llvm/InitializeAllTargets.h
namespace llvm {
void InitializeAlphaTarget() { }
@ -97,23 +93,32 @@ bool AlphaTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
bool Verbose,
raw_ostream &Out) {
PM.add(createAlphaLLRPPass(*this));
PM.add(createAlphaCodePrinterPass(Out, *this, OptLevel, Verbose));
// Output assembly language.
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
if (AsmPrinterCtor)
PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose));
return false;
}
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE) {
PM.add(createAlphaCodeEmitterPass(*this, MCE));
if (DumpAsm)
PM.add(createAlphaCodePrinterPass(errs(), *this, OptLevel, true));
if (DumpAsm) {
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
if (AsmPrinterCtor)
PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true));
}
return false;
}
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE) {
PM.add(createAlphaJITCodeEmitterPass(*this, JCE));
if (DumpAsm)
PM.add(createAlphaCodePrinterPass(errs(), *this, OptLevel, true));
if (DumpAsm) {
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
if (AsmPrinterCtor)
PM.add(AsmPrinterCtor(errs(), *this, OptLevel, true));
}
return false;
}
bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,

View File

@ -37,6 +37,14 @@ class AlphaTargetMachine : public LLVMTargetMachine {
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
// set this functions to ctor pointer at startup time if they are linked in.
typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
TargetMachine &tm,
CodeGenOpt::Level OptLevel,
bool verbose);
static AsmPrinterCtorFn AsmPrinterCtor;
public:
AlphaTargetMachine(const Module &M, const std::string &FS);
@ -75,6 +83,10 @@ public:
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &JCE);
static void registerAsmPrinter(AsmPrinterCtorFn F) {
AsmPrinterCtor = F;
}
};
} // end namespace llvm

View File

@ -309,3 +309,11 @@ bool AlphaAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
namespace llvm {
void InitializeAlphaAsmPrinter() { }
}
namespace {
static struct Register {
Register() {
AlphaTargetMachine::registerAsmPrinter(createAlphaCodePrinterPass);
}
} Registrator;
}

View File

@ -627,3 +627,11 @@ FunctionPass *llvm::createSPUAsmPrinterPass(raw_ostream &o,
namespace llvm {
void InitializeCellSPUAsmPrinter() { }
}
namespace {
static struct Register {
Register() {
SPUTargetMachine::registerAsmPrinter(createSPUAsmPrinterPass);
}
} Registrator;
}

View File

@ -23,20 +23,15 @@
using namespace llvm;
/// CellSPUTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
/// things to work on Win32 without this. Though it is unused, do not
/// remove it.
extern "C" int CellSPUTargetMachineModule;
int CellSPUTargetMachineModule = 0;
namespace {
// Register the targets
RegisterTarget<SPUTargetMachine>
CELLSPU("cellspu", "STI CBEA Cell SPU [experimental]");
}
// No assembler printer by default
SPUTargetMachine::AsmPrinterCtorFn SPUTargetMachine::AsmPrinterCtor = 0;
// Force static initialization when called from llvm/InitializeAllTargets.h
namespace llvm {
void InitializeCellSPUTarget() { }
@ -98,6 +93,9 @@ bool SPUTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool Verbose,
raw_ostream &Out) {
PM.add(createSPUAsmPrinterPass(Out, *this, OptLevel, Verbose));
// Output assembly language.
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
if (AsmPrinterCtor)
PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose));
return false;
}

View File

@ -39,6 +39,14 @@ class SPUTargetMachine : public LLVMTargetMachine {
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
// set this functions to ctor pointer at startup time if they are linked in.
typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
SPUTargetMachine &tm,
CodeGenOpt::Level OptLevel,
bool verbose);
static AsmPrinterCtorFn AsmPrinterCtor;
public:
SPUTargetMachine(const Module &M, const std::string &FS);
@ -88,6 +96,10 @@ public:
virtual bool addAssemblyEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool Verbose, raw_ostream &Out);
static void registerAsmPrinter(AsmPrinterCtorFn F) {
AsmPrinterCtor = F;
}
};
} // end namespace llvm

View File

@ -375,6 +375,15 @@ FunctionPass *llvm::createIA64CodePrinterPass(raw_ostream &o,
return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose);
}
namespace {
static struct Register {
Register() {
IA64TargetMachine::registerAsmPrinter(createIA64CodePrinterPass);
}
} Registrator;
}
// Force static initialization when called from
// llvm/InitializeAllAsmPrinters.h
namespace llvm {

View File

@ -19,16 +19,13 @@
#include "llvm/Target/TargetMachineRegistry.h"
using namespace llvm;
/// IA64TargetMachineModule - Note that this is used on hosts that cannot link
/// in a library unless there are references into the library. In particular,
/// it seems that it is not possible to get things to work on Win32 without
/// this. Though it is unused, do not remove it.
extern "C" int IA64TargetMachineModule;
int IA64TargetMachineModule = 0;
// Register the target
static RegisterTarget<IA64TargetMachine> X("ia64",
"IA-64 (Itanium) [experimental]");
// No assembler printer by default
IA64TargetMachine::AsmPrinterCtorFn IA64TargetMachine::AsmPrinterCtor = 0;
// Force static initialization when called from llvm/InitializeAllTargets.h
namespace llvm {
void InitializeIA64Target() { }
@ -93,7 +90,10 @@ bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool Verbose,
raw_ostream &Out) {
PM.add(createIA64CodePrinterPass(Out, *this, OptLevel, Verbose));
// Output assembly language.
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
if (AsmPrinterCtor)
PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose));
return false;
}

View File

@ -34,6 +34,14 @@ class IA64TargetMachine : public LLVMTargetMachine {
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
// set this functions to ctor pointer at startup time if they are linked in.
typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
IA64TargetMachine &tm,
CodeGenOpt::Level OptLevel,
bool verbose);
static AsmPrinterCtorFn AsmPrinterCtor;
public:
IA64TargetMachine(const Module &M, const std::string &FS);
@ -56,6 +64,10 @@ public:
virtual bool addAssemblyEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool Verbose, raw_ostream &Out);
static void registerAsmPrinter(AsmPrinterCtorFn F) {
AsmPrinterCtor = F;
}
};
} // End llvm namespace