diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2009-12-07 17:03:21 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2009-12-07 17:03:21 +0000 |
commit | 8461202767684d57f5f43eb613ac5c56301c7586 (patch) | |
tree | 4d703f680aeacaf15b1a4014699922bc40cc0049 /tools/llvmc | |
parent | 8245a1dd530083f6b6bfebd0f42ade1942ad871f (diff) | |
download | external_llvm-8461202767684d57f5f43eb613ac5c56301c7586.zip external_llvm-8461202767684d57f5f43eb613ac5c56301c7586.tar.gz external_llvm-8461202767684d57f5f43eb613ac5c56301c7586.tar.bz2 |
Pass '-msse' and friends to llc as '-mattr=+/-'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90771 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc')
-rw-r--r-- | tools/llvmc/plugins/Base/Base.td.in | 7 | ||||
-rw-r--r-- | tools/llvmc/plugins/Base/Hooks.cpp | 33 |
2 files changed, 39 insertions, 1 deletions
diff --git a/tools/llvmc/plugins/Base/Base.td.in b/tools/llvmc/plugins/Base/Base.td.in index e2b6eca..69b41ed 100644 --- a/tools/llvmc/plugins/Base/Base.td.in +++ b/tools/llvmc/plugins/Base/Base.td.in @@ -82,7 +82,10 @@ def OptList : OptionList<[ (prefix_list_option "Wl,", (help "Pass options to linker")), (prefix_list_option "Wo,", - (help "Pass options to opt")) + (help "Pass options to opt")), + (prefix_list_option "m", + (help "Enable or disable various extensions (-mmmx, -msse, etc.)"), + (hidden)) ]>; // Option preprocessor. @@ -132,6 +135,7 @@ class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool< (not_empty "march"), (forward "march"), (not_empty "mtune"), (forward "mtune"), (not_empty "mcpu"), (forward "mcpu"), + (not_empty "m"), (forward "m"), (switch_on "m32"), (forward "m32"), (switch_on "m64"), (forward "m64"), (switch_on "O1"), (forward "O1"), @@ -197,6 +201,7 @@ def llc : Tool< (not_empty "march"), (forward "mcpu"), (not_empty "mtune"), (forward "mcpu"), (not_empty "mcpu"), (forward "mcpu"), + (not_empty "m"), (forward_transformed_value "m", "ConvertToMAttr"), (not_empty "Wllc,"), (unpack_values "Wllc,"))) ]>; diff --git a/tools/llvmc/plugins/Base/Hooks.cpp b/tools/llvmc/plugins/Base/Hooks.cpp new file mode 100644 index 0000000..661a914 --- /dev/null +++ b/tools/llvmc/plugins/Base/Hooks.cpp @@ -0,0 +1,33 @@ +#include <string> +#include <vector> + +namespace hooks { +typedef std::vector<std::string> StrVec; + +/// ConvertToMAttr - Convert -m* and -mno-* to -mattr=+*,-* +std::string ConvertToMAttr(const StrVec& Opts) { + std::string out("-mattr="); + + bool firstIter = true; + for (StrVec::const_iterator B = Opts.begin(), E = Opts.end(); B!=E; ++B) { + const std::string& Arg = *B; + + if (firstIter) + firstIter = false; + else + out += ","; + + if (Arg.find("no-") == 0 && Arg[3] != 0) { + out += '-'; + out += Arg.c_str() + 3; + } + else { + out += '+'; + out += Arg; + } + } + + return out; +} + +} |