Skip to content

Commit d776b59

Browse files
committed
Move enum RISCVCPKind into the class that uses it.
1 parent 522da43 commit d776b59

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

llvm/lib/Target/RISCV/RISCVConstantPoolValue.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
using namespace llvm;
2323

2424
RISCVConstantPoolValue::RISCVConstantPoolValue(LLVMContext &C,
25-
RISCVCP::RISCVCPKind Kind)
25+
RISCVCPKind Kind)
2626
: MachineConstantPoolValue((Type *)Type::getInt64Ty(C)), Kind(Kind) {}
2727

2828
RISCVConstantPoolValue::RISCVConstantPoolValue(Type *Ty,
29-
RISCVCP::RISCVCPKind Kind)
29+
RISCVCPKind Kind)
3030
: MachineConstantPoolValue(Ty), Kind(Kind) {}
3131

3232
int RISCVConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP,
@@ -36,18 +36,18 @@ int RISCVConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP,
3636

3737
RISCVConstantPoolConstant::RISCVConstantPoolConstant(Type *Ty,
3838
const Constant *GV,
39-
RISCVCP::RISCVCPKind Kind)
39+
RISCVCPKind Kind)
4040
: RISCVConstantPoolValue(Ty, Kind), CVal(GV) {}
4141

4242
RISCVConstantPoolConstant *
4343
RISCVConstantPoolConstant::Create(const GlobalValue *GV) {
44-
return new RISCVConstantPoolConstant(GV->getType(), GV, RISCVCP::GlobalValue);
44+
return new RISCVConstantPoolConstant(GV->getType(), GV, RISCVCPKind::GlobalValue);
4545
}
4646

4747
RISCVConstantPoolConstant *
4848
RISCVConstantPoolConstant::Create(const BlockAddress *BA) {
4949
return new RISCVConstantPoolConstant(BA->getType(), BA,
50-
RISCVCP::BlockAddress);
50+
RISCVCPKind::BlockAddress);
5151
}
5252

5353
int RISCVConstantPoolConstant::getExistingMachineCPValue(
@@ -73,7 +73,7 @@ const BlockAddress *RISCVConstantPoolConstant::getBlockAddress() const {
7373
}
7474

7575
RISCVConstantPoolSymbol::RISCVConstantPoolSymbol(LLVMContext &C, StringRef s)
76-
: RISCVConstantPoolValue(C, RISCVCP::ExtSymbol), S(s) {}
76+
: RISCVConstantPoolValue(C, RISCVCPKind::ExtSymbol), S(s) {}
7777

7878
RISCVConstantPoolSymbol *RISCVConstantPoolSymbol::Create(LLVMContext &C,
7979
StringRef s) {

llvm/lib/Target/RISCV/RISCVConstantPoolValue.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,14 @@ class BlockAddress;
2424
class GlobalValue;
2525
class LLVMContext;
2626

27-
namespace RISCVCP {
28-
29-
enum RISCVCPKind { ExtSymbol, GlobalValue, BlockAddress };
30-
} // end namespace RISCVCP
31-
3227
/// A RISCV-specific constant pool value.
3328
class RISCVConstantPoolValue : public MachineConstantPoolValue {
34-
RISCVCP::RISCVCPKind Kind;
35-
3629
protected:
37-
RISCVConstantPoolValue(LLVMContext &C, RISCVCP::RISCVCPKind Kind);
30+
enum class RISCVCPKind { ExtSymbol, GlobalValue, BlockAddress };
3831

39-
RISCVConstantPoolValue(Type *Ty, RISCVCP::RISCVCPKind Kind);
32+
RISCVConstantPoolValue(LLVMContext &C, RISCVCPKind Kind);
33+
34+
RISCVConstantPoolValue(Type *Ty, RISCVCPKind Kind);
4035

4136
template <typename Derived>
4237
int getExistingMachineCPValueImpl(MachineConstantPool *CP, Align Alignment) {
@@ -55,12 +50,15 @@ class RISCVConstantPoolValue : public MachineConstantPoolValue {
5550
return -1;
5651
}
5752

53+
private:
54+
RISCVCPKind Kind;
55+
5856
public:
5957
~RISCVConstantPoolValue() = default;
6058

61-
bool isExtSymbol() const { return Kind == RISCVCP::ExtSymbol; }
62-
bool isGlobalValue() const { return Kind == RISCVCP::GlobalValue; }
63-
bool isBlockAddress() const { return Kind == RISCVCP::BlockAddress; }
59+
bool isExtSymbol() const { return Kind == RISCVCPKind::ExtSymbol; }
60+
bool isGlobalValue() const { return Kind == RISCVCPKind::GlobalValue; }
61+
bool isBlockAddress() const { return Kind == RISCVCPKind::BlockAddress; }
6462

6563
int getExistingMachineCPValue(MachineConstantPool *CP,
6664
Align Alignment) override;
@@ -72,7 +70,7 @@ class RISCVConstantPoolConstant : public RISCVConstantPoolValue {
7270
const Constant *CVal;
7371

7472
RISCVConstantPoolConstant(Type *Ty, const Constant *GV,
75-
RISCVCP::RISCVCPKind Kind);
73+
RISCVCPKind Kind);
7674

7775
public:
7876
static RISCVConstantPoolConstant *Create(const GlobalValue *GV);

0 commit comments

Comments
 (0)