From 8e4b86fdabca3c0404ad36a02e90a8d4cc4428d2 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 19 Aug 2015 02:24:21 +0000 Subject: [PATCH] Rename getDefaultFeatures -> initDefaultFeatures and update comment with the current behavior as the name seems to match what's going on. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245405 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/TargetInfo.h | 9 +++++---- lib/Basic/Targets.cpp | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 6d09538b5c..c804b2d036 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -737,10 +737,11 @@ public: /// language options which change the target configuration. virtual void adjust(const LangOptions &Opts); - /// \brief Get the default set of target features for the CPU; - /// this should include all legal feature strings on the target. - virtual void getDefaultFeatures(llvm::StringMap &Features) const { - } + /// \brief Initialize the map with the default set of target features for the + /// CPU, ABI, and FPMath options - these should have already been set prior + /// to calling this function; this should include all legal feature strings on + /// the target. + virtual void initDefaultFeatures(llvm::StringMap &Features) const {} /// \brief Get the ABI currently in use. virtual StringRef getABI() const { return StringRef(); } diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index c5309c4caf..0ebe8a23c3 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -863,7 +863,7 @@ public: void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override; - void getDefaultFeatures(llvm::StringMap &Features) const override; + void initDefaultFeatures(llvm::StringMap &Features) const override; bool handleTargetFeatures(std::vector &Features, DiagnosticsEngine &Diags) override; @@ -1262,7 +1262,7 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, // __NO_FPRS__ } -void PPCTargetInfo::getDefaultFeatures(llvm::StringMap &Features) const { +void PPCTargetInfo::initDefaultFeatures(llvm::StringMap &Features) const { Features["altivec"] = llvm::StringSwitch(CPU) .Case("7400", true) .Case("g4", true) @@ -1332,7 +1332,7 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const { -mcpu=pwr8 -mno-vsx (should disable vsx and everything that depends on it) -mcpu=pwr8 -mdirect-move -mno-vsx (should actually be diagnosed) -NOTE: Do not call this from PPCTargetInfo::getDefaultFeatures +NOTE: Do not call this from PPCTargetInfo::initDefaultFeatures */ void PPCTargetInfo::setFeatureEnabled(llvm::StringMap &Features, StringRef Name, bool Enabled) const { @@ -2308,10 +2308,10 @@ public: setFeatureEnabledImpl(Features, Name, Enabled); } // This exists purely to cut down on the number of virtual calls in - // getDefaultFeatures which calls this repeatedly. + // initDefaultFeatures which calls this repeatedly. static void setFeatureEnabledImpl(llvm::StringMap &Features, StringRef Name, bool Enabled); - void getDefaultFeatures(llvm::StringMap &Features) const override; + void initDefaultFeatures(llvm::StringMap &Features) const override; bool hasFeature(StringRef Feature) const override; bool handleTargetFeatures(std::vector &Features, DiagnosticsEngine &Diags) override; @@ -2502,7 +2502,7 @@ bool X86TargetInfo::setFPMath(StringRef Name) { return false; } -void X86TargetInfo::getDefaultFeatures(llvm::StringMap &Features) const { +void X86TargetInfo::initDefaultFeatures(llvm::StringMap &Features) const { // FIXME: This *really* should not be here. // X86_64 always has SSE2. @@ -4459,7 +4459,7 @@ public: } // FIXME: This should be based on Arch attributes, not CPU names. - void getDefaultFeatures(llvm::StringMap &Features) const override { + void initDefaultFeatures(llvm::StringMap &Features) const override { if (CPU == "arm1136jf-s" || CPU == "arm1176jzf-s" || CPU == "mpcore") Features["vfp2"] = true; else if (CPU == "cortex-a8" || CPU == "cortex-a9") { @@ -5900,7 +5900,7 @@ public: return CPUKnown; } - void getDefaultFeatures(llvm::StringMap &Features) const override { + void initDefaultFeatures(llvm::StringMap &Features) const override { if (CPU == "zEC12") Features["transactional-execution"] = true; if (CPU == "z13") { @@ -6267,7 +6267,7 @@ public: .Default(false); } const std::string& getCPU() const { return CPU; } - void getDefaultFeatures(llvm::StringMap &Features) const override { + void initDefaultFeatures(llvm::StringMap &Features) const override { if (CPU == "octeon") Features["mips64r2"] = Features["cnmips"] = true; else @@ -7558,7 +7558,7 @@ TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags, // Compute the default target features, we need the target to handle this // because features may have dependencies on one another. llvm::StringMap Features; - Target->getDefaultFeatures(Features); + Target->initDefaultFeatures(Features); // Apply the user specified deltas. for (const auto &F : Opts->FeaturesAsWritten) { -- 2.50.1