Skip to content

Commit 885d514

Browse files
committed
[BPF] Rename isST*() and isLD*() functions in BPFMISimplifyPatchable.cpp (NFC)
We are planning to add load (specifically, atomic acquiring load, or "load-acquire") instructions under the STX instruction class. To make that easier, rename the isST*() and isLD*() helper functions based on what the instructions actually do, rather than their instruction class.
1 parent 19131c7 commit 885d514

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,35 +94,35 @@ void BPFMISimplifyPatchable::initialize(MachineFunction &MFParm) {
9494
LLVM_DEBUG(dbgs() << "*** BPF simplify patchable insts pass ***\n\n");
9595
}
9696

97-
static bool isST(unsigned Opcode) {
97+
static bool isStoreImm(unsigned Opcode) {
9898
return Opcode == BPF::STB_imm || Opcode == BPF::STH_imm ||
9999
Opcode == BPF::STW_imm || Opcode == BPF::STD_imm;
100100
}
101101

102-
static bool isSTX32(unsigned Opcode) {
102+
static bool isStore32(unsigned Opcode) {
103103
return Opcode == BPF::STB32 || Opcode == BPF::STH32 || Opcode == BPF::STW32;
104104
}
105105

106-
static bool isSTX64(unsigned Opcode) {
106+
static bool isStore64(unsigned Opcode) {
107107
return Opcode == BPF::STB || Opcode == BPF::STH || Opcode == BPF::STW ||
108108
Opcode == BPF::STD;
109109
}
110110

111-
static bool isLDX32(unsigned Opcode) {
111+
static bool isLoad32(unsigned Opcode) {
112112
return Opcode == BPF::LDB32 || Opcode == BPF::LDH32 || Opcode == BPF::LDW32;
113113
}
114114

115-
static bool isLDX64(unsigned Opcode) {
115+
static bool isLoad64(unsigned Opcode) {
116116
return Opcode == BPF::LDB || Opcode == BPF::LDH || Opcode == BPF::LDW ||
117117
Opcode == BPF::LDD;
118118
}
119119

120-
static bool isLDSX(unsigned Opcode) {
120+
static bool isLoadSext(unsigned Opcode) {
121121
return Opcode == BPF::LDBSX || Opcode == BPF::LDHSX || Opcode == BPF::LDWSX;
122122
}
123123

124124
bool BPFMISimplifyPatchable::isLoadInst(unsigned Opcode) {
125-
return isLDX32(Opcode) || isLDX64(Opcode) || isLDSX(Opcode);
125+
return isLoad32(Opcode) || isLoad64(Opcode) || isLoadSext(Opcode);
126126
}
127127

128128
void BPFMISimplifyPatchable::checkADDrr(MachineRegisterInfo *MRI,
@@ -143,11 +143,11 @@ void BPFMISimplifyPatchable::checkADDrr(MachineRegisterInfo *MRI,
143143
MachineInstr *DefInst = MO.getParent();
144144
unsigned Opcode = DefInst->getOpcode();
145145
unsigned COREOp;
146-
if (isLDX64(Opcode) || isLDSX(Opcode))
146+
if (isLoad64(Opcode) || isLoadSext(Opcode))
147147
COREOp = BPF::CORE_LD64;
148-
else if (isLDX32(Opcode))
148+
else if (isLoad32(Opcode))
149149
COREOp = BPF::CORE_LD32;
150-
else if (isSTX64(Opcode) || isSTX32(Opcode) || isST(Opcode))
150+
else if (isStore64(Opcode) || isStore32(Opcode) || isStoreImm(Opcode))
151151
COREOp = BPF::CORE_ST;
152152
else
153153
continue;
@@ -160,7 +160,7 @@ void BPFMISimplifyPatchable::checkADDrr(MachineRegisterInfo *MRI,
160160
// Reject the form:
161161
// %1 = ADD_rr %2, %3
162162
// *(type *)(%2 + 0) = %1
163-
if (isSTX64(Opcode) || isSTX32(Opcode)) {
163+
if (isStore64(Opcode) || isStore32(Opcode)) {
164164
const MachineOperand &Opnd = DefInst->getOperand(0);
165165
if (Opnd.isReg() && Opnd.getReg() == MO.getReg())
166166
continue;

0 commit comments

Comments
 (0)