Skip to content

Commit ae23434

Browse files
committed
convert more to static
1 parent 63780c2 commit ae23434

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3408,7 +3408,7 @@ void SIInstrInfo::insertSelect(MachineBasicBlock &MBB,
34083408
}
34093409
}
34103410

3411-
bool SIInstrInfo::isFoldableCopy(const MachineInstr &MI) const {
3411+
bool SIInstrInfo::isFoldableCopy(const MachineInstr &MI) {
34123412
switch (MI.getOpcode()) {
34133413
case AMDGPU::V_MOV_B16_t16_e32:
34143414
case AMDGPU::V_MOV_B32_e32:
@@ -3951,13 +3951,12 @@ bool SIInstrInfo::areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
39513951
return false;
39523952
}
39533953

3954-
bool SIInstrInfo::getFoldableImm(Register Reg, const MachineRegisterInfo &MRI,
3955-
int64_t &Imm,
3956-
MachineInstr **DefMI = nullptr) const {
3954+
static bool getFoldableImm(Register Reg, const MachineRegisterInfo &MRI,
3955+
int64_t &Imm, MachineInstr **DefMI = nullptr) {
39573956
if (Reg.isPhysical())
39583957
return false;
39593958
auto *Def = MRI.getUniqueVRegDef(Reg);
3960-
if (Def && isFoldableCopy(*Def) && Def->getOperand(1).isImm()) {
3959+
if (Def && SIInstrInfo::isFoldableCopy(*Def) && Def->getOperand(1).isImm()) {
39613960
Imm = Def->getOperand(1).getImm();
39623961
if (DefMI)
39633962
*DefMI = Def;
@@ -3966,8 +3965,8 @@ bool SIInstrInfo::getFoldableImm(Register Reg, const MachineRegisterInfo &MRI,
39663965
return false;
39673966
}
39683967

3969-
bool SIInstrInfo::getFoldableImm(const MachineOperand *MO, int64_t &Imm,
3970-
MachineInstr **DefMI = nullptr) const {
3968+
static bool getFoldableImm(const MachineOperand *MO, int64_t &Imm,
3969+
MachineInstr **DefMI = nullptr) {
39713970
if (!MO->isReg())
39723971
return false;
39733972
const MachineFunction *MF = MO->getParent()->getParent()->getParent();
@@ -4691,12 +4690,12 @@ bool SIInstrInfo::hasModifiers(unsigned Opcode) const {
46914690
}
46924691

46934692
bool SIInstrInfo::hasModifiersSet(const MachineInstr &MI,
4694-
AMDGPU::OpName OpName) const {
4693+
AMDGPU::OpName OpName) {
46954694
const MachineOperand *Mods = getNamedOperand(MI, OpName);
46964695
return Mods && Mods->getImm();
46974696
}
46984697

4699-
bool SIInstrInfo::hasAnyModifiersSet(const MachineInstr &MI) const {
4698+
bool SIInstrInfo::hasAnyModifiersSet(const MachineInstr &MI) {
47004699
return any_of(ModifierOpNames,
47014700
[&](AMDGPU::OpName Name) { return hasModifiersSet(MI, Name); });
47024701
}
@@ -9338,7 +9337,7 @@ Register SIInstrInfo::findUsedSGPR(const MachineInstr &MI,
93389337
}
93399338

93409339
MachineOperand *SIInstrInfo::getNamedOperand(MachineInstr &MI,
9341-
AMDGPU::OpName OperandName) const {
9340+
AMDGPU::OpName OperandName) {
93429341
if (OperandName == AMDGPU::OpName::NUM_OPERAND_NAMES)
93439342
return nullptr;
93449343

@@ -10619,11 +10618,10 @@ bool SIInstrInfo::optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
1061910618
return false;
1062010619

1062110620
int64_t Mask;
10622-
const auto isMask = [&Mask, SrcSize,
10623-
this](const MachineOperand *MO) -> bool {
10621+
const auto isMask = [&Mask, SrcSize](const MachineOperand *MO) -> bool {
1062410622
if (MO->isImm())
1062510623
Mask = MO->getImm();
10626-
else if (!this->getFoldableImm(MO, Mask))
10624+
else if (!getFoldableImm(MO, Mask))
1062710625
return false;
1062810626
Mask &= maxUIntN(SrcSize);
1062910627
return isPowerOf2_64(Mask);

llvm/lib/Target/AMDGPU/SIInstrInfo.h

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,8 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
416416
areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
417417
const MachineInstr &MIb) const override;
418418

419-
bool isFoldableCopy(const MachineInstr &MI) const;
420-
421-
bool getFoldableImm(Register Reg, const MachineRegisterInfo &MRI,
422-
int64_t &Imm, MachineInstr **DefMI) const;
423-
bool getFoldableImm(const MachineOperand *MO, int64_t &Imm,
424-
MachineInstr **DefMI) const;
419+
static bool isFoldableCopy(const MachineInstr &MI);
420+
static unsigned getFoldableCopySrcIdx(const MachineInstr &MI);
425421

426422
void removeModOperands(MachineInstr &MI) const;
427423

@@ -1258,8 +1254,8 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
12581254
/// e.g. src[012]_mod, omod, clamp.
12591255
bool hasModifiers(unsigned Opcode) const;
12601256

1261-
bool hasModifiersSet(const MachineInstr &MI, AMDGPU::OpName OpName) const;
1262-
bool hasAnyModifiersSet(const MachineInstr &MI) const;
1257+
static bool hasModifiersSet(const MachineInstr &MI, AMDGPU::OpName OpName);
1258+
static bool hasAnyModifiersSet(const MachineInstr &MI);
12631259

12641260
bool canShrink(const MachineInstr &MI,
12651261
const MachineRegisterInfo &MRI) const;
@@ -1435,12 +1431,12 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
14351431
/// Returns the operand named \p Op. If \p MI does not have an
14361432
/// operand named \c Op, this function returns nullptr.
14371433
LLVM_READONLY
1438-
MachineOperand *getNamedOperand(MachineInstr &MI,
1439-
AMDGPU::OpName OperandName) const;
1434+
static MachineOperand *getNamedOperand(MachineInstr &MI,
1435+
AMDGPU::OpName OperandName);
14401436

14411437
LLVM_READONLY
1442-
const MachineOperand *getNamedOperand(const MachineInstr &MI,
1443-
AMDGPU::OpName OperandName) const {
1438+
static const MachineOperand *getNamedOperand(const MachineInstr &MI,
1439+
AMDGPU::OpName OperandName) {
14441440
return getNamedOperand(const_cast<MachineInstr &>(MI), OperandName);
14451441
}
14461442

0 commit comments

Comments
 (0)