|
LLVM
10.0.0
|
This file implements a CFG stacking pass. More...
#include "WebAssembly.h"#include "WebAssemblyExceptionInfo.h"#include "WebAssemblyMachineFunctionInfo.h"#include "WebAssemblySubtarget.h"#include "WebAssemblyUtilities.h"#include "llvm/ADT/Statistic.h"#include "llvm/CodeGen/MachineDominators.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/MachineLoopInfo.h"#include "llvm/MC/MCAsmInfo.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "wasm-cfg-stackify" |
This file implements a CFG stacking pass.
This pass inserts BLOCK, LOOP, and TRY markers to mark the start of scopes, since scope boundaries serve as the labels for WebAssembly's control transfers.
This is sufficient to convert arbitrary CFGs into a form that works on WebAssembly, provided that all loops are single-entry.
In case we use exceptions, this pass also fixes mismatches in unwind destinations created during transforming CFG into wasm structured format.
Definition in file WebAssemblyCFGStackify.cpp.
| #define DEBUG_TYPE "wasm-cfg-stackify" |
Definition at line 36 of file WebAssemblyCFGStackify.cpp.
|
static |
Definition at line 1263 of file WebAssemblyCFGStackify.cpp.
References llvm::MachineInstr::addOperand(), assert(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::MachineFunction::back(), llvm::BuildMI(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::clear(), llvm::SmallVectorImpl< T >::clear(), llvm::MachineOperand::CreateImm(), llvm::dbgs(), E, llvm::SmallVectorBase::empty(), llvm::MachineBasicBlock::end(), llvm::bitc::END_BLOCK, llvm::MachineBasicBlock::findPrevDebugLoc(), getDepth(), llvm::MCAsmInfo::getExceptionHandlingType(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFunction::getName(), llvm::MachineBasicBlock::getNumber(), llvm::MachineFunction::getNumBlockIDs(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), getParent(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::WebAssemblySubtarget::getTargetTriple(), llvm::Function::hasPersonalityFn(), I, llvm::MachineRegisterInfo::invalidateLiveness(), llvm::MachineBasicBlock::isEHPad(), llvm::Triple::isOSBinFormatELF(), llvm::MachineInstr::isTerminator(), LLVM_DEBUG, llvm::AMDGPUISD::LOOP, MI, llvm::MachineInstr::operands(), llvm::SmallVectorTemplateBase< T >::pop_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::MachineBasicBlock::rbegin(), llvm::MachineInstr::RemoveOperand(), llvm::MachineBasicBlock::rend(), llvm::SmallVectorImpl< T >::resize(), llvm::reverse(), TII, and llvm::Wasm.
|
static |
Test whether Pred has any terminators explicitly branching to MBB, as opposed to falling through.
Note that it's possible (eg. in unoptimized code) for a branch instruction to both branch to a block and fallthrough to it, so we check the actual branch operands to see if there are any explicit mentions.
Definition at line 121 of file WebAssemblyCFGStackify.cpp.
References MI, and llvm::MachineBasicBlock::terminators().
|
static |
Definition at line 1210 of file WebAssemblyCFGStackify.cpp.
References assert(), llvm::Depth, llvm::bitc::END_BLOCK, llvm::MachineFunction::getInfo(), llvm::WebAssemblyFunctionInfo::getResults(), MI, llvm::WebAssembly::Multivalue, llvm::reverse(), llvm::SmallVectorBase::size(), llvm::WebAssembly::toValType(), and X.
Referenced by llvm::PMDataManager::add(), appendEndToFunction(), llvm::RegionBase< RegionTraits< Function > >::dump(), llvm::SUnit::dumpAttributes(), llvm::PMDataManager::dumpPassInfo(), llvm::PMDataManager::dumpUsedSet(), getCombinerObjective(), llvm::DWARFUnit::getLastChild(), llvm::RegionBase< RegionTraits< Function > >::getNode(), llvm::DWARFUnit::getParent(), llvm::DWARFUnit::getPreviousSibling(), llvm::DWARFUnit::getSibling(), ignoreDependence(), INITIALIZE_PASS(), isIntersect(), llvm::PMStack::push(), llvm::VLIWMachineScheduler::schedule(), and llvm::SUnit::setDepthToAtLeast().
|
static |
Definition at line 136 of file WebAssemblyCFGStackify.cpp.
References assert(), llvm::MachineBasicBlock::begin(), llvm::SmallPtrSetImpl< PtrType >::count(), E, and llvm::MachineBasicBlock::end().
|
static |
Definition at line 160 of file WebAssemblyCFGStackify.cpp.
References assert(), llvm::MachineBasicBlock::begin(), llvm::SmallPtrSetImpl< PtrType >::count(), E, and llvm::MachineBasicBlock::end().
| INITIALIZE_PASS | ( | WebAssemblyCFGStackify | , |
| DEBUG_TYPE | , | ||
| "Insert BLOCK/LOOP/TRY markers for WebAssembly scopes" | , | ||
| false | , | ||
| false | |||
| ) |
Definition at line 108 of file WebAssemblyCFGStackify.cpp.
| STATISTIC | ( | NumUnwindMismatches | , |
| "Number of EH pad unwind mismatches found" | |||
| ) |
|
static |
Definition at line 710 of file WebAssemblyCFGStackify.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::BuildMI(), llvm::Catch, llvm::MachineFunction::CreateMachineBasicBlock(), llvm::tgtok::Def, llvm::SmallVectorBase::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::MachineFunction::getInfo(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineRegisterInfo::getUniqueVRegDef(), llvm::MachineBasicBlock::hasEHPadSuccessor(), llvm::MachineFunction::insert(), llvm::WebAssembly::isMarker(), llvm::Register::isPhysicalRegister(), llvm::WebAssembly::mayThrow(), MI, MRI, P, llvm::SmallVectorTemplateBase< T >::pop_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::MachineInstr::removeFromParent(), llvm::reverse(), llvm::MachineBasicBlock::successors(), TII, and llvm::WebAssemblyFunctionInfo::unstackifyVReg().
1.8.13