|
LLVM
5.0.0
|
This file implements a CFG sorting pass. More...
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"#include "WebAssembly.h"#include "WebAssemblySubtarget.h"#include "WebAssemblyUtilities.h"#include "llvm/ADT/PriorityQueue.h"#include "llvm/ADT/SetVector.h"#include "llvm/CodeGen/MachineDominators.h"#include "llvm/CodeGen/MachineFunction.h"#include "llvm/CodeGen/MachineLoopInfo.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/Passes.h"#include "llvm/Support/Debug.h"#include "llvm/Support/raw_ostream.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "wasm-cfg-sort" |
Functions | |
| static void | MaybeUpdateTerminator (MachineBasicBlock *MBB) |
| static void | SortBlocks (MachineFunction &MF, const MachineLoopInfo &MLI, const MachineDominatorTree &MDT) |
| Sort the blocks, taking special care to make sure that loops are not interrupted by blocks not dominated by their header. More... | |
This file implements a CFG sorting pass.
This pass reorders the blocks in a function to put them into topological order, ignoring loop backedges, and without any loop being interrupted by a block not dominated by the loop header, with special care to keep the order as similar as possible to the original order.
Definition in file WebAssemblyCFGSort.cpp.
| #define DEBUG_TYPE "wasm-cfg-sort" |
Definition at line 35 of file WebAssemblyCFGSort.cpp.
|
static |
Definition at line 63 of file WebAssemblyCFGSort.cpp.
References assert(), llvm::MachineBasicBlock::terminators(), and llvm::MachineBasicBlock::updateTerminator().
Referenced by SortBlocks().
|
static |
Sort the blocks, taking special care to make sure that loops are not interrupted by blocks not dominated by their header.
TODO: There are many opportunities for improving the heuristics here. Explore them.
Definition at line 114 of file WebAssemblyCFGSort.cpp.
References assert(), llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::back(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::LoopBase< N, M >::contains(), llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::count(), llvm::MachineDominatorTree::dominates(), E, llvm::SmallVectorBase::empty(), llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::empty(), llvm::MachineBasicBlock::front(), llvm::LoopBase< N, M >::getHeader(), llvm::MachineLoopInfo::getLoopFor(), llvm::MachineBasicBlock::getNumber(), llvm::MachineFunction::getNumBlockIDs(), llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::insert(), L, llvm::LoopBottom(), Loops, MaybeUpdateTerminator(), llvm::MachineBasicBlock::moveAfter(), N, llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::pop_back(), llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::pop_back_val(), llvm::MachineBasicBlock::predecessors(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::MachineFunction::RenumberBlocks(), llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::size(), and llvm::MachineBasicBlock::successors().
1.8.6