//===-- TargetParser - Parser for target features ---------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements a target parser to recognise hardware features such as // FPU/CPU/ARCH names as well as specific support such as HDIV, etc. // //===----------------------------------------------------------------------===// #ifndef LLVM_TARGETPARSER_TARGETPARSER_H #define LLVM_TARGETPARSER_TARGETPARSER_H #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" namespace llvm { template <typename T> class SmallVectorImpl; class Triple; // Target specific information in their own namespaces. // (ARM/AArch64/X86 are declared in ARM/AArch64/X86TargetParser.h) // These should be generated from TableGen because the information is already // there, and there is where new information about targets will be added. // FIXME: To TableGen this we need to make some table generated files available // even if the back-end is not compiled with LLVM, plus we need to create a new // back-end to TableGen to create these clean tables. namespace AMDGPU { /// GPU kinds supported by the AMDGPU target. enum GPUKind : uint32_t { … }; /// Instruction set architecture version. struct IsaVersion { … }; // This isn't comprehensive for now, just things that are needed from the // frontend driver. enum ArchFeatureKind : uint32_t { … }; enum FeatureError : uint32_t { … }; StringRef getArchFamilyNameAMDGCN(GPUKind AK); StringRef getArchNameAMDGCN(GPUKind AK); StringRef getArchNameR600(GPUKind AK); StringRef getCanonicalArchName(const Triple &T, StringRef Arch); GPUKind parseArchAMDGCN(StringRef CPU); GPUKind parseArchR600(StringRef CPU); unsigned getArchAttrAMDGCN(GPUKind AK); unsigned getArchAttrR600(GPUKind AK); void fillValidArchListAMDGCN(SmallVectorImpl<StringRef> &Values); void fillValidArchListR600(SmallVectorImpl<StringRef> &Values); IsaVersion getIsaVersion(StringRef GPU); /// Fills Features map with default values for given target GPU void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T, StringMap<bool> &Features); /// Inserts wave size feature for given GPU into features map std::pair<FeatureError, StringRef> insertWaveSizeFeature(StringRef GPU, const Triple &T, StringMap<bool> &Features); } // namespace AMDGPU } // namespace llvm #endif