summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/include/llvm/Support/TargetParser.h
blob: ca626f271d519505479aee8ed5a9e225756ef1d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//===-- TargetParser - Parser for target features ---------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// 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_SUPPORT_TARGETPARSER_H
#define LLVM_SUPPORT_TARGETPARSER_H

namespace llvm {
  class StringRef;

// Target specific information into their own namespaces. 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 ARM {
  // FPU names.
  enum FPUKind {
    FK_INVALID = 0,
    FK_VFP,
    FK_VFPV2,
    FK_VFPV3,
    FK_VFPV3_D16,
    FK_VFPV4,
    FK_VFPV4_D16,
    FK_FPV5_D16,
    FK_FP_ARMV8,
    FK_NEON,
    FK_NEON_VFPV4,
    FK_NEON_FP_ARMV8,
    FK_CRYPTO_NEON_FP_ARMV8,
    FK_SOFTVFP,
    FK_LAST
  };

  // Arch names.
  enum ArchKind {
    AK_INVALID = 0,
    AK_ARMV2,
    AK_ARMV2A,
    AK_ARMV3,
    AK_ARMV3M,
    AK_ARMV4,
    AK_ARMV4T,
    AK_ARMV5,
    AK_ARMV5T,
    AK_ARMV5TE,
    AK_ARMV6,
    AK_ARMV6J,
    AK_ARMV6K,
    AK_ARMV6T2,
    AK_ARMV6Z,
    AK_ARMV6ZK,
    AK_ARMV6M,
    AK_ARMV7,
    AK_ARMV7A,
    AK_ARMV7R,
    AK_ARMV7M,
    AK_ARMV8A,
    AK_ARMV8_1A,
    // Non-standard Arch names.
    AK_IWMMXT,
    AK_IWMMXT2,
    AK_XSCALE,
    AK_ARMV5E,
    AK_ARMV5TEJ,
    AK_ARMV6SM,
    AK_ARMV6HL,
    AK_ARMV7L,
    AK_ARMV7HL,
    AK_ARMV7S,
    AK_ARMV7EM,
    AK_LAST
  };

  // Arch extension modifiers for CPUs.
  enum ArchExtKind {
    AEK_INVALID = 0,
    AEK_CRC,
    AEK_CRYPTO,
    AEK_FP,
    AEK_HWDIV,
    AEK_MP,
    AEK_SEC,
    AEK_VIRT,
    AEK_LAST
  };

  // ISA kinds.
  enum ISAKind {
    IK_INVALID = 0,
    IK_ARM,
    IK_THUMB,
    IK_AARCH64
  };

  // Endianness
  // FIXME: BE8 vs. BE32?
  enum EndianKind {
    EK_INVALID = 0,
    EK_LITTLE,
    EK_BIG
  };

  // v6/v7/v8 Profile
  enum ProfileKind {
    PK_INVALID = 0,
    PK_A,
    PK_R,
    PK_M
  };
} // namespace ARM

// Target Parsers, one per architecture.
class ARMTargetParser {
  static StringRef getFPUSynonym(StringRef FPU);
  static StringRef getArchSynonym(StringRef Arch);

public:
  static StringRef getCanonicalArchName(StringRef Arch);

  // Information by ID
  static const char * getFPUName(unsigned FPUKind);
  static const char * getArchName(unsigned ArchKind);
  static unsigned getArchDefaultCPUArch(unsigned ArchKind);
  static const char * getArchDefaultCPUName(unsigned ArchKind);
  static const char * getArchExtName(unsigned ArchExtKind);
  static const char * getDefaultCPU(StringRef Arch);

  // Parser
  static unsigned parseFPU(StringRef FPU);
  static unsigned parseArch(StringRef Arch);
  static unsigned parseArchExt(StringRef ArchExt);
  static unsigned parseCPUArch(StringRef CPU);
  static unsigned parseArchISA(StringRef Arch);
  static unsigned parseArchEndian(StringRef Arch);
  static unsigned parseArchProfile(StringRef Arch);
  static unsigned parseArchVersion(StringRef Arch);

};

} // namespace llvm

#endif
OpenPOWER on IntegriCloud