diff options
| author | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
| commit | 95fbfc9be5d2842a945c04a20fe6244df9b10e18 (patch) | |
| tree | 00f80558d11aa5805e6d6f290663c6da44e5e6ef /llvm/lib/TargetParser/PPCTargetParser.cpp | |
| parent | a9ba028b98ffd53d9c7d00ca7563d74810fcf6e7 (diff) | |
| parent | 17e8465a3eb0cae48b9f62d27fd26f2b070f1f9b (diff) | |
[𝘀𝗽𝗿] changes introduced through rebaseusers/MaskRay/spr/main.move-relocation-specifier-constants-to-aarch64
Created using spr 1.3.5-bogner
[skip ci]
Diffstat (limited to 'llvm/lib/TargetParser/PPCTargetParser.cpp')
| -rw-r--r-- | llvm/lib/TargetParser/PPCTargetParser.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/TargetParser/PPCTargetParser.cpp b/llvm/lib/TargetParser/PPCTargetParser.cpp index 422d758c772e..d51044529a49 100644 --- a/llvm/lib/TargetParser/PPCTargetParser.cpp +++ b/llvm/lib/TargetParser/PPCTargetParser.cpp @@ -15,6 +15,10 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/TargetParser/Host.h" +#define GET_SUBTARGETFEATURES_ENUM +#define GET_SUBTARGETFEATURES_KV +#include "llvm/TargetParser/PPCGenTargetFeatures.inc" + namespace llvm { namespace PPC { @@ -117,5 +121,26 @@ StringRef getNormalizedPPCTuneCPU(const Triple &T, StringRef CPUName) { return getNormalizedPPCTargetCPU(T, CPUName); } +std::optional<StringMap<bool>> getPPCDefaultTargetFeatures(const Triple &T, + StringRef CPU) { + std::optional<StringMap<bool>> FeaturesOpt = + getCPUDefaultTargetFeatures(CPU, BasicPPCSubTypeKV, BasicPPCFeatureKV); + + if (!FeaturesOpt.has_value()) + return std::nullopt; + + StringMap<bool> Features = FeaturesOpt.value(); + // FIXME: We need to check for the processor model 8548, since the backend + // does not support this processor. When this processor model is implemented + // within the backend, the following code can be removed. + if (CPU == "8548") + Features["spe"] = true; + + // The target feature `quadword-atomics` is only supported for 64-bit + // POWER8 and above. + if (Features.find("quadword-atomics") != Features.end() && !T.isArch64Bit()) + Features["quadword-atomics"] = false; + return Features; +} } // namespace PPC } // namespace llvm |
