Eliminate object-relinking support from CMake. Fixes PR 4429 and
[oota-llvm.git] / lib / Target / Mips / MipsTargetMachine.cpp
index 25a0eaa857c57819dad7445d0b76b0d85e9e71bc..83b9b62e8ee86c6060ae383f75a88f1cc1a6a431 100644 (file)
 #include "llvm/Target/TargetMachineRegistry.h"
 using namespace llvm;
 
+/// MipsTargetMachineModule - 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 MipsTargetMachineModule;
+int MipsTargetMachineModule = 0;
+
 // Register the target.
 static RegisterTarget<MipsTargetMachine>    X("mips", "Mips");
 static RegisterTarget<MipselTargetMachine>  Y("mipsel", "Mipsel");
 
+MipsTargetMachine::AsmPrinterCtorFn MipsTargetMachine::AsmPrinterCtor = 0;
+
+
+// Force static initialization when called from llvm/InitializeAllTargets.h
+namespace llvm {
+  void InitializeMipsTarget() { }
+}
+
 const TargetAsmInfo *MipsTargetMachine::
 createTargetAsmInfo() const 
 {
@@ -97,7 +113,7 @@ getModuleMatchQuality(const Module &M)
 // Install an instruction selector pass using 
 // the ISelDag to gen Mips code.
 bool MipsTargetMachine::
-addInstSelector(PassManagerBase &PM, bool Fast
+addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel
 {
   PM.add(createMipsISelDag(*this));
   return false;
@@ -107,7 +123,7 @@ addInstSelector(PassManagerBase &PM, bool Fast)
 // machine code is emitted. return true if -print-machineinstrs should 
 // print out the code after the passes.
 bool MipsTargetMachine::
-addPreEmitPass(PassManagerBase &PM, bool Fast
+addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel
 {
   PM.add(createMipsDelaySlotFillerPass(*this));
   return true;
@@ -116,10 +132,10 @@ addPreEmitPass(PassManagerBase &PM, bool Fast)
 // Implements the AssemblyEmitter for the target. Must return
 // true if AssemblyEmitter is supported
 bool MipsTargetMachine::
-addAssemblyEmitter(PassManagerBase &PM, bool Fast, 
-                   raw_ostream &Out) 
-{
+addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, 
+                   bool Verbose, raw_ostream &Out)  {
   // Output assembly language.
-  PM.add(createMipsCodePrinterPass(Out, *this));
+  assert(AsmPrinterCtor && "AsmPrinter was not linked in");
+  PM.add(AsmPrinterCtor(Out, *this, OptLevel, Verbose));
   return false;
 }