[llvm-commits] [llvm] r95109 - in /llvm/trunk: include/llvm/Target/TargetMachine.h lib/CodeGen/LLVMTargetMachine.cpp tools/llc/llc.cpp tools/lto/LTOCodeGenerator.cpp

Chris Lattner sabre at nondot.org
Tue Feb 2 11:14:27 PST 2010


Author: lattner
Date: Tue Feb  2 13:14:27 2010
New Revision: 95109

URL: http://llvm.org/viewvc/llvm-project?rev=95109&view=rev
Log:
eliminate all forms of addPassesToEmitMachineCode except
the one used by the JIT.  Remove all forms of
addPassesToEmitFileFinish except the one used by the static
code generator.  Inline the remaining version of
addPassesToEmitFileFinish into its only caller.

Modified:
    llvm/trunk/include/llvm/Target/TargetMachine.h
    llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
    llvm/trunk/tools/llc/llc.cpp
    llvm/trunk/tools/lto/LTOCodeGenerator.cpp

Modified: llvm/trunk/include/llvm/Target/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=95109&r1=95108&r2=95109&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetMachine.h (original)
+++ llvm/trunk/include/llvm/Target/TargetMachine.h Tue Feb  2 13:14:27 2010
@@ -234,48 +234,6 @@
     return FileModel::None;
   }
 
-  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
-  /// to be split up (e.g., to add an object writer pass), this method can be
-  /// used to finish up adding passes to emit the file, if necessary.
-  ///
-  virtual bool addPassesToEmitFileFinish(PassManagerBase &,
-                                         MachineCodeEmitter *,
-                                         CodeGenOpt::Level) {
-    return true;
-  }
- 
-  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
-  /// to be split up (e.g., to add an object writer pass), this method can be
-  /// used to finish up adding passes to emit the file, if necessary.
-  ///
-  virtual bool addPassesToEmitFileFinish(PassManagerBase &,
-                                         JITCodeEmitter *,
-                                         CodeGenOpt::Level) {
-    return true;
-  }
- 
-  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
-  /// to be split up (e.g., to add an object writer pass), this method can be
-  /// used to finish up adding passes to emit the file, if necessary.
-  ///
-  virtual bool addPassesToEmitFileFinish(PassManagerBase &,
-                                         ObjectCodeEmitter *,
-                                         CodeGenOpt::Level) {
-    return true;
-  }
- 
-  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
-  /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
-  /// actually outputting the machine code and resolving things like the address
-  /// of functions.  This method returns true if machine code emission is
-  /// not supported.
-  ///
-  virtual bool addPassesToEmitMachineCode(PassManagerBase &,
-                                          MachineCodeEmitter &,
-                                          CodeGenOpt::Level) {
-    return true;
-  }
-
   /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
   /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
   /// actually outputting the machine code and resolving things like the address
@@ -312,9 +270,6 @@
   bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level);
 
 private:
-  // These routines are used by addPassesToEmitFileFinish and
-  // addPassesToEmitMachineCode to set the CodeModel if it's still marked
-  // as default.
   virtual void setCodeModelForJIT();
   virtual void setCodeModelForStatic();
   
@@ -336,40 +291,6 @@
                                                CodeGenFileType FileType,
                                                CodeGenOpt::Level);
   
-  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
-  /// to be split up (e.g., to add an object writer pass), this method can be
-  /// used to finish up adding passes to emit the file, if necessary.
-  ///
-  virtual bool addPassesToEmitFileFinish(PassManagerBase &PM,
-                                         MachineCodeEmitter *MCE,
-                                         CodeGenOpt::Level);
- 
-  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
-  /// to be split up (e.g., to add an object writer pass), this method can be
-  /// used to finish up adding passes to emit the file, if necessary.
-  ///
-  virtual bool addPassesToEmitFileFinish(PassManagerBase &PM,
-                                         JITCodeEmitter *JCE,
-                                         CodeGenOpt::Level);
- 
-  /// addPassesToEmitFileFinish - If the passes to emit the specified file had
-  /// to be split up (e.g., to add an object writer pass), this method can be
-  /// used to finish up adding passes to emit the file, if necessary.
-  ///
-  virtual bool addPassesToEmitFileFinish(PassManagerBase &PM,
-                                         ObjectCodeEmitter *OCE,
-                                         CodeGenOpt::Level);
- 
-  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
-  /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
-  /// actually outputting the machine code and resolving things like the address
-  /// of functions.  This method returns true if machine code emission is
-  /// not supported.
-  ///
-  virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
-                                          MachineCodeEmitter &MCE,
-                                          CodeGenOpt::Level);
-  
   /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
   /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
   /// actually outputting the machine code and resolving things like the address

Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=95109&r1=95108&r2=95109&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Tue Feb  2 13:14:27 2010
@@ -105,91 +105,27 @@
   if (addCommonCodeGenPasses(PM, OptLevel))
     return FileModel::Error;
 
+  FileModel::Model ResultTy;
   switch (FileType) {
   default:
-    break;
+    return FileModel::Error;
+  case TargetMachine::ObjectFile:
+    return FileModel::Error;
   case TargetMachine::AssemblyFile: {
     FunctionPass *Printer =
       getTarget().createAsmPrinter(Out, *this, getMCAsmInfo(),
                                    getAsmVerbosityDefault());
-    if (Printer == 0) break;
+    if (Printer == 0) return FileModel::Error;
     PM.add(Printer);
-    return FileModel::AsmFile;
+    ResultTy = FileModel::AsmFile;
+    break;
   }
-  case TargetMachine::ObjectFile:
-    return FileModel::Error;
   }
-  return FileModel::Error;
-}
-
-/// addPassesToEmitFileFinish - If the passes to emit the specified file had to
-/// be split up (e.g., to add an object writer pass), this method can be used to
-/// finish up adding passes to emit the file, if necessary.
-bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM,
-                                                  MachineCodeEmitter *MCE,
-                                                  CodeGenOpt::Level OptLevel) {
-  // Make sure the code model is set.
-  setCodeModelForStatic();
   
-  if (MCE)
-    addSimpleCodeEmitter(PM, OptLevel, *MCE);
-
-  PM.add(createGCInfoDeleter());
-
-  return false; // success!
-}
-
-/// addPassesToEmitFileFinish - If the passes to emit the specified file had to
-/// be split up (e.g., to add an object writer pass), this method can be used to
-/// finish up adding passes to emit the file, if necessary.
-bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM,
-                                                  JITCodeEmitter *JCE,
-                                                  CodeGenOpt::Level OptLevel) {
-  // Make sure the code model is set.
-  setCodeModelForJIT();
-  
-  if (JCE)
-    addSimpleCodeEmitter(PM, OptLevel, *JCE);
-
-  PM.add(createGCInfoDeleter());
-
-  return false; // success!
-}
-
-/// addPassesToEmitFileFinish - If the passes to emit the specified file had to
-/// be split up (e.g., to add an object writer pass), this method can be used to
-/// finish up adding passes to emit the file, if necessary.
-bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM,
-                                                  ObjectCodeEmitter *OCE,
-                                                  CodeGenOpt::Level OptLevel) {
   // Make sure the code model is set.
   setCodeModelForStatic();
-  
-  PM.add(createGCInfoDeleter());
-
-  return false; // success!
-}
-
-/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
-/// get machine code emitted.  This uses a MachineCodeEmitter object to handle
-/// actually outputting the machine code and resolving things like the address
-/// of functions.  This method should returns true if machine code emission is
-/// not supported.
-///
-bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
-                                                   MachineCodeEmitter &MCE,
-                                                   CodeGenOpt::Level OptLevel) {
-  // Make sure the code model is set.
-  setCodeModelForJIT();
-  
-  // Add common CodeGen passes.
-  if (addCommonCodeGenPasses(PM, OptLevel))
-    return true;
-
-  addCodeEmitter(PM, OptLevel, MCE);
   PM.add(createGCInfoDeleter());
-
-  return false; // success!
+  return ResultTy;
 }
 
 /// addPassesToEmitMachineCode - Add passes to the specified pass manager to

Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=95109&r1=95108&r2=95109&view=diff

==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Tue Feb  2 13:14:27 2010
@@ -363,15 +363,6 @@
       break;
     }
 
-    if (Target.addPassesToEmitFileFinish(Passes, (ObjectCodeEmitter *)0, OLvl)){
-      errs() << argv[0] << ": target does not support generation of this"
-             << " file type!\n";
-      if (Out != &fouts()) delete Out;
-      // And the Out file is empty and useless, so remove it now.
-      sys::Path(OutputFilename).eraseFromDisk();
-      return 1;
-    }
-
     Passes.doInitialization();
 
     // Run our queue of passes all at once now, efficiently.

Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=95109&r1=95108&r2=95109&view=diff

==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Tue Feb  2 13:14:27 2010
@@ -405,12 +405,6 @@
             return true;
     }
 
-    if (_target->addPassesToEmitFileFinish(*codeGenPasses,(ObjectCodeEmitter*)0,
-                                           CodeGenOpt::Aggressive)) {
-        errMsg = "target does not support generation of this file type";
-        return true;
-    }
-
     // Run our queue of passes all at once now, efficiently.
     passes.run(*mergedModule);
 





More information about the llvm-commits mailing list