mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
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
This commit is contained in:
parent
8245a1dd53
commit
8461202767
@ -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,")))
|
||||
]>;
|
||||
|
||||
|
33
tools/llvmc/plugins/Base/Hooks.cpp
Normal file
33
tools/llvmc/plugins/Base/Hooks.cpp
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user