diff options
author | Tom Roeder <tmroeder@google.com> | 2014-04-25 21:46:51 +0000 |
---|---|---|
committer | Tom Roeder <tmroeder@google.com> | 2014-04-25 21:46:51 +0000 |
commit | fd1bc602b31c2acdd8cba6be835b9bba5d424af6 (patch) | |
tree | 67acfd8a53f1e0d86e8bc658bbefcb661ae98838 /llvm/tools/llvm-lto/llvm-lto.cpp | |
parent | b54d0f4020de4d6d8c17f1d353a924b570b20a15 (diff) | |
download | bcm5719-llvm-fd1bc602b31c2acdd8cba6be835b9bba5d424af6.tar.gz bcm5719-llvm-fd1bc602b31c2acdd8cba6be835b9bba5d424af6.zip |
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
Diffstat (limited to 'llvm/tools/llvm-lto/llvm-lto.cpp')
-rw-r--r-- | llvm/tools/llvm-lto/llvm-lto.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index 1a92bf4f0ea..678e4db08f3 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -143,6 +143,16 @@ int main(int argc, char **argv) { for (unsigned i = 0; i < KeptDSOSyms.size(); ++i) CodeGen.addMustPreserveSymbol(KeptDSOSyms[i].c_str()); + std::string attrs; + for (unsigned i = 0; i < MAttrs.size(); ++i) { + if (i > 0) + attrs.append(","); + attrs.append(MAttrs[i]); + } + + if (!attrs.empty()) + CodeGen.setAttr(attrs.c_str()); + if (!OutputFilename.empty()) { size_t len = 0; std::string ErrorInfo; |