LLVM 20.0.0git
Macros | Functions
MicroMipsSizeReduction.cpp File Reference

This pass is used to reduce the size of instructions where applicable. More...

#include "Mips.h"
#include "MipsInstrInfo.h"
#include "MipsSubtarget.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/Support/Debug.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "micromips-reduce-size"
 
#define MICROMIPS_SIZE_REDUCE_NAME   "MicroMips instruction size reduce pass"
 

Functions

 STATISTIC (NumReduced, "Number of instructions reduced (32-bit to 16-bit ones, " "or two instructions into one")
 
 INITIALIZE_PASS (MicroMipsSizeReduce, DEBUG_TYPE, MICROMIPS_SIZE_REDUCE_NAME, false, false) static bool IsSP(const MachineOperand &MO)
 
static bool isMMThreeBitGPRegister (const MachineOperand &MO)
 
static bool isMMSourceRegister (const MachineOperand &MO)
 
static bool GetImm (MachineInstr *MI, unsigned Op, int64_t &Imm)
 
static bool AddiuspImmValue (int64_t Value)
 
static bool InRange (int64_t Value, unsigned short Shift, int LBound, int HBound)
 
static bool ImmInRange (MachineInstr *MI, const ReduceEntry &Entry)
 
static bool CheckXWPInstr (MachineInstr *MI, bool ReduceToLwp, const ReduceEntry &Entry)
 
static bool ConsecutiveRegisters (unsigned Reg1, unsigned Reg2)
 
static bool ConsecutiveInstr (MachineInstr *MI1, MachineInstr *MI2)
 
static bool IsMovepSrcRegister (unsigned Reg)
 
static bool IsMovepDestinationReg (unsigned Reg)
 
static bool IsMovepDestinationRegPair (unsigned R0, unsigned R1)
 

Detailed Description

This pass is used to reduce the size of instructions where applicable.

TODO: Implement microMIPS64 support.

Definition in file MicroMipsSizeReduction.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "micromips-reduce-size"

Definition at line 22 of file MicroMipsSizeReduction.cpp.

◆ MICROMIPS_SIZE_REDUCE_NAME

#define MICROMIPS_SIZE_REDUCE_NAME   "MicroMips instruction size reduce pass"

Definition at line 23 of file MicroMipsSizeReduction.cpp.

Function Documentation

◆ AddiuspImmValue()

static bool AddiuspImmValue ( int64_t  Value)
static

Definition at line 317 of file MicroMipsSizeReduction.cpp.

◆ CheckXWPInstr()

static bool CheckXWPInstr ( MachineInstr MI,
bool  ReduceToLwp,
const ReduceEntry &  Entry 
)
static

Definition at line 351 of file MicroMipsSizeReduction.cpp.

References ImmInRange(), and MI.

◆ ConsecutiveInstr()

static bool ConsecutiveInstr ( MachineInstr MI1,
MachineInstr MI2 
)
static

◆ ConsecutiveRegisters()

static bool ConsecutiveRegisters ( unsigned  Reg1,
unsigned  Reg2 
)
static

Definition at line 378 of file MicroMipsSizeReduction.cpp.

References Registers.

Referenced by ConsecutiveInstr().

◆ GetImm()

static bool GetImm ( MachineInstr MI,
unsigned  Op,
int64_t &  Imm 
)
static

Definition at line 308 of file MicroMipsSizeReduction.cpp.

References MI.

Referenced by ConsecutiveInstr(), llvm::ShapeT::deduceImm(), and ImmInRange().

◆ ImmInRange()

static bool ImmInRange ( MachineInstr MI,
const ReduceEntry &  Entry 
)
static

Definition at line 337 of file MicroMipsSizeReduction.cpp.

References GetImm(), InRange(), and MI.

Referenced by CheckXWPInstr().

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( MicroMipsSizeReduce  ,
DEBUG_TYPE  ,
MICROMIPS_SIZE_REDUCE_NAME  ,
false  ,
false   
) const &

Definition at line 282 of file MicroMipsSizeReduction.cpp.

◆ InRange()

static bool InRange ( int64_t  Value,
unsigned short  Shift,
int  LBound,
int  HBound 
)
static

◆ isMMSourceRegister()

static bool isMMSourceRegister ( const MachineOperand MO)
static

◆ isMMThreeBitGPRegister()

static bool isMMThreeBitGPRegister ( const MachineOperand MO)
static

◆ IsMovepDestinationReg()

static bool IsMovepDestinationReg ( unsigned  Reg)
static

Definition at line 585 of file MicroMipsSizeReduction.cpp.

◆ IsMovepDestinationRegPair()

static bool IsMovepDestinationRegPair ( unsigned  R0,
unsigned  R1 
)
static

Definition at line 596 of file MicroMipsSizeReduction.cpp.

◆ IsMovepSrcRegister()

static bool IsMovepSrcRegister ( unsigned  Reg)
static

Definition at line 573 of file MicroMipsSizeReduction.cpp.

◆ STATISTIC()

STATISTIC ( NumReduced  )