LLVM  13.0.0git
Macros | Functions | Variables
RISCVCleanupVSETVLI.cpp File Reference
#include "RISCV.h"
#include "RISCVSubtarget.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
Include dependency graph for RISCVCleanupVSETVLI.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "riscv-cleanup-vsetvli"
 
#define RISCV_CLEANUP_VSETVLI_NAME   "RISCV Cleanup VSETVLI pass"
 

Functions

 INITIALIZE_PASS (RISCVCleanupVSETVLI, DEBUG_TYPE, RISCV_CLEANUP_VSETVLI_NAME, false, false) static bool isRedundantVSETVLI(MachineInstr &MI
 
 if (PrevVTYPEImm !=VTYPEImm) return false
 
 if (MI.getOpcode()==RISCV::PseudoVSETIVLI)
 
 assert (MI.getOpcode()==RISCV::PseudoVSETVLI)
 
 if (AVLReg==RISCV::X0 &&MI.getOperand(0).getReg()==RISCV::X0) return true
 
 if (AVLReg.isVirtual() &&AVLReg==PrevOutVL) return true
 
 if (PrevVSETVLI->getOpcode() !=RISCV::PseudoVSETVLI) return false
 
 if (AVLReg !=PrevVSETVLI->getOperand(1).getReg()) return false
 

Variables

MachineInstrPrevVSETVLI
 
int64_t PrevVTYPEImm = PrevVSETVLI->getOperand(2).getImm()
 
int64_t VTYPEImm = MI.getOperand(2).getImm()
 
Register AVLReg = MI.getOperand(1).getReg()
 
Register PrevOutVL = PrevVSETVLI->getOperand(0).getReg()
 
return true
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "riscv-cleanup-vsetvli"

Definition at line 19 of file RISCVCleanupVSETVLI.cpp.

◆ RISCV_CLEANUP_VSETVLI_NAME

#define RISCV_CLEANUP_VSETVLI_NAME   "RISCV Cleanup VSETVLI pass"

Definition at line 20 of file RISCVCleanupVSETVLI.cpp.

Function Documentation

◆ assert()

assert ( MI.  getOpcode() = =RISCV::PseudoVSETVLI)

◆ if() [1/6]

if ( AVLReg = PrevVSETVLI->getOperand(1).getReg())

◆ if() [2/6]

if ( AVLReg.isVirtual() &&  AVLReg = =PrevOutVL)

◆ if() [3/6]

if ( AVLReg  = = RISCV::X0 && MI.getOperand(0).getReg() == RISCV::X0)

Definition at line 101 of file RISCVCleanupVSETVLI.cpp.

References PrevOutVL.

◆ if() [4/6]

if ( MI.  getOpcode() = = RISCV::PseudoVSETIVLI)

◆ if() [5/6]

if ( PrevVSETVLI->getOpcode() !  = RISCV::PseudoVSETVLI)

◆ if() [6/6]

if ( PrevVTYPEImm = VTYPEImm)

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( RISCVCleanupVSETVLI  ,
DEBUG_TYPE  ,
RISCV_CLEANUP_VSETVLI_NAME  ,
false  ,
false   
) &

Variable Documentation

◆ AVLReg

Register AVLReg = MI.getOperand(1).getReg()

Definition at line 77 of file RISCVCleanupVSETVLI.cpp.

◆ PrevOutVL

Register PrevOutVL = PrevVSETVLI->getOperand(0).getReg()

Definition at line 78 of file RISCVCleanupVSETVLI.cpp.

Referenced by if().

◆ PrevVSETVLI

MachineInstr* PrevVSETVLI
Initial value:
{
if (!PrevVSETVLI || !MI.getOperand(0).isDead())
return false

Definition at line 55 of file RISCVCleanupVSETVLI.cpp.

Referenced by if().

◆ PrevVTYPEImm

int64_t PrevVTYPEImm = PrevVSETVLI->getOperand(2).getImm()

Definition at line 62 of file RISCVCleanupVSETVLI.cpp.

◆ true

return true

Definition at line 109 of file RISCVCleanupVSETVLI.cpp.

◆ VTYPEImm

int64_t VTYPEImm = MI.getOperand(2).getImm()

Definition at line 63 of file RISCVCleanupVSETVLI.cpp.

MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:100
PrevVSETVLI
MachineInstr * PrevVSETVLI
Definition: RISCVCleanupVSETVLI.cpp:55