[PATCH] D111070: [MacroFusion] Expose useful static methods. NFC.
Joe Nash via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 4 09:09:10 PDT 2021
Joe_Nash created this revision.
Herald added a subscriber: hiraditya.
Joe_Nash requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
hasLessThanNumFused and fuseInstructionPair are useful for
DAG mutations similar to MacroFusion, but which cannot use
MacroFusion as a whole (such as fusing non-dependent instruction).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111070
Files:
llvm/include/llvm/CodeGen/MacroFusion.h
llvm/lib/CodeGen/MacroFusion.cpp
Index: llvm/lib/CodeGen/MacroFusion.cpp
===================================================================
--- llvm/lib/CodeGen/MacroFusion.cpp
+++ llvm/lib/CodeGen/MacroFusion.cpp
@@ -44,15 +44,15 @@
return nullptr;
}
-static bool hasLessThanNumFused(const SUnit &SU, unsigned FuseLimit) {
+bool llvm::hasLessThanNumFused(const SUnit &SU, unsigned FuseLimit) {
unsigned Num = 1;
const SUnit *CurrentSU = &SU;
while ((CurrentSU = getPredClusterSU(*CurrentSU)) && Num < FuseLimit) Num ++;
return Num < FuseLimit;
}
-static bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
- SUnit &SecondSU) {
+bool llvm::fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
+ SUnit &SecondSU) {
// Check that neither instr is already paired with another along the edge
// between them.
for (SDep &SI : FirstSU.Succs)
Index: llvm/include/llvm/CodeGen/MacroFusion.h
===================================================================
--- llvm/include/llvm/CodeGen/MacroFusion.h
+++ llvm/include/llvm/CodeGen/MacroFusion.h
@@ -23,6 +23,8 @@
class ScheduleDAGMutation;
class TargetInstrInfo;
class TargetSubtargetInfo;
+class ScheduleDAGInstrs;
+class SUnit;
/// Check if the instr pair, FirstMI and SecondMI, should be fused
/// together. Given SecondMI, when FirstMI is unspecified, then check if
@@ -32,6 +34,10 @@
const MachineInstr *FirstMI,
const MachineInstr &SecondMI)>;
+bool hasLessThanNumFused(const SUnit &SU, unsigned FuseLimit);
+bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
+ SUnit &SecondSU);
+
/// Create a DAG scheduling mutation to pair instructions back to back
/// for instructions that benefit according to the target-specific
/// shouldScheduleAdjacent predicate function.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111070.376919.patch
Type: text/x-patch
Size: 1944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211004/52efe7be/attachment.bin>
More information about the llvm-commits
mailing list