Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 1
//==-- LoongArch64TargetParser - Parser for LoongArch64 features --*- C++ -*-=//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file implements a target parser to recognise LoongArch hardware features
10
// such as CPU/ARCH and extension names.
11
//
12
//===----------------------------------------------------------------------===//
13
 
14
#ifndef LLVM_TARGETPARSER_LOONGARCHTARGETPARSER_H
15
#define LLVM_TARGETPARSER_LOONGARCHTARGETPARSER_H
16
 
17
#include "llvm/TargetParser/Triple.h"
18
#include <vector>
19
 
20
namespace llvm {
21
class StringRef;
22
 
23
namespace LoongArch {
24
 
25
enum FeatureKind : uint32_t {
26
  FK_INVALID = 0,
27
  FK_NONE = 1,
28
 
29
  // 64-bit ISA is available.
30
  FK_64BIT = 1 << 1,
31
 
32
  // Single-precision floating-point instructions are available.
33
  FK_FP32 = 1 << 2,
34
 
35
  // Double-precision floating-point instructions are available.
36
  FK_FP64 = 1 << 3,
37
 
38
  // Loongson SIMD Extension is available.
39
  FK_LSX = 1 << 4,
40
 
41
  // Loongson Advanced SIMD Extension is available.
42
  FK_LASX = 1 << 5,
43
 
44
  // Loongson Binary Translation Extension is available.
45
  FK_LBT = 1 << 6,
46
 
47
  // Loongson Virtualization Extension is available.
48
  FK_LVZ = 1 << 7,
49
};
50
 
51
struct FeatureInfo {
52
  StringRef Name;
53
  FeatureKind Kind;
54
};
55
 
56
enum class ArchKind {
57
#define LOONGARCH_ARCH(NAME, KIND, FEATURES) KIND,
58
#include "LoongArchTargetParser.def"
59
};
60
 
61
struct ArchInfo {
62
  StringRef Name;
63
  ArchKind Kind;
64
  uint32_t Features;
65
};
66
 
67
ArchKind parseArch(StringRef Arch);
68
bool getArchFeatures(StringRef Arch, std::vector<StringRef> &Features);
69
 
70
} // namespace LoongArch
71
 
72
} // namespace llvm
73
 
74
#endif // LLVM_SUPPORT_LOONGARCHTARGETPARSER_H