diff options
-rw-r--r-- | clang/include/clang/Basic/TargetInfo.h | 5 | ||||
-rw-r--r-- | clang/lib/Basic/TargetInfo.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 6 |
4 files changed, 13 insertions, 10 deletions
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index 46db8954891..39c5e2ec406 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -823,8 +823,9 @@ public: /// \brief Set forced language options. /// /// Apply changes to the target information with respect to certain - /// language options which change the target configuration. - virtual void adjust(const LangOptions &Opts); + /// language options which change the target configuration and adjust + /// the language based on the target options where applicable. + virtual void adjust(LangOptions &Opts); /// \brief Adjust target options based on codegen options. virtual void adjustTargetOptions(const CodeGenOptions &CGOpts, diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp index b1b01e5f584..e19404dc54c 100644 --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -282,8 +282,9 @@ bool TargetInfo::isTypeSigned(IntType T) { /// adjust - Set forced language options. /// Apply changes to the target information with respect to certain -/// language options which change the target configuration. -void TargetInfo::adjust(const LangOptions &Opts) { +/// language options which change the target configuration and adjust +/// the language based on the target options where applicable. +void TargetInfo::adjust(LangOptions &Opts) { if (Opts.NoBitFieldTypeAlign) UseBitFieldTypeAlignment = false; if (Opts.ShortWChar) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 472a57b197e..22105184586 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -933,6 +933,13 @@ public: ArchDefineA2q = 1 << 15 } ArchDefineTypes; + // Set the language option for altivec based on our value. + void adjust(LangOptions &Opts) override { + if (HasAltivec) + Opts.AltiVec = 1; + TargetInfo::adjust(Opts); + } + // Note: GCC recognizes the following additional cpus: // 401, 403, 405, 405fp, 440fp, 464, 464fp, 476, 476fp, 505, 740, 801, // 821, 823, 8540, 8548, e300c2, e300c3, e500mc64, e6500, 860, cell, diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index e4a1be61fc9..f660429e49d 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -916,12 +916,6 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) { if (!hasTarget()) return false; - // FIXME: Setting this here is less than ideal, but it is set based on a - // target option for compatibility and this is immediately after we construct - // a target. - if (getTarget().hasFeature("altivec")) - getLangOpts().AltiVec = 1; - // Create TargetInfo for the other side of CUDA compilation. if (getLangOpts().CUDA && !getFrontendOpts().AuxTriple.empty()) { auto TO = std::make_shared<TargetOptions>(); |