]> granicus.if.org Git - llvm/commitdiff
[AArch64, X86] Additional debug information for MacroFusion
authorEvandro Menezes <e.menezes@samsung.com>
Fri, 10 Mar 2017 20:20:04 +0000 (20:20 +0000)
committerEvandro Menezes <e.menezes@samsung.com>
Fri, 10 Mar 2017 20:20:04 +0000 (20:20 +0000)
In order to make it easier to parse information about the performance of
MacroFusion, this patch adds the function and the instruction names to the
debug output of this pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297504 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64MacroFusion.cpp
lib/Target/X86/X86MacroFusion.cpp

index 364016e8203bcfbe1fc9bb64d3660a63695bc1a2..1cac19b8139de7a743f7458471c4e94871a4005f 100644 (file)
@@ -209,11 +209,19 @@ static bool scheduleAdjacentImpl(ScheduleDAGMI *DAG, SUnit *ASU,
         Dep.setLatency(0);
 
     ++NumFused;
-    DEBUG(dbgs() << "Macro fuse ";
-          Preds ? BSU->print(dbgs(), DAG) : ASU->print(dbgs(), DAG);
-          dbgs() << " - ";
-          Preds ? ASU->print(dbgs(), DAG) : BSU->print(dbgs(), DAG);
-          dbgs() << '\n');
+    DEBUG({ SUnit *LSU = Preds ? BSU : ASU;
+            SUnit *RSU = Preds ? ASU : BSU;
+            const MachineInstr *LMI = Preds ? BMI : AMI;
+            const MachineInstr *RMI = Preds ? AMI : BMI;
+
+            dbgs() << DAG->MF.getName() << "(): Macro fuse ";
+            LSU->print(dbgs(), DAG);
+            dbgs() << " - ";
+            RSU->print(dbgs(), DAG);
+            dbgs() << " / " <<
+                      TII->getName(LMI->getOpcode()) << " - " <<
+                      TII->getName(RMI->getOpcode()) << '\n';
+          });
 
     return true;
   }
index e1253d386831ce6f43901214caf687a19c1f05ed..89efd24840f5d846045f8466913b6850d98bed91 100644 (file)
@@ -214,6 +214,7 @@ public:
 
 void X86MacroFusion::apply(ScheduleDAGInstrs *DAGInstrs) {
   ScheduleDAGMI *DAG = static_cast<ScheduleDAGMI*>(DAGInstrs);
+  const TargetInstrInfo &TII = *DAG->TII;
   const X86Subtarget &ST = DAG->MF.getSubtarget<X86Subtarget>();
 
   // For now, assume targets can only fuse with the branch.
@@ -249,9 +250,12 @@ void X86MacroFusion::apply(ScheduleDAGInstrs *DAGInstrs) {
         SuccDep.setLatency(0);
 
     ++NumFused;
-    DEBUG(dbgs() << "Macro fuse ";
+    DEBUG(dbgs() << DAG->MF.getName() << "(): Macro fuse ";
           SU.print(dbgs(), DAG);
-          dbgs() << " - ExitSU" << '\n');
+          dbgs() << " - ExitSU" << " / " <<
+                    TII.getName(Pred.getOpcode()) << " - " <<
+                    TII.getName(Branch->getOpcode()) << '\n';
+);
 
     break;
   }