[llvm] 4dcfb09 - [NFC][CodeGen] Use const MF in TargetLowering stack probe functions
Josh Stone via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 23 09:34:28 PDT 2022
Author: Josh Stone
Date: 2022-09-23T09:30:32-07:00
New Revision: 4dcfb09e401dbe60e066f0da30b024b53630da31
URL: https://github.com/llvm/llvm-project/commit/4dcfb09e401dbe60e066f0da30b024b53630da31
DIFF: https://github.com/llvm/llvm-project/commit/4dcfb09e401dbe60e066f0da30b024b53630da31.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.h
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 76d90dcf78b46..0d6fa563283a6 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -1904,11 +1904,11 @@ class TargetLoweringBase {
/// Returns the name of the symbol used to emit stack probes or the empty
/// string if not applicable.
- virtual bool hasStackProbeSymbol(MachineFunction &MF) const { return false; }
+ virtual bool hasStackProbeSymbol(const MachineFunction &MF) const { return false; }
- virtual bool hasInlineStackProbe(MachineFunction &MF) const { return false; }
+ virtual bool hasInlineStackProbe(const MachineFunction &MF) const { return false; }
- virtual StringRef getStackProbeSymbolName(MachineFunction &MF) const {
+ virtual StringRef getStackProbeSymbolName(const MachineFunction &MF) const {
return "";
}
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index a1395326045f6..9f2e71e13ff09 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -11998,7 +11998,7 @@ PPCTargetLowering::emitEHSjLjLongJmp(MachineInstr &MI,
return MBB;
}
-bool PPCTargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
+bool PPCTargetLowering::hasInlineStackProbe(const MachineFunction &MF) const {
// If the function specifically requests inline stack probes, emit them.
if (MF.getFunction().hasFnAttribute("probe-stack"))
return MF.getFunction().getFnAttribute("probe-stack").getValueAsString() ==
@@ -12006,7 +12006,7 @@ bool PPCTargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
return false;
}
-unsigned PPCTargetLowering::getStackProbeSize(MachineFunction &MF) const {
+unsigned PPCTargetLowering::getStackProbeSize(const MachineFunction &MF) const {
const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
unsigned StackAlign = TFI->getStackAlignment();
assert(StackAlign >= 1 && isPowerOf2_32(StackAlign) &&
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h
index efceab2180e7e..d7122b62a1f54 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.h
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h
@@ -954,9 +954,9 @@ namespace llvm {
MachineBasicBlock *emitProbedAlloca(MachineInstr &MI,
MachineBasicBlock *MBB) const;
- bool hasInlineStackProbe(MachineFunction &MF) const override;
+ bool hasInlineStackProbe(const MachineFunction &MF) const override;
- unsigned getStackProbeSize(MachineFunction &MF) const;
+ unsigned getStackProbeSize(const MachineFunction &MF) const;
ConstraintType getConstraintType(StringRef Constraint) const override;
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index 7614cd2a1a035..a5c0bae0f06c1 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -842,7 +842,7 @@ bool SystemZTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
}
/// Returns true if stack probing through inline assembly is requested.
-bool SystemZTargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
+bool SystemZTargetLowering::hasInlineStackProbe(const MachineFunction &MF) const {
// If the function specifically requests inline stack probes, emit them.
if (MF.getFunction().hasFnAttribute("probe-stack"))
return MF.getFunction().getFnAttribute("probe-stack").getValueAsString() ==
@@ -7439,7 +7439,7 @@ SystemZTargetLowering::ComputeNumSignBitsForTargetNode(
}
unsigned
-SystemZTargetLowering::getStackProbeSize(MachineFunction &MF) const {
+SystemZTargetLowering::getStackProbeSize(const MachineFunction &MF) const {
const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
unsigned StackAlign = TFI->getStackAlignment();
assert(StackAlign >=1 && isPowerOf2_32(StackAlign) &&
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.h b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
index 66f0fa20f3e32..a82c529dbc8a6 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.h
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
@@ -447,7 +447,7 @@ class SystemZTargetLowering : public TargetLowering {
// LD, and having the full constant in memory enables reg/mem opcodes.
return VT != MVT::f64;
}
- bool hasInlineStackProbe(MachineFunction &MF) const override;
+ bool hasInlineStackProbe(const MachineFunction &MF) const override;
bool isLegalICmpImmediate(int64_t Imm) const override;
bool isLegalAddImmediate(int64_t Imm) const override;
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
@@ -614,7 +614,7 @@ class SystemZTargetLowering : public TargetLowering {
return true;
}
- unsigned getStackProbeSize(MachineFunction &MF) const;
+ unsigned getStackProbeSize(const MachineFunction &MF) const;
private:
const SystemZSubtarget &Subtarget;
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 7abdef59f47fc..1dcc94cb1fce3 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -56594,12 +56594,12 @@ bool X86TargetLowering::supportSwiftError() const {
}
/// Returns true if stack probing through a function call is requested.
-bool X86TargetLowering::hasStackProbeSymbol(MachineFunction &MF) const {
+bool X86TargetLowering::hasStackProbeSymbol(const MachineFunction &MF) const {
return !getStackProbeSymbolName(MF).empty();
}
/// Returns true if stack probing through inline assembly is requested.
-bool X86TargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
+bool X86TargetLowering::hasInlineStackProbe(const MachineFunction &MF) const {
// No inline stack probe for Windows, they have their own mechanism.
if (Subtarget.isOSWindows() ||
@@ -56617,7 +56617,7 @@ bool X86TargetLowering::hasInlineStackProbe(MachineFunction &MF) const {
/// Returns the name of the symbol used to emit stack probes or the empty
/// string if not applicable.
StringRef
-X86TargetLowering::getStackProbeSymbolName(MachineFunction &MF) const {
+X86TargetLowering::getStackProbeSymbolName(const MachineFunction &MF) const {
// Inline Stack probes disable stack probe call
if (hasInlineStackProbe(MF))
return "";
@@ -56640,7 +56640,7 @@ X86TargetLowering::getStackProbeSymbolName(MachineFunction &MF) const {
}
unsigned
-X86TargetLowering::getStackProbeSize(MachineFunction &MF) const {
+X86TargetLowering::getStackProbeSize(const MachineFunction &MF) const {
// The default stack probe size is 4096 if the function has no stackprobesize
// attribute.
unsigned StackProbeSize = 4096;
diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h
index d056f53ecd21f..907fb5a78292f 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.h
+++ b/llvm/lib/Target/X86/X86ISelLowering.h
@@ -1455,11 +1455,11 @@ namespace llvm {
bool supportKCFIBundles() const override { return true; }
- bool hasStackProbeSymbol(MachineFunction &MF) const override;
- bool hasInlineStackProbe(MachineFunction &MF) const override;
- StringRef getStackProbeSymbolName(MachineFunction &MF) const override;
+ bool hasStackProbeSymbol(const MachineFunction &MF) const override;
+ bool hasInlineStackProbe(const MachineFunction &MF) const override;
+ StringRef getStackProbeSymbolName(const MachineFunction &MF) const override;
- unsigned getStackProbeSize(MachineFunction &MF) const;
+ unsigned getStackProbeSize(const MachineFunction &MF) const;
bool hasVectorBlend() const override { return true; }
More information about the llvm-commits
mailing list