diff options
| author | Eric Christopher <echristo@gmail.com> | 2013-10-16 20:40:08 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@gmail.com> | 2013-10-16 20:40:08 +0000 |
| commit | 643bb6a17650697128e7872f931bd1be0812e42a (patch) | |
| tree | 3b9c08383d64c979b068b0cc2eddfbc55a79e17f /clang/lib/Driver/Tools.cpp | |
| parent | 081efcc3ac293a30a285f3e8745b9c1ea21ced5a (diff) | |
| download | bcm5719-llvm-643bb6a17650697128e7872f931bd1be0812e42a.tar.gz bcm5719-llvm-643bb6a17650697128e7872f931bd1be0812e42a.zip | |
Rework ppc options handling into a features group.
This should have no functional behavior.
llvm-svn: 192838
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 91228dca166..68a5fe8f9a0 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1112,24 +1112,33 @@ static std::string getPPCTargetCPU(const ArgList &Args) { static void getPPCTargetFeatures(const ArgList &Args, std::vector<const char *> &Features) { - // Allow override of the Altivec feature. - AddTargetFeature(Args, Features, options::OPT_faltivec, - options::OPT_fno_altivec, "altivec"); + for (arg_iterator it = Args.filtered_begin(options::OPT_m_ppc_Features_Group), + ie = Args.filtered_end(); + it != ie; ++it) { + StringRef Name = (*it)->getOption().getName(); + (*it)->claim(); - AddTargetFeature(Args, Features, options::OPT_mfprnd, options::OPT_mno_fprnd, - "fprnd"); + // Skip over "-m". + assert(Name.startswith("m") && "Invalid feature name."); + Name = Name.substr(1); - // Note that gcc calls this mfcrf and LLVM calls this mfocrf. - AddTargetFeature(Args, Features, options::OPT_mmfcrf, options::OPT_mno_mfcrf, - "mfocrf"); + bool IsNegative = Name.startswith("no-"); + if (IsNegative) + Name = Name.substr(3); + + // Note that gcc calls this mfcrf and LLVM calls this mfocrf so we + // pass the correct option to the backend while calling the frontend + // option the same. + // TODO: Change the LLVM backend option maybe? + if (Name == "mfcrf") + Name = "mfocrf"; - AddTargetFeature(Args, Features, options::OPT_mpopcntd, - options::OPT_mno_popcntd, "popcntd"); + Features.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name)); + } - // It is really only possible to turn qpx off because turning qpx on is tied - // to using the a2q CPU. - if (Args.hasFlag(options::OPT_mno_qpx, options::OPT_mqpx, false)) - Features.push_back("-qpx"); + // Altivec is a bit weird, allow overriding of the Altivec feature here. + AddTargetFeature(Args, Features, options::OPT_faltivec, + options::OPT_fno_altivec, "altivec"); } /// Get the (LLVM) name of the R600 gpu we are targeting. |

