LLVM 19.0.0git
Macros | Functions | Variables
ModuloSchedule.cpp File Reference
#include "llvm/CodeGen/ModuloSchedule.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/InitializePasses.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "pipeliner"
 

Functions

static void getPhiRegs (MachineInstr &Phi, MachineBasicBlock *Loop, unsigned &InitVal, unsigned &LoopVal)
 Return the register values for the operands of a Phi instruction.
 
static unsigned getInitPhiReg (MachineInstr &Phi, MachineBasicBlock *LoopBB)
 Return the Phi register value that comes from the incoming block.
 
static unsigned getLoopPhiReg (MachineInstr &Phi, MachineBasicBlock *LoopBB)
 Return the Phi register value that comes the loop block.
 
static void replaceRegUsesAfterLoop (unsigned FromReg, unsigned ToReg, MachineBasicBlock *MBB, MachineRegisterInfo &MRI, LiveIntervals &LIS)
 Replace all uses of FromReg that appear outside the specified basic block with ToReg.
 
static bool hasUseAfterLoop (unsigned Reg, MachineBasicBlock *BB, MachineRegisterInfo &MRI)
 Return true if the register has a use that occurs outside the specified loop.
 
static void removePhis (MachineBasicBlock *BB, MachineBasicBlock *Incoming)
 Remove the incoming block from the Phis in a basic block.
 
static MachineBasicBlockcreateDedicatedExit (MachineBasicBlock *Loop, MachineBasicBlock *Exit)
 Create a dedicated exit for Loop.
 
static MachineInstrgetLoopPhiUser (Register Reg, MachineBasicBlock *Loop)
 Return a phi if Reg is referenced by the phi.
 
static void replacePhiSrc (MachineInstr &Phi, Register OrigReg, Register NewReg, MachineBasicBlock *NewMBB)
 
 INITIALIZE_PASS_BEGIN (ModuloScheduleTest, "modulo-schedule-test", "Modulo Schedule test pass", false, false) INITIALIZE_PASS_END(ModuloScheduleTest
 
static void parseSymbolString (StringRef S, int &Cycle, int &Stage)
 

Variables

static cl::opt< boolSwapBranchTargetsMVE ("pipeliner-swap-branch-targets-mve", cl::Hidden, cl::init(false), cl::desc("Swap target blocks of a conditional branch for MVE expander"))
 
modulo schedule test
 
modulo schedule Modulo Schedule test pass
 
modulo schedule Modulo Schedule test false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "pipeliner"

Definition at line 22 of file ModuloSchedule.cpp.

Function Documentation

◆ createDedicatedExit()

static MachineBasicBlock * createDedicatedExit ( MachineBasicBlock Loop,
MachineBasicBlock Exit 
)
static

Create a dedicated exit for Loop.

Exit is the original exit for Loop. If it is already dedicated exit, return it. Otherwise, insert a new block between them and return the new block.

Definition at line 2116 of file ModuloSchedule.cpp.

References llvm::MachineBasicBlock::addSuccessor(), llvm::HexagonInstrInfo::analyzeBranch(), Cond, llvm::MachineFunction::CreateMachineBasicBlock(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::insert(), llvm::HexagonInstrInfo::insertBranch(), llvm_unreachable, llvm::HexagonInstrInfo::removeBranch(), TBB, and TII.

◆ getInitPhiReg()

static unsigned getInitPhiReg ( MachineInstr Phi,
MachineBasicBlock LoopBB 
)
static

Return the Phi register value that comes from the incoming block.

Definition at line 56 of file ModuloSchedule.cpp.

◆ getLoopPhiReg()

static unsigned getLoopPhiReg ( MachineInstr Phi,
MachineBasicBlock LoopBB 
)
static

Return the Phi register value that comes the loop block.

Definition at line 64 of file ModuloSchedule.cpp.

◆ getLoopPhiUser()

static MachineInstr * getLoopPhiUser ( Register  Reg,
MachineBasicBlock Loop 
)
static

Return a phi if Reg is referenced by the phi.

canApply() guarantees that at most only one such phi exists.

Definition at line 2361 of file ModuloSchedule.cpp.

References getPhiRegs().

◆ getPhiRegs()

static void getPhiRegs ( MachineInstr Phi,
MachineBasicBlock Loop,
unsigned InitVal,
unsigned LoopVal 
)
static

Return the register values for the operands of a Phi instruction.

This function assume the instruction is a Phi.

Definition at line 40 of file ModuloSchedule.cpp.

References assert().

◆ hasUseAfterLoop()

static bool hasUseAfterLoop ( unsigned  Reg,
MachineBasicBlock BB,
MachineRegisterInfo MRI 
)
static

Return true if the register has a use that occurs outside the specified loop.

Definition at line 355 of file ModuloSchedule.cpp.

References MRI.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( ModuloScheduleTest  ,
"modulo-schedule-test"  ,
"Modulo Schedule test pass"  ,
false  ,
false   
)

◆ parseSymbolString()

static void parseSymbolString ( StringRef  S,
int &  Cycle,
int &  Stage 
)
static

Definition at line 2793 of file ModuloSchedule.cpp.

References llvm::dbgs(), and llvm_unreachable.

◆ removePhis()

static void removePhis ( MachineBasicBlock BB,
MachineBasicBlock Incoming 
)
static

Remove the incoming block from the Phis in a basic block.

Definition at line 845 of file ModuloSchedule.cpp.

References MI.

◆ replacePhiSrc()

static void replacePhiSrc ( MachineInstr Phi,
Register  OrigReg,
Register  NewReg,
MachineBasicBlock NewMBB 
)
static

Definition at line 2447 of file ModuloSchedule.cpp.

References Idx.

◆ replaceRegUsesAfterLoop()

static void replaceRegUsesAfterLoop ( unsigned  FromReg,
unsigned  ToReg,
MachineBasicBlock MBB,
MachineRegisterInfo MRI,
LiveIntervals LIS 
)
static

Replace all uses of FromReg that appear outside the specified basic block with ToReg.

Definition at line 341 of file ModuloSchedule.cpp.

References llvm::LiveIntervals::createEmptyInterval(), llvm::LiveIntervals::hasInterval(), llvm::make_early_inc_range(), MBB, and MRI.

Variable Documentation

◆ false

modulo schedule Modulo Schedule test false

Definition at line 2780 of file ModuloSchedule.cpp.

◆ pass

modulo schedule Modulo Schedule test pass

Definition at line 2780 of file ModuloSchedule.cpp.

Referenced by LLVMTargetMachineEmit(), and llvm::verifySafepointIR().

◆ SwapBranchTargetsMVE

cl::opt< bool > SwapBranchTargetsMVE("pipeliner-swap-branch-targets-mve", cl::Hidden, cl::init(false), cl::desc("Swap target blocks of a conditional branch for MVE expander")) ( "pipeliner-swap-branch-targets-mve"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Swap target blocks of a conditional branch for MVE expander")   
)
static

◆ test

modulo schedule test