LLVM 22.0.0git
|
===------------------------------------------------------------------—===// More...
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <iterator>
#include <utility>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "lrshrink" |
Functions | |
STATISTIC (NumInstrsHoistedToShrinkLiveRange, "Number of insructions hoisted to shrink live range.") | |
INITIALIZE_PASS (LiveRangeShrink, "lrshrink", "Live Range Shrink Pass", false, false) using InstOrderMap | |
static MachineInstr * | FindDominatedInstruction (MachineInstr &New, MachineInstr *Old, const InstOrderMap &M) |
Returns New if it's dominated by Old , otherwise return Old . | |
static bool | isCodeMotionBarrier (MachineInstr &MI) |
Returns whether this instruction is considered a code motion barrier by this pass. | |
static void | BuildInstOrderMap (MachineBasicBlock::iterator Start, InstOrderMap &M) |
Builds Instruction to its dominating order number map M by traversing from instruction Start . | |
===------------------------------------------------------------------—===//
This pass moves instructions close to the definition of its operands to shrink live range of the def instruction. The code motion is limited within the basic block. The moved instruction should have 1 def, and more than one uses, all of which are the only use of the def.
===------------------------------------------------------------------—===//
Definition in file LiveRangeShrink.cpp.
#define DEBUG_TYPE "lrshrink" |
Definition at line 36 of file LiveRangeShrink.cpp.
|
static |
Builds Instruction to its dominating order number map M
by traversing from instruction Start
.
Definition at line 108 of file LiveRangeShrink.cpp.
References I, isCodeMotionBarrier(), and llvm::make_range().
|
static |
Returns New
if it's dominated by Old
, otherwise return Old
.
M
maintains a map from instruction to its dominating order that satisfies M[A] > M[B] guarantees that A is dominated by B. If New
is not in M
, return Old
. Otherwise if Old
is null, return New
.
Definition at line 77 of file LiveRangeShrink.cpp.
References I.
INITIALIZE_PASS | ( | LiveRangeShrink | , |
"lrshrink" | , | ||
"Live Range Shrink Pass" | , | ||
false | , | ||
false | |||
) |
|
static |
Returns whether this instruction is considered a code motion barrier by this pass.
We can be less conservative than hasUnmodeledSideEffects() when deciding whether an instruction is a barrier because it is known that pseudo probes are safe to move in this pass specifically (see commit 1cb47a063e2b).
Definition at line 102 of file LiveRangeShrink.cpp.
References MI.
Referenced by BuildInstOrderMap().
STATISTIC | ( | NumInstrsHoistedToShrinkLiveRange | , |
"Number of insructions hoisted to shrink live range." | |||
) |