diff options
author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-08-21 07:28:24 +0000 |
---|---|---|
committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-08-21 07:28:24 +0000 |
commit | aeb2bbcb6d4f13d0032d57fd1cb1a92da2acd01e (patch) | |
tree | 2a814f308ceb7554281744c88be3c4af2f47fee1 /include | |
parent | 46d353f8e8a2bbe02e8aa6a2292eae930dd3b7e6 (diff) | |
download | llvm-aeb2bbcb6d4f13d0032d57fd1cb1a92da2acd01e.tar.gz llvm-aeb2bbcb6d4f13d0032d57fd1cb1a92da2acd01e.tar.bz2 llvm-aeb2bbcb6d4f13d0032d57fd1cb1a92da2acd01e.tar.xz |
MC CFG: Split MCBasicBlocks to mirror atom splitting.
When an MCTextAtom is split, all MCBasicBlocks backed by it are
automatically split, with a fallthrough between both blocks, and
the successors moved to the second block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188881 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/MC/MCFunction.h | 8 | ||||
-rw-r--r-- | include/llvm/MC/MCModule.h | 15 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/llvm/MC/MCFunction.h b/include/llvm/MC/MCFunction.h index 697b5006a9..3fccaac29b 100644 --- a/include/llvm/MC/MCFunction.h +++ b/include/llvm/MC/MCFunction.h @@ -70,6 +70,14 @@ public: void addPredecessor(const MCBasicBlock *MCBB); bool isPredecessor(const MCBasicBlock *MCBB) const; + + /// \brief Split block, mirrorring NewAtom = Insts->split(..). + /// This moves all successors to \p SplitBB, and + /// adds a fallthrough to it. + /// \p SplitBB The result of splitting Insts, a basic block directly following + /// this basic block. + /// \returns A new basic block, backed by \p SplitBB. + void splitBasicBlock(MCBasicBlock *SplitBB); /// @} }; diff --git a/include/llvm/MC/MCModule.h b/include/llvm/MC/MCModule.h index c0c242c21a..63635c7478 100644 --- a/include/llvm/MC/MCModule.h +++ b/include/llvm/MC/MCModule.h @@ -56,6 +56,21 @@ class MCModule { void map(MCAtom *NewAtom); /// @} + /// \name Basic block tracking + /// @{ + typedef std::vector<MCBasicBlock*> BBsByAtomTy; + BBsByAtomTy BBsByAtom; + + // For access to basic block > atom tracking. + friend class MCBasicBlock; + friend class MCTextAtom; + + /// \brief Keep track of \p BBBackedByAtom as being backed by \p Atom. + /// This is used to update succs/preds when \p Atom is split. + void trackBBForAtom(const MCTextAtom *Atom, MCBasicBlock *BBBackedByAtom); + void splitBasicBlocksForAtom(const MCTextAtom *TA, const MCTextAtom *NewTA); + /// @} + /// \name Function tracking /// @{ typedef std::vector<MCFunction*> FunctionListTy; |