RISCVTargetParser.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- RISCVTargetParser - Parser for target features ----------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file implements a target parser to recognise hardware features
  15. // FOR RISC-V CPUS.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_TARGETPARSER_RISCVTARGETPARSER_H
  19. #define LLVM_TARGETPARSER_RISCVTARGETPARSER_H
  20. #include "llvm/ADT/StringRef.h"
  21. #include <vector>
  22. namespace llvm {
  23. class Triple;
  24. namespace RISCV {
  25. // We use 64 bits as the known part in the scalable vector types.
  26. static constexpr unsigned RVVBitsPerBlock = 64;
  27. enum CPUKind : unsigned {
  28. #define PROC(ENUM, NAME, DEFAULT_MARCH) CK_##ENUM,
  29. #define TUNE_PROC(ENUM, NAME) CK_##ENUM,
  30. #include "llvm/TargetParser/RISCVTargetParserDef.inc"
  31. };
  32. bool checkCPUKind(CPUKind Kind, bool IsRV64);
  33. bool checkTuneCPUKind(CPUKind Kind, bool IsRV64);
  34. CPUKind parseCPUKind(StringRef CPU);
  35. CPUKind parseTuneCPUKind(StringRef CPU, bool IsRV64);
  36. StringRef getMArchFromMcpu(StringRef CPU);
  37. void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
  38. void fillValidTuneCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
  39. bool getCPUFeaturesExceptStdExt(CPUKind Kind, std::vector<StringRef> &Features);
  40. bool isX18ReservedByDefault(const Triple &TT);
  41. } // namespace RISCV
  42. } // namespace llvm
  43. #endif
  44. #ifdef __GNUC__
  45. #pragma GCC diagnostic pop
  46. #endif