bool handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) override;
+ void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
+ bool Enabled) const override;
+
BuiltinVaListKind getBuiltinVaListKind() const override {
return TargetInfo::CharPtrBuiltinVaList;
}
}
}
+bool HexagonTargetInfo::initFeatureMap(llvm::StringMap<bool> &Features,
+ DiagnosticsEngine &Diags, StringRef CPU,
+ const std::vector<std::string> &FeaturesVec) const {
+ // Default for v60: -hvx, -hvx-double.
+ Features["hvx"] = false;
+ Features["hvx-double"] = false;
+ Features["long-calls"] = false;
+
+ return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
+}
+
bool HexagonTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) {
for (auto &F : Features) {
if (F == "+long-calls")
UseLongCalls = true;
+ else if (F == "-long-calls")
+ UseLongCalls = false;
}
return true;
}
-bool HexagonTargetInfo::initFeatureMap(llvm::StringMap<bool> &Features,
- DiagnosticsEngine &Diags, StringRef CPU,
- const std::vector<std::string> &FeaturesVec) const {
- // Default for v60: -hvx, -hvx-double.
- Features["hvx"] = false;
- Features["hvx-double"] = false;
- Features["long-calls"] = false;
-
- return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
+void HexagonTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
+ StringRef Name, bool Enabled) const {
+ if (Enabled) {
+ if (Name == "hvx-double")
+ Features["hvx"] = true;
+ } else {
+ if (Name == "hvx")
+ Features["hvx-double"] = false;
+ }
+ Features[Name] = Enabled;
}
const char *const HexagonTargetInfo::GCCRegNames[] = {
static void getHexagonTargetFeatures(const ArgList &Args,
std::vector<const char *> &Features) {
- bool HasHVX = false, HasHVXD = false, UseLongCalls = false;
-
- // FIXME: This should be able to use handleTargetFeaturesGroup except it is
- // doing dependent option handling here rather than in initFeatureMap or a
- // similar handler.
- for (auto &A : Args) {
- auto &Opt = A->getOption();
- if (Opt.matches(options::OPT_mhexagon_hvx))
- HasHVX = true;
- else if (Opt.matches(options::OPT_mno_hexagon_hvx))
- HasHVXD = HasHVX = false;
- else if (Opt.matches(options::OPT_mhexagon_hvx_double))
- HasHVXD = HasHVX = true;
- else if (Opt.matches(options::OPT_mno_hexagon_hvx_double))
- HasHVXD = false;
- else if (Opt.matches(options::OPT_mlong_calls))
+ handleTargetFeaturesGroup(Args, Features,
+ options::OPT_m_hexagon_Features_Group);
+
+ bool UseLongCalls = false;
+ if (Arg *A = Args.getLastArg(options::OPT_mlong_calls,
+ options::OPT_mno_long_calls)) {
+ if (A->getOption().matches(options::OPT_mlong_calls))
UseLongCalls = true;
- else if (Opt.matches(options::OPT_mno_long_calls))
- UseLongCalls = false;
- else
- continue;
- A->claim();
}
- Features.push_back(HasHVX ? "+hvx" : "-hvx");
- Features.push_back(HasHVXD ? "+hvx-double" : "-hvx-double");
Features.push_back(UseLongCalls ? "+long-calls" : "-long-calls");
}