[PATCH] D53446: Set MAttrs in LTO mode

Yin Ma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 19 12:16:15 PDT 2018


yinma updated this revision to Diff 170235.
yinma retitled this revision from "Set CGOptLevel and MAttrs in LTO mode" to "Set MAttrs in LTO mode".
yinma edited the summary of this revision.
yinma added a comment.

I see you point. I have removed CGOptLevel portion


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53446

Files:
  COFF/LTO.cpp
  Common/TargetOptionsCommandFlags.cpp
  ELF/LTO.cpp
  include/lld/Common/TargetOptionsCommandFlags.h
  wasm/LTO.cpp


Index: wasm/LTO.cpp
===================================================================
--- wasm/LTO.cpp
+++ wasm/LTO.cpp
@@ -56,6 +56,9 @@
   C.DiagHandler = diagnosticHandler;
   C.OptLevel = Config->LTOO;
 
+  // Add -mattr options
+  C.MAttrs = GetMAttrs();
+
   if (Config->SaveTemps)
     checkError(C.addSaveTemps(Config->OutputFile.str() + ".",
                               /*UseInputModulePath*/ true));
Index: include/lld/Common/TargetOptionsCommandFlags.h
===================================================================
--- include/lld/Common/TargetOptionsCommandFlags.h
+++ include/lld/Common/TargetOptionsCommandFlags.h
@@ -19,4 +19,5 @@
 llvm::TargetOptions InitTargetOptionsFromCodeGenFlags();
 llvm::Optional<llvm::CodeModel::Model> GetCodeModelFromCMModel();
 std::string GetCPUStr();
+std::vector<std::string> GetMAttrs();
 }
Index: ELF/LTO.cpp
===================================================================
--- ELF/LTO.cpp
+++ ELF/LTO.cpp
@@ -89,6 +89,9 @@
   C.OptLevel = Config->LTOO;
   C.CPU = GetCPUStr();
 
+  // Add -mattr options
+  C.MAttrs = GetMAttrs();
+
   // Set up a custom pipeline if we've been asked to.
   C.OptPipeline = Config->LTONewPmPasses;
   C.AAPipeline = Config->LTOAAPipeline;
Index: Common/TargetOptionsCommandFlags.cpp
===================================================================
--- Common/TargetOptionsCommandFlags.cpp
+++ Common/TargetOptionsCommandFlags.cpp
@@ -32,3 +32,11 @@
 }
 
 std::string lld::GetCPUStr() { return ::getCPUStr(); }
+
+std::vector<std::string> lld::GetMAttrs(){
+  std::vector<std::string> Attrs;
+  for (std::string &Attr : MAttrs)
+    Attrs.push_back(Attr);
+  return Attrs;
+}
+
Index: COFF/LTO.cpp
===================================================================
--- COFF/LTO.cpp
+++ COFF/LTO.cpp
@@ -60,6 +60,10 @@
   C.DisableVerify = true;
   C.DiagHandler = diagnosticHandler;
   C.OptLevel = Config->LTOO;
+
+  // Add -mattr options
+  C.MAttrs = GetMAttrs();
+
   if (Config->SaveTemps)
     checkError(C.addSaveTemps(std::string(Config->OutputFile) + ".",
                               /*UseInputModulePath*/ true));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53446.170235.patch
Type: text/x-patch
Size: 2127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181019/0312a20a/attachment.bin>


More information about the llvm-commits mailing list