diff options
| author | Strahinja Petrovic <strahinja.petrovic@rt-rk.com> | 2019-04-02 11:00:09 +0000 |
|---|---|---|
| committer | Strahinja Petrovic <strahinja.petrovic@rt-rk.com> | 2019-04-02 11:00:09 +0000 |
| commit | 4f839ac1883afd6009f0062ccbcf85b799fd036b (patch) | |
| tree | fde25afe8a15da611afb5faf7b87db049a6c6400 /clang/lib | |
| parent | 64bd87ad4bbdd6ef5199bd0baf7ae5e9988370ea (diff) | |
| download | bcm5719-llvm-4f839ac1883afd6009f0062ccbcf85b799fd036b.tar.gz bcm5719-llvm-4f839ac1883afd6009f0062ccbcf85b799fd036b.zip | |
[PowerPC] Fix issue with inline asm - soft float mode
This patch prevents floating point register
constraints in soft float mode.
Differential Revision: https://reviews.llvm.org/D59310
llvm-svn: 357466
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Basic/Targets/PPC.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Basic/Targets/PPC.h | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index 14a9ffd09a6..b052ef433ec 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -30,6 +30,7 @@ const Builtin::Info PPCTargetInfo::BuiltinInfo[] = { /// configured set of features. bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features, DiagnosticsEngine &Diags) { + FloatABI = HardFloat; for (const auto &Feature : Features) { if (Feature == "+altivec") { HasAltivec = true; @@ -53,6 +54,8 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features, HasFloat128 = true; } else if (Feature == "+power9-vector") { HasP9Vector = true; + } else if (Feature == "-hard-float") { + FloatABI = SoftFloat; } // TODO: Finish this list and add an assert that we've handled them // all. diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h index ace7eb35e76..7049020a911 100644 --- a/clang/lib/Basic/Targets/PPC.h +++ b/clang/lib/Basic/Targets/PPC.h @@ -53,6 +53,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { static const char *const GCCRegNames[]; static const TargetInfo::GCCRegAlias GCCRegAliases[]; std::string CPU; + enum PPCFloatABI { HardFloat, SoftFloat } FloatABI; // Target cpu features. bool HasAltivec = false; @@ -183,8 +184,11 @@ public: return false; case 'O': // Zero break; - case 'b': // Base register case 'f': // Floating point register + // Don't use floating point registers on soft float ABI. + if (FloatABI == SoftFloat) + return false; + case 'b': // Base register Info.setAllowsRegister(); break; // FIXME: The following are added to allow parsing. @@ -192,6 +196,10 @@ public: // Also, is more specific checking needed? I.e. specific registers? case 'd': // Floating point register (containing 64-bit value) case 'v': // Altivec vector register + // Don't use floating point and altivec vector registers + // on soft float ABI + if (FloatABI == SoftFloat) + return false; Info.setAllowsRegister(); break; case 'w': |

