summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBlockPlacement.cpp
diff options
context:
space:
mode:
authorHaicheng Wu <haicheng@codeaurora.org>2016-04-29 17:06:44 +0000
committerHaicheng Wu <haicheng@codeaurora.org>2016-04-29 17:06:44 +0000
commite749ce53d48b5b355137b8b81db62852e1223014 (patch)
treeb5d478ffd03d4993fec609f5c1e7d7320faf2ee3 /llvm/lib/CodeGen/MachineBlockPlacement.cpp
parent38e496b175a380c00386ad26548b1ba391677d94 (diff)
downloadbcm5719-llvm-e749ce53d48b5b355137b8b81db62852e1223014.tar.gz
bcm5719-llvm-e749ce53d48b5b355137b8b81db62852e1223014.zip
[MBP] Split placement and alignment into two functions. NFC.
Cut and Paste. llvm-svn: 268067
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBlockPlacement.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index 6a9078a78f5..970be7fc78d 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -300,6 +300,7 @@ class MachineBlockPlacement : public MachineFunctionPass {
void rotateLoopWithProfile(BlockChain &LoopChain, MachineLoop &L,
const BlockFilterSet &LoopBlockSet);
void buildCFGChains(MachineFunction &F);
+ void alignBlocks(MachineFunction &F);
public:
static char ID; // Pass identification, replacement for typeid
@@ -1357,7 +1358,9 @@ void MachineBlockPlacement::buildCFGChains(MachineFunction &F) {
MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For AnalyzeBranch.
if (!TII->AnalyzeBranch(F.back(), TBB, FBB, Cond))
F.back().updateTerminator();
+}
+void MachineBlockPlacement::alignBlocks(MachineFunction &F) {
// Walk through the backedges of the function now that we have fully laid out
// the basic blocks and align the destination of each backedge. We don't rely
// exclusively on the loop info here so that we can align backedges in
@@ -1366,6 +1369,7 @@ void MachineBlockPlacement::buildCFGChains(MachineFunction &F) {
// FIXME: Use Function::optForSize().
if (F.getFunction()->hasFnAttribute(Attribute::OptimizeForSize))
return;
+ BlockChain &FunctionChain = *BlockToChain[&F.front()];
if (FunctionChain.begin() == FunctionChain.end())
return; // Empty chain.
@@ -1442,6 +1446,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &F) {
assert(BlockToChain.empty());
buildCFGChains(F);
+ alignBlocks(F);
BlockToChain.clear();
ChainAllocator.DestroyAll();
OpenPOWER on IntegriCloud