[PATCH] D111070: [MacroFusion] Expose useful static methods. NFC.

Joe Nash via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 06:49:46 PDT 2021


Joe_Nash updated this revision to Diff 377199.
Joe_Nash added a comment.

add doc comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111070/new/

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,18 @@
                                                 const MachineInstr *FirstMI,
                                                 const MachineInstr &SecondMI)>;
 
+/// Checks if the number of cluster edges between SU and its predecessors is
+/// less than FuseLimit
+bool hasLessThanNumFused(const SUnit &SU, unsigned FuseLimit);
+
+/// Create an artificial edge between FirstSU and SecondSU.
+/// Make data dependencies from the FirstSU also dependent on the SecondSU to
+/// prevent them from being scheduled between the FirstSU and the SecondSU
+/// and vice-versa.
+/// Fusing more than 2 instructions is not currently supported.
+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.377199.patch
Type: text/x-patch
Size: 2351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/6e040053/attachment.bin>


More information about the llvm-commits mailing list