LLVM 19.0.0git
Macros | Functions
LiveRangeShrink.cpp File Reference

===------------------------------------------------------------------—===// 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 MachineInstrFindDominatedInstruction (MachineInstr &New, MachineInstr *Old, const InstOrderMap &M)
 Returns New if it's dominated by Old, otherwise return Old.
 
static void BuildInstOrderMap (MachineBasicBlock::iterator Start, InstOrderMap &M)
 Builds Instruction to its dominating order number map M by traversing from instruction Start.
 

Detailed Description

===------------------------------------------------------------------—===//

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.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "lrshrink"

Definition at line 36 of file LiveRangeShrink.cpp.

Function Documentation

◆ BuildInstOrderMap()

static void BuildInstOrderMap ( MachineBasicBlock::iterator  Start,
InstOrderMap &  M 
)
static

Builds Instruction to its dominating order number map M by traversing from instruction Start.

Definition at line 100 of file LiveRangeShrink.cpp.

References I, and llvm::make_range().

◆ FindDominatedInstruction()

static MachineInstr * FindDominatedInstruction ( MachineInstr New,
MachineInstr Old,
const InstOrderMap &  M 
)
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()

INITIALIZE_PASS ( LiveRangeShrink  ,
"lrshrink"  ,
"Live Range Shrink Pass"  ,
false  ,
false   
)

◆ STATISTIC()

STATISTIC ( NumInstrsHoistedToShrinkLiveRange  ,
"Number of insructions hoisted to shrink live range."   
)