LLVM  6.0.0svn
Macros
WebAssemblyFixIrreducibleControlFlow.cpp File Reference

This file implements a pass that transforms irreducible control flow into reducible control flow. More...

#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "WebAssembly.h"
#include "WebAssemblyMachineFunctionInfo.h"
#include "WebAssemblySubtarget.h"
#include "llvm/ADT/PriorityQueue.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.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"
Include dependency graph for WebAssemblyFixIrreducibleControlFlow.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "wasm-fix-irreducible-control-flow"
 

Detailed Description

This file implements a pass that transforms irreducible control flow into reducible control flow.

Irreducible control flow means multiple-entry loops; they appear as CFG cycles that are not recorded in MachineLoopInfo due to being unnatural.

Note that LLVM has a generic pass that lowers irreducible control flow, but it linearizes control flow, turning diamonds into two triangles, which is both unnecessary and undesirable for WebAssembly.

TODO: The transformation implemented here handles all irreducible control flow, without exponential code-size expansion, though it does so by creating inefficient code in many cases. Ideally, we should add other transformations, including code-duplicating cases, which can be more efficient in common cases, and they can fall back to this conservative implementation as needed.

Definition in file WebAssemblyFixIrreducibleControlFlow.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "wasm-fix-irreducible-control-flow"

Definition at line 46 of file WebAssemblyFixIrreducibleControlFlow.cpp.