Skip to content

Commit 4dcfb09

Browse files
committed
[NFC][CodeGen] Use const MF in TargetLowering stack probe functions
This makes them callable from places like canUseAsPrologue. Differential Revision: https://reviews.llvm.org/D134492
1 parent 0de7c15 commit 4dcfb09

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,11 +1904,11 @@ class TargetLoweringBase {
19041904

19051905
/// Returns the name of the symbol used to emit stack probes or the empty
19061906
/// string if not applicable.
1907-
virtual bool hasStackProbeSymbol(MachineFunction &MF) const { return false; }
1907+
virtual bool hasStackProbeSymbol(const MachineFunction &MF) const { return false; }
19081908

1909-
virtual bool hasInlineStackProbe(MachineFunction &MF) const { return false; }
1909+
virtual bool hasInlineStackProbe(const MachineFunction &MF) const { return false; }
19101910

1911-
virtual StringRef getStackProbeSymbolName(MachineFunction &MF) const {
1911+
virtual StringRef getStackProbeSymbolName(const MachineFunction &MF) const {
19121912
return "";
19131913
}
19141914

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11998,15 +11998,15 @@ PPCTargetLowering::emitEHSjLjLongJmp(MachineInstr &MI,
1199811998
return MBB;
1199911999
}
1200012000

12001-
bool PPCTargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
12001+
bool PPCTargetLowering::hasInlineStackProbe(const MachineFunction &MF) const {
1200212002
// If the function specifically requests inline stack probes, emit them.
1200312003
if (MF.getFunction().hasFnAttribute("probe-stack"))
1200412004
return MF.getFunction().getFnAttribute("probe-stack").getValueAsString() ==
1200512005
"inline-asm";
1200612006
return false;
1200712007
}
1200812008

12009-
unsigned PPCTargetLowering::getStackProbeSize(MachineFunction &MF) const {
12009+
unsigned PPCTargetLowering::getStackProbeSize(const MachineFunction &MF) const {
1201012010
const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
1201112011
unsigned StackAlign = TFI->getStackAlignment();
1201212012
assert(StackAlign >= 1 && isPowerOf2_32(StackAlign) &&

llvm/lib/Target/PowerPC/PPCISelLowering.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,9 +954,9 @@ namespace llvm {
954954
MachineBasicBlock *emitProbedAlloca(MachineInstr &MI,
955955
MachineBasicBlock *MBB) const;
956956

957-
bool hasInlineStackProbe(MachineFunction &MF) const override;
957+
bool hasInlineStackProbe(const MachineFunction &MF) const override;
958958

959-
unsigned getStackProbeSize(MachineFunction &MF) const;
959+
unsigned getStackProbeSize(const MachineFunction &MF) const;
960960

961961
ConstraintType getConstraintType(StringRef Constraint) const override;
962962

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ bool SystemZTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
842842
}
843843

844844
/// Returns true if stack probing through inline assembly is requested.
845-
bool SystemZTargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
845+
bool SystemZTargetLowering::hasInlineStackProbe(const MachineFunction &MF) const {
846846
// If the function specifically requests inline stack probes, emit them.
847847
if (MF.getFunction().hasFnAttribute("probe-stack"))
848848
return MF.getFunction().getFnAttribute("probe-stack").getValueAsString() ==
@@ -7439,7 +7439,7 @@ SystemZTargetLowering::ComputeNumSignBitsForTargetNode(
74397439
}
74407440

74417441
unsigned
7442-
SystemZTargetLowering::getStackProbeSize(MachineFunction &MF) const {
7442+
SystemZTargetLowering::getStackProbeSize(const MachineFunction &MF) const {
74437443
const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
74447444
unsigned StackAlign = TFI->getStackAlignment();
74457445
assert(StackAlign >=1 && isPowerOf2_32(StackAlign) &&

llvm/lib/Target/SystemZ/SystemZISelLowering.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ class SystemZTargetLowering : public TargetLowering {
447447
// LD, and having the full constant in memory enables reg/mem opcodes.
448448
return VT != MVT::f64;
449449
}
450-
bool hasInlineStackProbe(MachineFunction &MF) const override;
450+
bool hasInlineStackProbe(const MachineFunction &MF) const override;
451451
bool isLegalICmpImmediate(int64_t Imm) const override;
452452
bool isLegalAddImmediate(int64_t Imm) const override;
453453
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
@@ -614,7 +614,7 @@ class SystemZTargetLowering : public TargetLowering {
614614
return true;
615615
}
616616

617-
unsigned getStackProbeSize(MachineFunction &MF) const;
617+
unsigned getStackProbeSize(const MachineFunction &MF) const;
618618

619619
private:
620620
const SystemZSubtarget &Subtarget;

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56594,12 +56594,12 @@ bool X86TargetLowering::supportSwiftError() const {
5659456594
}
5659556595

5659656596
/// Returns true if stack probing through a function call is requested.
56597-
bool X86TargetLowering::hasStackProbeSymbol(MachineFunction &MF) const {
56597+
bool X86TargetLowering::hasStackProbeSymbol(const MachineFunction &MF) const {
5659856598
return !getStackProbeSymbolName(MF).empty();
5659956599
}
5660056600

5660156601
/// Returns true if stack probing through inline assembly is requested.
56602-
bool X86TargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
56602+
bool X86TargetLowering::hasInlineStackProbe(const MachineFunction &MF) const {
5660356603

5660456604
// No inline stack probe for Windows, they have their own mechanism.
5660556605
if (Subtarget.isOSWindows() ||
@@ -56617,7 +56617,7 @@ bool X86TargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
5661756617
/// Returns the name of the symbol used to emit stack probes or the empty
5661856618
/// string if not applicable.
5661956619
StringRef
56620-
X86TargetLowering::getStackProbeSymbolName(MachineFunction &MF) const {
56620+
X86TargetLowering::getStackProbeSymbolName(const MachineFunction &MF) const {
5662156621
// Inline Stack probes disable stack probe call
5662256622
if (hasInlineStackProbe(MF))
5662356623
return "";
@@ -56640,7 +56640,7 @@ X86TargetLowering::getStackProbeSymbolName(MachineFunction &MF) const {
5664056640
}
5664156641

5664256642
unsigned
56643-
X86TargetLowering::getStackProbeSize(MachineFunction &MF) const {
56643+
X86TargetLowering::getStackProbeSize(const MachineFunction &MF) const {
5664456644
// The default stack probe size is 4096 if the function has no stackprobesize
5664556645
// attribute.
5664656646
unsigned StackProbeSize = 4096;

llvm/lib/Target/X86/X86ISelLowering.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,11 +1455,11 @@ namespace llvm {
14551455

14561456
bool supportKCFIBundles() const override { return true; }
14571457

1458-
bool hasStackProbeSymbol(MachineFunction &MF) const override;
1459-
bool hasInlineStackProbe(MachineFunction &MF) const override;
1460-
StringRef getStackProbeSymbolName(MachineFunction &MF) const override;
1458+
bool hasStackProbeSymbol(const MachineFunction &MF) const override;
1459+
bool hasInlineStackProbe(const MachineFunction &MF) const override;
1460+
StringRef getStackProbeSymbolName(const MachineFunction &MF) const override;
14611461

1462-
unsigned getStackProbeSize(MachineFunction &MF) const;
1462+
unsigned getStackProbeSize(const MachineFunction &MF) const;
14631463

14641464
bool hasVectorBlend() const override { return true; }
14651465

0 commit comments

Comments
 (0)