Add an -mattr option to the gold plugin to support subtarget features in LTO

This adds support for an -mattr option to the gold plugin and to llvm-lto. This
allows the caller to specify details of the subtarget architecture, like +aes,
or +ssse3 on x86.  Note that this requires a change to the include/llvm-c/lto.h
interface: it adds a function lto_codegen_set_attr and it increments the
version of the interface.

llvm-svn: 207279
diff --git a/llvm/include/llvm-c/lto.h b/llvm/include/llvm-c/lto.h
index 808de03..9c2061a 100644
--- a/llvm/include/llvm-c/lto.h
+++ b/llvm/include/llvm-c/lto.h
@@ -40,7 +40,7 @@
  * @{
  */
 
-#define LTO_API_VERSION 10
+#define LTO_API_VERSION 11
 
 /**
  * \since prior to LTO_API_VERSION=3
@@ -375,6 +375,14 @@
 extern void
 lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu);
 
+/**
+ * Sets attributes for the cpu to generate code for.
+ *
+ * \since LTO_API_VERSION=11
+ */
+extern void
+lto_codegen_set_attr(lto_code_gen_t cg, const char *attr);
+
 
 /**
  * Sets the location of the assembler tool to run. If not set, libLTO
diff --git a/llvm/include/llvm/LTO/LTOCodeGenerator.h b/llvm/include/llvm/LTO/LTOCodeGenerator.h
index 5433991..7e297c3 100644
--- a/llvm/include/llvm/LTO/LTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/LTOCodeGenerator.h
@@ -73,6 +73,7 @@
   void setCodePICModel(lto_codegen_model);
 
   void setCpu(const char *mCpu) { MCpu = mCpu; }
+  void setAttr(const char *mAttr) { MAttr = mAttr; }
 
   void addMustPreserveSymbol(const char *sym) { MustPreserveSymbols[sym] = 1; }
 
@@ -150,6 +151,7 @@
   llvm::MemoryBuffer *NativeObjectFile;
   std::vector<char *> CodegenOptions;
   std::string MCpu;
+  std::string MAttr;
   std::string NativeObjectPath;
   llvm::TargetOptions Options;
   lto_diagnostic_handler_t DiagHandler;