LLVM  15.0.0git
Macros | Functions | Variables
SIOptimizeExecMasking.cpp File Reference
#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/InitializePasses.h"
Include dependency graph for SIOptimizeExecMasking.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "si-optimize-exec-masking"
 

Functions

 INITIALIZE_PASS_BEGIN (SIOptimizeExecMasking, DEBUG_TYPE, "SI optimize exec mask operations", false, false) INITIALIZE_PASS_END(SIOptimizeExecMasking
 
static Register isCopyFromExec (const MachineInstr &MI, const GCNSubtarget &ST)
 If MI is a copy from exec, return the register copied to. More...
 
static Register isCopyToExec (const MachineInstr &MI, const GCNSubtarget &ST)
 If MI is a copy to exec, return the register copied from. More...
 
static Register isLogicalOpOnExec (const MachineInstr &MI)
 If MI is a logical operation on an exec value, return the register copied to. More...
 
static unsigned getSaveExecOp (unsigned Opc)
 
static bool removeTerminatorBit (const SIInstrInfo &TII, MachineInstr &MI)
 
static MachineBasicBlock::reverse_iterator fixTerminators (const SIInstrInfo &TII, MachineBasicBlock &MBB)
 
static MachineBasicBlock::reverse_iterator findExecCopy (const SIInstrInfo &TII, const GCNSubtarget &ST, MachineBasicBlock &MBB, MachineBasicBlock::reverse_iterator I, unsigned CopyToExec)
 
static bool isLiveOut (const MachineBasicBlock &MBB, unsigned Reg)
 
static MachineInstrfindInstrBackwards (MachineInstr &Origin, std::function< bool(MachineInstr *)> Pred, ArrayRef< MCRegister > NonModifiableRegs, const SIRegisterInfo *TRI, unsigned MaxInstructions=20)
 
static bool isRegisterInUseBetween (MachineInstr &Stop, MachineInstr &Start, MCRegister Reg, const SIRegisterInfo *TRI, MachineRegisterInfo &MRI, bool useLiveOuts=false, bool ignoreStart=false)
 
static bool isRegisterInUseAfter (MachineInstr &Stop, MCRegister Reg, const SIRegisterInfo *TRI, MachineRegisterInfo &MRI)
 
static MachineInstrfindPossibleVCMPVCMPXOptimization (MachineInstr &SaveExec, MCRegister Exec, const SIRegisterInfo *TRI, const SIInstrInfo *TII, MachineRegisterInfo &MRI)
 
static bool optimizeVCMPSaveExecSequence (MachineInstr &SaveExecInstr, MachineInstr &VCmp, MCRegister Exec, const SIInstrInfo *TII, const SIRegisterInfo *TRI, MachineRegisterInfo &MRI)
 

Variables

 DEBUG_TYPE
 
SI optimize exec mask operations
 
SI optimize exec mask false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "si-optimize-exec-masking"

Definition at line 18 of file SIOptimizeExecMasking.cpp.

Function Documentation

◆ findExecCopy()

static MachineBasicBlock::reverse_iterator findExecCopy ( const SIInstrInfo TII,
const GCNSubtarget ST,
MachineBasicBlock MBB,
MachineBasicBlock::reverse_iterator  I,
unsigned  CopyToExec 
)
static

◆ findInstrBackwards()

static MachineInstr* findInstrBackwards ( MachineInstr Origin,
std::function< bool(MachineInstr *)>  Pred,
ArrayRef< MCRegister NonModifiableRegs,
const SIRegisterInfo TRI,
unsigned  MaxInstructions = 20 
)
static

◆ findPossibleVCMPVCMPXOptimization()

static MachineInstr* findPossibleVCMPVCMPXOptimization ( MachineInstr SaveExec,
MCRegister  Exec,
const SIRegisterInfo TRI,
const SIInstrInfo TII,
MachineRegisterInfo MRI 
)
static

◆ fixTerminators()

static MachineBasicBlock::reverse_iterator fixTerminators ( const SIInstrInfo TII,
MachineBasicBlock MBB 
)
static

◆ getSaveExecOp()

static unsigned getSaveExecOp ( unsigned  Opc)
static

Definition at line 135 of file SIOptimizeExecMasking.cpp.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( SIOptimizeExecMasking  ,
DEBUG_TYPE  ,
"SI optimize exec mask operations ,
false  ,
false   
)

◆ isCopyFromExec()

static Register isCopyFromExec ( const MachineInstr MI,
const GCNSubtarget ST 
)
static

If MI is a copy from exec, return the register copied to.

Definition at line 56 of file SIOptimizeExecMasking.cpp.

References MI, and llvm::ARM_MB::ST.

Referenced by findExecCopy().

◆ isCopyToExec()

static Register isCopyToExec ( const MachineInstr MI,
const GCNSubtarget ST 
)
static

If MI is a copy to exec, return the register copied from.

Definition at line 74 of file SIOptimizeExecMasking.cpp.

References llvm_unreachable, MI, and llvm::ARM_MB::ST.

◆ isLiveOut()

static bool isLiveOut ( const MachineBasicBlock MBB,
unsigned  Reg 
)
static

◆ isLogicalOpOnExec()

static Register isLogicalOpOnExec ( const MachineInstr MI)
static

If MI is a logical operation on an exec value, return the register copied to.

Definition at line 96 of file SIOptimizeExecMasking.cpp.

References llvm::MachineOperand::getReg(), llvm::MachineOperand::isReg(), and MI.

◆ isRegisterInUseAfter()

static bool isRegisterInUseAfter ( MachineInstr Stop,
MCRegister  Reg,
const SIRegisterInfo TRI,
MachineRegisterInfo MRI 
)
static

Definition at line 359 of file SIOptimizeExecMasking.cpp.

Referenced by findPossibleVCMPVCMPXOptimization().

◆ isRegisterInUseBetween()

static bool isRegisterInUseBetween ( MachineInstr Stop,
MachineInstr Start,
MCRegister  Reg,
const SIRegisterInfo TRI,
MachineRegisterInfo MRI,
bool  useLiveOuts = false,
bool  ignoreStart = false 
)
static

Definition at line 335 of file SIOptimizeExecMasking.cpp.

Referenced by findPossibleVCMPVCMPXOptimization().

◆ optimizeVCMPSaveExecSequence()

static bool optimizeVCMPSaveExecSequence ( MachineInstr SaveExecInstr,
MachineInstr VCmp,
MCRegister  Exec,
const SIInstrInfo TII,
const SIRegisterInfo TRI,
MachineRegisterInfo MRI 
)
static

◆ removeTerminatorBit()

static bool removeTerminatorBit ( const SIInstrInfo TII,
MachineInstr MI 
)
static

Definition at line 176 of file SIOptimizeExecMasking.cpp.

References MI, and TII.

Referenced by fixTerminators().

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 48 of file SIOptimizeExecMasking.cpp.

◆ false

SI optimize exec mask false

Definition at line 49 of file SIOptimizeExecMasking.cpp.

◆ operations

SI optimize exec mask operations

Definition at line 49 of file SIOptimizeExecMasking.cpp.