Coverage Report

Created: 2026-02-14 07:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/keystone/llvm/lib/Target/RISCV/RISCVGenSubtargetInfo.inc
Line
Count
Source
1
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2
|*                                                                            *|
3
|* Subtarget Enumeration Source Fragment                                      *|
4
|*                                                                            *|
5
|* Automatically generated file, do not edit!                                 *|
6
|*                                                                            *|
7
\*===----------------------------------------------------------------------===*/
8
9
10
#ifdef GET_SUBTARGETINFO_ENUM
11
#undef GET_SUBTARGETINFO_ENUM
12
13
namespace llvm_ks {
14
namespace RISCV {
15
enum : uint64_t {
16
  Feature64Bit = 0,
17
  FeatureRV32E = 1,
18
  FeatureRelax = 2,
19
  FeatureStdExtA = 3,
20
  FeatureStdExtC = 4,
21
  FeatureStdExtD = 5,
22
  FeatureStdExtF = 6,
23
  FeatureStdExtM = 7,
24
  NumSubtargetFeatures = 8
25
};
26
} // end namespace RISCV
27
} // end namespace llvm_ks
28
29
#endif // GET_SUBTARGETINFO_ENUM
30
31
32
#ifdef GET_SUBTARGETINFO_MC_DESC
33
#undef GET_SUBTARGETINFO_MC_DESC
34
35
namespace llvm_ks {
36
// Sorted (by key) array of values for CPU features.
37
extern const llvm_ks::SubtargetFeatureKV RISCVFeatureKV[] = {
38
  { "64bit", "Implements RV64", {RISCV::Feature64Bit}, { } },
39
  { "a", "'A' (Atomic Instructions)", {RISCV::FeatureStdExtA,}, { } },
40
  { "c", "'C' (Compressed Instructions)", {RISCV::FeatureStdExtC,}, { } },
41
  { "d", "'D' (Double-Precision Floating-Point)", {RISCV::FeatureStdExtD,}, {RISCV::FeatureStdExtF} },
42
  { "e", "Implements RV32E (provides 16 rather than 32 GPRs)", {RISCV::FeatureRV32E}, { } },
43
  { "f", "'F' (Single-Precision Floating-Point)", {RISCV::FeatureStdExtF,}, { } },
44
  { "m", "'M' (Integer Multiplication and Division)", {RISCV::FeatureStdExtM,}, { } },
45
  { "relax", "Enable Linker relaxation.", {RISCV::FeatureRelax,}, { } },
46
};
47
48
#ifdef DBGFIELD
49
#error "<target>GenSubtargetInfo.inc requires a DBGFIELD macro"
50
#endif
51
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
52
#define DBGFIELD(x) x,
53
#else
54
#define DBGFIELD(x)
55
#endif
56
57
// ===============================================================
58
// Data tables for the new per-operand machine model.
59
60
// {ProcResourceIdx, Cycles}
61
extern const llvm_ks::MCWriteProcResEntry RISCVWriteProcResTable[] = {
62
  { 0,  0}, // Invalid
63
}; // RISCVWriteProcResTable
64
65
// {Cycles, WriteResourceID}
66
extern const llvm_ks::MCWriteLatencyEntry RISCVWriteLatencyTable[] = {
67
  { 0,  0}, // Invalid
68
}; // RISCVWriteLatencyTable
69
70
// {UseIdx, WriteResourceID, Cycles}
71
extern const llvm_ks::MCReadAdvanceEntry RISCVReadAdvanceTable[] = {
72
  {0,  0,  0}, // Invalid
73
}; // RISCVReadAdvanceTable
74
75
#undef DBGFIELD
76
77
static const llvm_ks::MCSchedModel NoSchedModel = {
78
  MCSchedModel::DefaultIssueWidth,
79
  MCSchedModel::DefaultMicroOpBufferSize,
80
  MCSchedModel::DefaultLoopMicroOpBufferSize,
81
  MCSchedModel::DefaultLoadLatency,
82
  MCSchedModel::DefaultHighLatency,
83
  MCSchedModel::DefaultMispredictPenalty,
84
  false, // PostRAScheduler
85
  false, // CompleteModel
86
  0, // Processor ID
87
  nullptr, nullptr, 0, 0, // No instruction-level machine model.
88
  nullptr, // No Itinerary
89
};
90
91
// Sorted (by key) array of values for CPU subtype.
92
extern const llvm_ks::SubtargetFeatureKV RISCVSubTypeKV[] = { 
93
 { "generic-rv32", "select rv32 CPU", {RISCV::FeatureStdExtA,RISCV::FeatureStdExtC,RISCV::FeatureStdExtD,RISCV::FeatureStdExtF,RISCV::FeatureStdExtM,RISCV::FeatureRelax,}, {}},
94
 { "generic-rv64", "select rv64 CPU", {RISCV::Feature64Bit,RISCV::FeatureStdExtA,RISCV::FeatureStdExtC,RISCV::FeatureStdExtD,RISCV::FeatureStdExtF,RISCV::FeatureStdExtM,RISCV::FeatureRelax,}, {}},
95
};
96
97
// Sorted (by key) array of values for CPU subtype.
98
extern const llvm_ks::SubtargetInfoKV RISCVProcSchedKV[] = {
99
 { "generic-rv32",  (const void *)&NoSchedModel },
100
 { "generic-rv64",  (const void *)&NoSchedModel },
101
};
102
103
namespace RISCV_MC {
104
unsigned resolveVariantSchedClassImpl(unsigned SchedClass,
105
0
    const MCInst *MI, unsigned CPUID) {
106
  // Don't know how to resolve this scheduling class.
107
0
  return 0;
108
0
}
109
} // end of namespace RISCV_MC
110
111
112
25.8k
static inline MCSubtargetInfo *createRISCVMCSubtargetInfoImpl(const Triple &TT, StringRef CPU, StringRef FS) {
113
25.8k
  return new MCSubtargetInfo(TT, CPU, FS, RISCVFeatureKV, RISCVSubTypeKV,/*  
114
                      RISCVWriteProcResTable, RISCVWriteLatencyTable, RISCVReadAdvanceTable, 
115
25.8k
                      nullptr, nullptr, nullptr */RISCVProcSchedKV);
116
25.8k
}
117
118
} // end namespace llvm_ks
119
120
#endif // GET_SUBTARGETINFO_MC_DESC
121
122
123
#ifdef GET_SUBTARGETINFO_TARGET_DESC
124
#undef GET_SUBTARGETINFO_TARGET_DESC
125
126
#include "llvm/Support/Debug.h"
127
#include "llvm/Support/raw_ostream.h"
128
129
// ParseSubtargetFeatures - Parses features string setting specified
130
// subtarget options.
131
void llvm_ks::RISCVSubtarget::ParseSubtargetFeatures(StringRef CPU, StringRef FS) {
132
  LLVM_DEBUG(dbgs() << "\nFeatures:" << FS);
133
  LLVM_DEBUG(dbgs() << "\nCPU:" << CPU << "\n\n");
134
  InitMCProcessorInfo(CPU, FS);
135
  const FeatureBitset& Bits = getFeatureBits();
136
  if (Bits[RISCV::Feature64Bit]) HasRV64 = true;
137
  if (Bits[RISCV::FeatureRV32E]) IsRV32E = true;
138
  if (Bits[RISCV::FeatureRelax]) EnableLinkerRelax = true;
139
  if (Bits[RISCV::FeatureStdExtA]) HasStdExtA = true;
140
  if (Bits[RISCV::FeatureStdExtC]) HasStdExtC = true;
141
  if (Bits[RISCV::FeatureStdExtD]) HasStdExtD = true;
142
  if (Bits[RISCV::FeatureStdExtF]) HasStdExtF = true;
143
  if (Bits[RISCV::FeatureStdExtM]) HasStdExtM = true;
144
}
145
#endif // GET_SUBTARGETINFO_TARGET_DESC