aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ExecutionEngine/JIT/TargetSelect.cpp22
-rw-r--r--lib/Support/TargetRegistry.cpp12
-rw-r--r--lib/Target/ARM/ARM.h2
-rw-r--r--lib/Target/ARM/ARMTargetMachine.cpp78
-rw-r--r--lib/Target/ARM/ARMTargetMachine.h12
-rw-r--r--lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp9
-rw-r--r--lib/Target/Alpha/AlphaTargetMachine.cpp37
-rw-r--r--lib/Target/Alpha/AlphaTargetMachine.h5
-rw-r--r--lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp11
-rw-r--r--lib/Target/CBackend/CBackend.cpp22
-rw-r--r--lib/Target/CBackend/CTargetMachine.h8
-rw-r--r--lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp14
-rw-r--r--lib/Target/CellSPU/SPU.h2
-rw-r--r--lib/Target/CellSPU/SPUTargetMachine.cpp23
-rw-r--r--lib/Target/CellSPU/SPUTargetMachine.h10
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp3
-rw-r--r--lib/Target/CppBackend/CPPTargetMachine.h7
-rw-r--r--lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp8
-rw-r--r--lib/Target/IA64/IA64.h2
-rw-r--r--lib/Target/IA64/IA64TargetMachine.cpp35
-rw-r--r--lib/Target/IA64/IA64TargetMachine.h6
-rw-r--r--lib/Target/MSIL/MSILWriter.cpp7
-rw-r--r--lib/Target/MSP430/MSP430TargetMachine.cpp18
-rw-r--r--lib/Target/MSP430/MSP430TargetMachine.h3
-rw-r--r--lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp14
-rw-r--r--lib/Target/Mips/Mips.h2
-rw-r--r--lib/Target/Mips/MipsTargetMachine.cpp51
-rw-r--r--lib/Target/Mips/MipsTargetMachine.h9
-rw-r--r--lib/Target/PIC16/PIC16TargetMachine.cpp19
-rw-r--r--lib/Target/PIC16/PIC16TargetMachine.h4
-rw-r--r--lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp15
-rw-r--r--lib/Target/PowerPC/PPC.h2
-rw-r--r--lib/Target/PowerPC/PPCTargetMachine.cpp75
-rw-r--r--lib/Target/PowerPC/PPCTargetMachine.h15
-rw-r--r--lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp7
-rw-r--r--lib/Target/Sparc/SparcTargetMachine.cpp35
-rw-r--r--lib/Target/Sparc/SparcTargetMachine.h3
-rw-r--r--lib/Target/TargetMachine.cpp4
-rw-r--r--lib/Target/TargetMachineRegistry.cpp78
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h2
-rw-r--r--lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp11
-rw-r--r--lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h2
-rw-r--r--lib/Target/X86/X86.h2
-rw-r--r--lib/Target/X86/X86TargetMachine.cpp86
-rw-r--r--lib/Target/X86/X86TargetMachine.h12
-rw-r--r--lib/Target/XCore/XCoreTargetMachine.cpp18
-rw-r--r--lib/Target/XCore/XCoreTargetMachine.h3
47 files changed, 253 insertions, 572 deletions
diff --git a/lib/ExecutionEngine/JIT/TargetSelect.cpp b/lib/ExecutionEngine/JIT/TargetSelect.cpp
index 24dd013639..93ad81f85f 100644
--- a/lib/ExecutionEngine/JIT/TargetSelect.cpp
+++ b/lib/ExecutionEngine/JIT/TargetSelect.cpp
@@ -45,19 +45,22 @@ ExecutionEngine *JIT::createJIT(ModuleProvider *MP, std::string *ErrorStr,
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel,
bool AllocateGVsWithCode) {
- const TargetMachineRegistry::entry *TheArch = MArch;
- if (TheArch == 0) {
+ const Target *TheTarget;
+ if (MArch == 0) {
std::string Error;
- TheArch = TargetMachineRegistry::getClosestTargetForJIT(Error);
- if (TheArch == 0) {
+ TheTarget = TargetRegistry::getClosestTargetForJIT(Error);
+ if (TheTarget == 0) {
if (ErrorStr)
*ErrorStr = Error;
return 0;
}
- } else if (TheArch->JITMatchQualityFn() == 0) {
- cerr << "WARNING: This target JIT is not designed for the host you are"
- << " running. If bad things happen, please choose a different "
- << "-march switch.\n";
+ } else {
+ TheTarget = &MArch->TheTarget;
+ if (TheTarget->getJITMatchQuality() == 0) {
+ cerr << "WARNING: This target JIT is not designed for the host you are"
+ << " running. If bad things happen, please choose a different "
+ << "-march switch.\n";
+ }
}
// Package up features to be passed to target/subtarget
@@ -71,7 +74,8 @@ ExecutionEngine *JIT::createJIT(ModuleProvider *MP, std::string *ErrorStr,
}
// Allocate a target...
- TargetMachine *Target = TheArch->CtorFn(*MP->getModule(), FeaturesStr);
+ TargetMachine *Target =
+ TheTarget->createTargetMachine(*MP->getModule(), FeaturesStr);
assert(Target && "Could not allocate target machine!");
// If the target supports JIT code generation, return a new JIT now.
diff --git a/lib/Support/TargetRegistry.cpp b/lib/Support/TargetRegistry.cpp
index 258d703d16..77cf2dd72c 100644
--- a/lib/Support/TargetRegistry.cpp
+++ b/lib/Support/TargetRegistry.cpp
@@ -111,15 +111,13 @@ void TargetRegistry::RegisterTarget(Target &T,
Target::TripleMatchQualityFnTy TQualityFn,
Target::ModuleMatchQualityFnTy MQualityFn,
Target::JITMatchQualityFnTy JITQualityFn) {
- // Note that we don't require the constructor functions already be defined, in
- // case a module happens to initialize the optional functionality before the
- // target.
- assert(!T.Next && !T.Name && !T.ShortDesc && !T.TripleMatchQualityFn &&
- !T.ModuleMatchQualityFn && !T.JITMatchQualityFn &&
- "This Target already registered!");
-
assert(Name && ShortDesc && TQualityFn && MQualityFn && JITQualityFn &&
"Missing required target information!");
+
+ // Check if this target has already been initialized, we allow this as a
+ // convenience to some clients.
+ if (T.Name)
+ return;
// Add to the list of targets.
T.Next = FirstTarget;
diff --git a/lib/Target/ARM/ARM.h b/lib/Target/ARM/ARM.h
index f6ae6806fd..1b5b828395 100644
--- a/lib/Target/ARM/ARM.h
+++ b/lib/Target/ARM/ARM.h
@@ -94,7 +94,7 @@ inline static const char *ARMCondCodeToString(ARMCC::CondCodes CC) {
FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM);
FunctionPass *createARMCodePrinterPass(formatted_raw_ostream &O,
- ARMBaseTargetMachine &TM,
+ TargetMachine &TM,
bool Verbose);
FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM,
MachineCodeEmitter &MCE);
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp
index 932659d8b6..ad80020738 100644
--- a/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/lib/Target/ARM/ARMTargetMachine.cpp
@@ -36,8 +36,11 @@ extern "C" int ARMTargetMachineModule;
int ARMTargetMachineModule = 0;
// Register the target.
-static RegisterTarget<ARMTargetMachine> X("arm", "ARM");
-static RegisterTarget<ThumbTargetMachine> Y("thumb", "Thumb");
+extern Target TheARMTarget;
+static RegisterTarget<ARMTargetMachine> X(TheARMTarget, "arm", "ARM");
+
+extern Target TheThumbTarget;
+static RegisterTarget<ThumbTargetMachine> Y(TheThumbTarget, "thumb", "Thumb");
// Force static initialization.
extern "C" void LLVMInitializeARMTarget() { }
@@ -45,57 +48,32 @@ extern "C" void LLVMInitializeARMTarget() { }
// No assembler printer by default
ARMBaseTargetMachine::AsmPrinterCtorFn ARMBaseTargetMachine::AsmPrinterCtor = 0;
-/// ThumbTargetMachine - Create an Thumb architecture model.
-///
-unsigned ThumbTargetMachine::getJITMatchQuality() {
-#if defined(__thumb__)
- return 10;
-#endif
- return 0;
-}
-
-unsigned ThumbTargetMachine::getModuleMatchQuality(const Module &M) {
- std::string TT = M.getTargetTriple();
- // Match thumb-foo-bar, as well as things like thumbv5blah-*
- if (TT.size() >= 6 &&
- (TT.substr(0, 6) == "thumb-" || TT.substr(0, 6) == "thumbv"))
- return 20;
-
- // If the target triple is something non-thumb, we don't match.
- if (!TT.empty()) return 0;
-
- if (M.getEndianness() == Module::LittleEndian &&
- M.getPointerSize() == Module::Pointer32)
- return 10; // Weak match
- else if (M.getEndianness() != Module::AnyEndianness ||
- M.getPointerSize() != Module::AnyPointerSize)
- return 0; // Match for some other target
-
- return getJITMatchQuality()/2;
-}
-
/// TargetMachine ctor - Create an ARM architecture model.
///
-ARMBaseTargetMachine::ARMBaseTargetMachine(const Module &M,
+ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T,
+ const Module &M,
const std::string &FS,
bool isThumb)
- : Subtarget(M, FS, isThumb),
+ : LLVMTargetMachine(T),
+ Subtarget(M, FS, isThumb),
FrameInfo(Subtarget),
JITInfo(),
InstrItins(Subtarget.getInstrItineraryData()) {
DefRelocModel = getRelocationModel();
}
-ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS)
- : ARMBaseTargetMachine(M, FS, false), InstrInfo(Subtarget),
+ARMTargetMachine::ARMTargetMachine(const Target &T, const Module &M,
+ const std::string &FS)
+ : ARMBaseTargetMachine(T, M, FS, false), InstrInfo(Subtarget),
DataLayout(Subtarget.isAPCS_ABI() ?
std::string("e-p:32:32-f64:32:32-i64:32:32") :
std::string("e-p:32:32-f64:64:64-i64:64:64")),
TLInfo(*this) {
}
-ThumbTargetMachine::ThumbTargetMachine(const Module &M, const std::string &FS)
- : ARMBaseTargetMachine(M, FS, true),
+ThumbTargetMachine::ThumbTargetMachine(const Target &T, const Module &M,
+ const std::string &FS)
+ : ARMBaseTargetMachine(T, M, FS, true),
DataLayout(Subtarget.isAPCS_ABI() ?
std::string("e-p:32:32-f64:32:32-i64:32:32-"
"i16:16:32-i8:8:32-i1:8:32-a:0:32") :
@@ -109,32 +87,6 @@ ThumbTargetMachine::ThumbTargetMachine(const Module &M, const std::string &FS)
InstrInfo = new Thumb1InstrInfo(Subtarget);
}
-unsigned ARMTargetMachine::getJITMatchQuality() {
-#if defined(__arm__)
- return 10;
-#endif
- return 0;
-}
-
-unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) {
- std::string TT = M.getTargetTriple();
- // Match arm-foo-bar, as well as things like armv5blah-*
- if (TT.size() >= 4 &&
- (TT.substr(0, 4) == "arm-" || TT.substr(0, 4) == "armv"))
- return 20;
- // If the target triple is something non-arm, we don't match.
- if (!TT.empty()) return 0;
-
- if (M.getEndianness() == Module::LittleEndian &&
- M.getPointerSize() == Module::Pointer32)
- return 10; // Weak match
- else if (M.getEndianness() != Module::AnyEndianness ||
- M.getPointerSize() != Module::AnyPointerSize)
- return 0; // Match for some other target
-
- return getJITMatchQuality()/2;
-}
-
const TargetAsmInfo *ARMBaseTargetMachine::createTargetAsmInfo() const {
switch (Subtarget.TargetType) {
diff --git a/lib/Target/ARM/ARMTargetMachine.h b/lib/Target/ARM/ARMTargetMachine.h
index 56b18ae36a..3fe259ad08 100644
--- a/lib/Target/ARM/ARMTargetMachine.h
+++ b/lib/Target/ARM/ARMTargetMachine.h
@@ -42,12 +42,13 @@ protected:
// 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)(formatted_raw_ostream &o,
- ARMBaseTargetMachine &tm,
+ TargetMachine &tm,
bool verbose);
static AsmPrinterCtorFn AsmPrinterCtor;
public:
- ARMBaseTargetMachine(const Module &M, const std::string &FS, bool isThumb);
+ ARMBaseTargetMachine(const Target &T, const Module &M, const std::string &FS,
+ bool isThumb);
virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; }
virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
@@ -60,9 +61,6 @@ public:
AsmPrinterCtor = F;
}
- static unsigned getModuleMatchQuality(const Module &M);
- static unsigned getJITMatchQuality();
-
virtual const TargetAsmInfo *createTargetAsmInfo() const;
// Pass Pipeline Configuration
@@ -99,7 +97,7 @@ class ARMTargetMachine : public ARMBaseTargetMachine {
const TargetData DataLayout; // Calculates type size & alignment
ARMTargetLowering TLInfo;
public:
- ARMTargetMachine(const Module &M, const std::string &FS);
+ ARMTargetMachine(const Target &T, const Module &M, const std::string &FS);
virtual const ARMRegisterInfo *getRegisterInfo() const {
return &InstrInfo.getRegisterInfo();
@@ -125,7 +123,7 @@ class ThumbTargetMachine : public ARMBaseTargetMachine {
const TargetData DataLayout; // Calculates type size & alignment
ARMTargetLowering TLInfo;
public:
- ThumbTargetMachine(const Module &M, const std::string &FS);
+ ThumbTargetMachine(const Target &T, const Module &M, const std::string &FS);
/// returns either Thumb1RegisterInfo of Thumb2RegisterInfo
virtual const ARMBaseRegisterInfo *getRegisterInfo() const {
diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index de6adbde55..098f5d3225 100644
--- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -31,6 +31,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
@@ -1287,7 +1288,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
/// regardless of whether the function is in SSA form.
///
FunctionPass *llvm::createARMCodePrinterPass(formatted_raw_ostream &o,
- ARMBaseTargetMachine &tm,
+ TargetMachine &tm,
bool verbose) {
return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
@@ -1301,4 +1302,8 @@ namespace {
}
// Force static initialization.
-extern "C" void LLVMInitializeARMAsmPrinter() { }
+extern "C" void LLVMInitializeARMAsmPrinter() {
+ extern Target TheARMTarget, TheThumbTarget;
+ TargetRegistry::RegisterAsmPrinter(TheARMTarget, createARMCodePrinterPass);
+ TargetRegistry::RegisterAsmPrinter(TheThumbTarget, createARMCodePrinterPass);
+}
diff --git a/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp
index 625d0cea54..a7a8162c12 100644
--- a/lib/Target/Alpha/AlphaTargetMachine.cpp
+++ b/lib/Target/Alpha/AlphaTargetMachine.cpp
@@ -22,7 +22,9 @@
using namespace llvm;
// Register the targets
-static RegisterTarget<AlphaTargetMachine> X("alpha", "Alpha [experimental]");
+extern Target TheAlphaTarget;
+static RegisterTarget<AlphaTargetMachine> X(TheAlphaTarget, "alpha",
+ "Alpha [experimental]");
// No assembler printer by default
AlphaTargetMachine::AsmPrinterCtorFn AlphaTargetMachine::AsmPrinterCtor = 0;
@@ -34,35 +36,10 @@ const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const {
return new AlphaTargetAsmInfo(*this);
}
-unsigned AlphaTargetMachine::getModuleMatchQuality(const Module &M) {
- // We strongly match "alpha*".
- std::string TT = M.getTargetTriple();
- if (TT.size() >= 5 && TT[0] == 'a' && TT[1] == 'l' && TT[2] == 'p' &&
- TT[3] == 'h' && TT[4] == 'a')
- return 20;
- // If the target triple is something non-alpha, we don't match.
- if (!TT.empty()) return 0;
-
- if (M.getEndianness() == Module::LittleEndian &&
- M.getPointerSize() == Module::Pointer64)
- return 10; // Weak match
- else if (M.getEndianness() != Module::AnyEndianness ||
- M.getPointerSize() != Module::AnyPointerSize)
- return 0; // Match for some other target
-
- return getJITMatchQuality()/2;
-}
-
-unsigned AlphaTargetMachine::getJITMatchQuality() {
-#ifdef __alpha
- return 10;
-#else
- return 0;
-#endif
-}
-
-AlphaTargetMachine::AlphaTargetMachine(const Module &M, const std::string &FS)
- : DataLayout("e-f128:128:128"),
+AlphaTargetMachine::AlphaTargetMachine(const Target &T, const Module &M,
+ const std::string &FS)
+ : LLVMTargetMachine(T),
+ DataLayout("e-f128:128:128"),
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
JITInfo(*this),
Subtarget(M, FS),
diff --git a/lib/Target/Alpha/AlphaTargetMachine.h b/lib/Target/Alpha/AlphaTargetMachine.h
index 75468923d8..6125ce57fc 100644
--- a/lib/Target/Alpha/AlphaTargetMachine.h
+++ b/lib/Target/Alpha/AlphaTargetMachine.h
@@ -45,7 +45,7 @@ protected:
static AsmPrinterCtorFn AsmPrinterCtor;
public:
- AlphaTargetMachine(const Module &M, const std::string &FS);
+ AlphaTargetMachine(const Target &T, const Module &M, const std::string &FS);
virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
@@ -61,9 +61,6 @@ public:
return &JITInfo;
}
- static unsigned getJITMatchQuality();
- static unsigned getModuleMatchQuality(const Module &M);
-
// Pass Pipeline Configuration
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
index 21622dbc72..ea810df721 100644
--- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
+++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
@@ -24,6 +24,7 @@
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetRegistry.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Mangler.h"
@@ -292,9 +293,6 @@ bool AlphaAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
return false;
}
-// Force static initialization.
-extern "C" void LLVMInitializeAlphaAsmPrinter() { }
-
namespace {
static struct Register {
Register() {
@@ -302,3 +300,10 @@ namespace {
}
} Registrator;
}
+
+// Force static initialization.
+extern "C" void LLVMInitializeAlphaAsmPrinter() {
+ extern Target TheAlphaTarget;
+ TargetRegistry::RegisterAsmPrinter(TheAlphaTarget,
+ createAlphaCodePrinterPass);
+}
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index caf91c882e..b1361e8c26 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -30,9 +30,10 @@
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/Transforms/Scalar.h"
-#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetMachineRegistry.h"
+#include "llvm/Target/TargetRegistry.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/ErrorHandling.h"
@@ -58,7 +59,8 @@ extern "C" int CBackendTargetMachineModule;
int CBackendTargetMachineModule = 0;
// Register the target.
-static RegisterTarget<CTargetMachine> X("c", "C backend");
+extern Target TheCBackendTarget;
+static RegisterTarget<CTargetMachine> X(TheCBackendTarget, "c", "C backend");
// Force static initialization.
extern "C" void LLVMInitializeCBackendTarget() { }
@@ -3186,27 +3188,27 @@ std::string CWriter::InterpretASMConstraint(InlineAsm::ConstraintInfo& c) {
const char *const *table = 0;
- //Grab the translation table from TargetAsmInfo if it exists
+ // Grab the translation table from TargetAsmInfo if it exists.
if (!TAsm) {
std::string E;
- const TargetMachineRegistry::entry* Match =
- TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, E);
+ const Target *Match =
+ TargetRegistry::getClosestStaticTargetForModule(*TheModule, E);
if (Match) {
- //Per platform Target Machines don't exist, so create it
- // this must be done only once
- const TargetMachine* TM = Match->CtorFn(*TheModule, "");
+ // Per platform Target Machines don't exist, so create it;
+ // this must be done only once.
+ const TargetMachine* TM = Match->createTargetMachine(*TheModule, "");
TAsm = TM->getTargetAsmInfo();
}
}
if (TAsm)
table = TAsm->getAsmCBE();
- //Search the translation table if it exists
+ // Search the translation table if it exists.
for (int i = 0; table && table[i]; i += 2)
if (c.Codes[0] == table[i])
return table[i+1];
- //default is identity
+ // Default is identity.
return c.Codes[0];
}
diff --git a/lib/Target/CBackend/CTargetMachine.h b/lib/Target/CBackend/CTargetMachine.h
index 64b373bdf0..b1d9e0775e 100644
--- a/lib/Target/CBackend/CTargetMachine.h
+++ b/lib/Target/CBackend/CTargetMachine.h
@@ -22,18 +22,14 @@ namespace llvm {
struct CTargetMachine : public TargetMachine {
const TargetData DataLayout; // Calculates type size & alignment
- CTargetMachine(const Module &M, const std::string &FS)
- : DataLayout(&M) {}
+ CTargetMachine(const Target &T, const Module &M, const std::string &FS)
+ : TargetMachine(T), DataLayout(&M) {}
virtual bool WantsWholeFile() const { return true; }
virtual bool addPassesToEmitWholeFile(PassManager &PM,
formatted_raw_ostream &Out,
CodeGenFileType FileType,
CodeGenOpt::Level OptLevel);
-
- // This class always works, but must be requested explicitly on
- // llc command line.
- static unsigned getModuleMatchQuality(const Module &M) { return 0; }
virtual const TargetData *getTargetData() const { return &DataLayout; }
};
diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
index f0d8a36132..0c36457913 100644
--- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
+++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
@@ -37,6 +37,7 @@
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include <set>
@@ -289,7 +290,7 @@ namespace {
class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter {
DwarfWriter *DW;
public:
- explicit LinuxAsmPrinter(formatted_raw_ostream &O, SPUTargetMachine &TM,
+ explicit LinuxAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
const TargetAsmInfo *T, bool V)
: SPUAsmPrinter(O, TM, T, V), DW(0) {}
@@ -599,14 +600,11 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
/// that the Linux SPU assembler can deal with.
///
FunctionPass *llvm::createSPUAsmPrinterPass(formatted_raw_ostream &o,
- SPUTargetMachine &tm,
+ TargetMachine &tm,
bool verbose) {
return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
-// Force static initialization.
-extern "C" void LLVMInitializeCellSPUAsmPrinter() { }
-
namespace {
static struct Register {
Register() {
@@ -614,3 +612,9 @@ namespace {
}
} Registrator;
}
+
+// Force static initialization.
+extern "C" void LLVMInitializeCellSPUAsmPrinter() {
+ extern Target TheCellSPUTarget;
+ TargetRegistry::RegisterAsmPrinter(TheCellSPUTarget, createSPUAsmPrinterPass);