Skip to content

Commit 1572068

Browse files
committed
Move CPUInfo to header and add CPUModel struct
1 parent 721a622 commit 1572068

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

llvm/include/llvm/TargetParser/RISCVTargetParser.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ struct RISCVExtensionBitmask {
3232
};
3333
} // namespace RISCVExtensionBitmaskTable
3434

35+
struct CPUModel {
36+
uint32_t MVendorID;
37+
uint64_t MArchID;
38+
uint64_t MImpID;
39+
};
40+
41+
struct CPUInfo {
42+
StringLiteral Name;
43+
StringLiteral DefaultMarch;
44+
bool FastScalarUnalignedAccess;
45+
bool FastVectorUnalignedAccess;
46+
CPUModel CPUModel;
47+
bool is64Bit() const { return DefaultMarch.starts_with("rv64"); }
48+
};
49+
3550
// We use 64 bits as the known part in the scalable vector types.
3651
static constexpr unsigned RVVBitsPerBlock = 64;
3752

llvm/lib/TargetParser/RISCVTargetParser.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@ enum CPUKind : unsigned {
2727
#include "llvm/TargetParser/RISCVTargetParserDef.inc"
2828
};
2929

30-
struct CPUInfo {
31-
StringLiteral Name;
32-
StringLiteral DefaultMarch;
33-
bool FastScalarUnalignedAccess;
34-
bool FastVectorUnalignedAccess;
35-
uint32_t MVendorID;
36-
uint64_t MArchID;
37-
uint64_t MImpID;
38-
bool is64Bit() const { return DefaultMarch.starts_with("rv64"); }
39-
};
40-
4130
constexpr CPUInfo RISCVCPUInfo[] = {
4231
#define PROC(ENUM, NAME, DEFAULT_MARCH, FAST_SCALAR_UNALIGN, \
4332
FAST_VECTOR_UNALIGN, MVENDORID, MARCHID, MIMPID) \
@@ -46,9 +35,7 @@ constexpr CPUInfo RISCVCPUInfo[] = {
4635
DEFAULT_MARCH, \
4736
FAST_SCALAR_UNALIGN, \
4837
FAST_VECTOR_UNALIGN, \
49-
MVENDORID, \
50-
MARCHID, \
51-
MIMPID, \
38+
{MVENDORID, MARCHID, MIMPID}, \
5239
},
5340
#include "llvm/TargetParser/RISCVTargetParserDef.inc"
5441
};

0 commit comments

Comments
 (0)