summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBlockPlacement.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2017-01-29 01:57:02 +0000
committerXinliang David Li <davidxl@google.com>2017-01-29 01:57:02 +0000
commitfd3f645f9de1ac0461577c872162f5977abcc329 (patch)
tree409700667578cc99650c411f9b8f9b69b3d5abb6 /llvm/lib/CodeGen/MachineBlockPlacement.cpp
parent9d8f6f8a45c0440c39d14f4683e9259c1a3b234b (diff)
downloadbcm5719-llvm-fd3f645f9de1ac0461577c872162f5977abcc329.tar.gz
bcm5719-llvm-fd3f645f9de1ac0461577c872162f5977abcc329.zip
Add support to dump dot graph block layout after MBP
Differential Revision: https://reviews.llvm.org/D29141 llvm-svn: 293408
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBlockPlacement.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index 40e3840e6b0..7d57cc0956d 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -32,6 +32,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
@@ -146,6 +147,11 @@ static cl::opt<unsigned> TailDuplicatePlacementThreshold(
extern cl::opt<unsigned> StaticLikelyProb;
extern cl::opt<unsigned> ProfileLikelyProb;
+#ifndef NDEBUG
+extern cl::opt<GVDAGType> ViewBlockLayoutWithBFI;
+extern cl::opt<std::string> ViewBlockFreqFuncName;
+#endif
+
namespace {
class BlockChain;
/// \brief Type for our function-wide basic block -> block chain mapping.
@@ -2067,6 +2073,14 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
MBI->setAlignment(AlignAllNonFallThruBlocks);
}
}
+#ifndef NDEBUG
+ if (ViewBlockLayoutWithBFI != GVDT_None &&
+ (ViewBlockFreqFuncName.empty() ||
+ F->getFunction()->getName().equals(ViewBlockFreqFuncName))) {
+ MBFI->view(false);
+ }
+#endif
+
// We always return true as we have no way to track whether the final order
// differs from the original order.
OpenPOWER on IntegriCloud