#include "PPC.h"
#include "PPCTargetAsmInfo.h"
#include "PPCTargetMachine.h"
-#include "llvm/Module.h"
#include "llvm/PassManager.h"
-#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetRegistry.h"
#include "llvm/Support/FormattedStream.h"
using namespace llvm;
-/// PowerPCTargetMachineModule - 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 PowerPCTargetMachineModule;
-int PowerPCTargetMachineModule = 0;
-
-// Register the targets
-extern Target ThePPC32Target;
-static RegisterTarget<PPC32TargetMachine>
-X(ThePPC32Target, "ppc32", "PowerPC 32");
-
-extern Target ThePPC64Target;
-static RegisterTarget<PPC64TargetMachine>
-Y(ThePPC64Target, "ppc64", "PowerPC 64");
-
-// Force static initialization.
-extern "C" void LLVMInitializePowerPCTarget() { }
+extern "C" void LLVMInitializePowerPCTarget() {
+ // Register the targets
+ RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target);
+ RegisterTargetMachine<PPC64TargetMachine> B(ThePPC64Target);
+}
const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const {
if (Subtarget.isDarwin())
return new PPCDarwinTargetAsmInfo(*this);
- else
- return new PPCLinuxTargetAsmInfo(*this);
+ return new PPCLinuxTargetAsmInfo(*this);
}
-PPCTargetMachine::PPCTargetMachine(const Target&T, const Module &M,
+PPCTargetMachine::PPCTargetMachine(const Target &T, const std::string &TT,
const std::string &FS, bool is64Bit)
- : LLVMTargetMachine(T),
- Subtarget(*this, M, FS, is64Bit),
+ : LLVMTargetMachine(T, TT),
+ Subtarget(TT, FS, is64Bit),
DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this),
FrameInfo(*this, is64Bit), JITInfo(*this, is64Bit), TLInfo(*this),
InstrItins(Subtarget.getInstrItineraryData()), MachOWriterInfo(*this) {
/// groups, which typically degrades performance.
bool PPCTargetMachine::getEnableTailMergeDefault() const { return false; }
-PPC32TargetMachine::PPC32TargetMachine(const Target &T, const Module &M,
+PPC32TargetMachine::PPC32TargetMachine(const Target &T, const std::string &TT,
const std::string &FS)
- : PPCTargetMachine(T, M, FS, false) {
+ : PPCTargetMachine(T, TT, FS, false) {
}
-PPC64TargetMachine::PPC64TargetMachine(const Target &T, const Module &M,
+PPC64TargetMachine::PPC64TargetMachine(const Target &T, const std::string &TT,
const std::string &FS)
- : PPCTargetMachine(T, M, FS, true) {
+ : PPCTargetMachine(T, TT, FS, true) {
}