diff options
author | Stefan Maksimovic <stefan.maksimovic@mips.com> | 2018-08-22 09:26:25 +0000 |
---|---|---|
committer | Stefan Maksimovic <stefan.maksimovic@mips.com> | 2018-08-22 09:26:25 +0000 |
commit | eb63256095dd57f2d8caaaed07d0190dfb27be8c (patch) | |
tree | 6f43bef009d28dc1d95100b3b66fa77f25217817 /clang/lib/Basic/Targets/Mips.h | |
parent | b092da8c95885cf86edcc1bc7679c5f8fd353e8b (diff) | |
download | bcm5719-llvm-eb63256095dd57f2d8caaaed07d0190dfb27be8c.tar.gz bcm5719-llvm-eb63256095dd57f2d8caaaed07d0190dfb27be8c.zip |
[clang][mips] Set __mips_fpr correctly for -mfpxx
Set __mips_fpr to 0 if o32 ABI is used with either -mfpxx
or none of -mfp32, -mfpxx, -mfp64 being specified.
Introduce additional checks:
-mfpxx is only to be used in conjunction with the o32 ABI.
report an error when incompatible options are provided.
Formerly no errors were raised when combining n32/n64 ABIs
with -mfp32 and -mfpxx.
There are other cases when __mips_fpr should be set to 0
that are not covered, ex. using o32 on a mips64 cpu
which is valid but not supported in the backend as of yet.
Differential Revision: https://reviews.llvm.org/D50557
llvm-svn: 340391
Diffstat (limited to 'clang/lib/Basic/Targets/Mips.h')
-rw-r--r-- | clang/lib/Basic/Targets/Mips.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Basic/Targets/Mips.h b/clang/lib/Basic/Targets/Mips.h index 11e9ac91443..fd1db5aa23d 100644 --- a/clang/lib/Basic/Targets/Mips.h +++ b/clang/lib/Basic/Targets/Mips.h @@ -57,7 +57,7 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo { bool UseIndirectJumpHazard; protected: - bool HasFP64; + enum FPModeEnum { FPXX, FP32, FP64 } FPMode; std::string ABI; public: @@ -66,7 +66,7 @@ public: IsNan2008(false), IsAbs2008(false), IsSingleFloat(false), IsNoABICalls(false), CanUseBSDABICalls(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false), DisableMadd4(false), - UseIndirectJumpHazard(false), HasFP64(false) { + UseIndirectJumpHazard(false), FPMode(FPXX) { TheCXXABI.set(TargetCXXABI::GenericMIPS); setABI(getTriple().isMIPS32() ? "o32" : "n64"); @@ -181,6 +181,8 @@ public: return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); } + unsigned getISARev() const; + void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override; @@ -305,7 +307,7 @@ public: IsSingleFloat = false; FloatABI = HardFloat; DspRev = NoDSP; - HasFP64 = isFP64Default(); + FPMode = isFP64Default() ? FP64 : FPXX; for (const auto &Feature : Features) { if (Feature == "+single-float") @@ -325,9 +327,11 @@ public: else if (Feature == "+nomadd4") DisableMadd4 = true; else if (Feature == "+fp64") - HasFP64 = true; + FPMode = FP64; else if (Feature == "-fp64") - HasFP64 = false; + FPMode = FP32; + else if (Feature == "+fpxx") + FPMode = FPXX; else if (Feature == "+nan2008") IsNan2008 = true; else if (Feature == "-nan2008") |