LTO: Maintain target triple, FeatureStr and CGOptLevel in the module or LTOCodeGenerator.
[oota-llvm.git] / include / llvm / LTO / LTOCodeGenerator.h
index 0c46fc048a43b8772dd973d7d737081e675de80e..33ac009c796e6e522dd9be3ce3aa41b0749dbd8c 100644 (file)
@@ -73,11 +73,11 @@ struct LTOCodeGenerator {
 
   void setTargetOptions(TargetOptions options);
   void setDebugInfo(lto_debug_model);
-  void setCodePICModel(lto_codegen_model);
+  void setCodePICModel(Reloc::Model model) { RelocModel = model; }
 
   void setCpu(const char *mCpu) { MCpu = mCpu; }
   void setAttr(const char *mAttr) { MAttr = mAttr; }
-  void setOptLevel(unsigned optLevel) { OptLevel = optLevel; }
+  void setOptLevel(unsigned optLevel);
 
   void setShouldInternalize(bool Value) { ShouldInternalize = Value; }
   void setShouldEmbedUselists(bool Value) { ShouldEmbedUselists = Value; }
@@ -159,17 +159,19 @@ private:
   std::unique_ptr<LLVMContext> OwnedContext;
   LLVMContext &Context;
   Linker IRLinker;
-  TargetMachine *TargetMach = nullptr;
+  std::unique_ptr<TargetMachine> TargetMach;
   bool EmitDwarfDebugInfo = false;
   bool ScopeRestrictionsDone = false;
-  lto_codegen_model CodeModel = LTO_CODEGEN_PIC_MODEL_DEFAULT;
+  Reloc::Model RelocModel = Reloc::Default;
   StringSet MustPreserveSymbols;
   StringSet AsmUndefinedRefs;
-  std::vector<char *> CodegenOptions;
+  std::vector<std::string> CodegenOptions;
+  std::string FeatureStr;
   std::string MCpu;
   std::string MAttr;
   std::string NativeObjectPath;
   TargetOptions Options;
+  CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default;
   unsigned OptLevel = 2;
   lto_diagnostic_handler_t DiagHandler = nullptr;
   void *DiagContext = nullptr;