LLVM 24.0.0git
MipsOptimizePICCall.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "optimize-mips-pic-call"

Functions

static MachineOperand * getCallTargetRegOpnd (MachineInstr &MI)
 Return the first MachineOperand of MI if it is a used virtual register.
static MVT::SimpleValueType getRegTy (unsigned Reg, MachineFunction &MF)
 Return type of register Reg.
static void setCallTargetReg (MachineBasicBlock *MBB, MachineBasicBlock::iterator I)
 Do the following transformation:
static bool eraseGPOpnd (const MipsOptions &CLOpts, MachineInstr &MI)
 Search MI's operands for register GP and erase it.
static unsigned getCount (ValueType Entry, ScopedHTType &ScopedHT)
 Return the number of instructions that dominate the current instruction and load the function address from object Entry.
static unsigned getReg (ValueType Entry, ScopedHTType &ScopedHT)
 Return the destination virtual register of the last instruction that loads from object Entry.
static void incCntAndSetReg (ValueType Entry, unsigned Reg, ScopedHTType &ScopedHT)
 Update ScopedHT.
static bool isCallViaRegister (MachineInstr &MI, unsigned &Reg, ValueType &Val)
 Test if MI jumps to a function via a register.
static bool visitNode (MBBInfo &MBBI, ScopedHTType &ScopedHT)
 Visit MBB.
static bool optimizePICCallsInFunction (MachineFunction &F, function_ref< MachineDominatorTree *()> GetMDT)

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "optimize-mips-pic-call"

Definition at line 45 of file MipsOptimizePICCall.cpp.

Function Documentation

◆ eraseGPOpnd()

bool eraseGPOpnd ( const MipsOptions & CLOpts,
MachineInstr & MI )
static

Search MI's operands for register GP and erase it.

Definition at line 132 of file MipsOptimizePICCall.cpp.

References llvm::MachineOperand::getReg(), getRegTy(), llvm::Mips::GP, llvm::Mips::GP_64, I, llvm::MachineOperand::isReg(), llvm_unreachable, MI, and Reg.

Referenced by visitNode().

◆ getCallTargetRegOpnd()

MachineOperand * getCallTargetRegOpnd ( MachineInstr & MI)
static

Return the first MachineOperand of MI if it is a used virtual register.

Definition at line 93 of file MipsOptimizePICCall.cpp.

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

Referenced by isCallViaRegister(), and visitNode().

◆ getCount()

unsigned getCount ( ValueType Entry,
ScopedHTType & ScopedHT )
static

Return the number of instructions that dominate the current instruction and load the function address from object Entry.

Definition at line 167 of file MipsOptimizePICCall.cpp.

Referenced by llvm::pdb::PDBSymbolTypeFunctionSig::dumpArgList(), and visitNode().

◆ getReg()

unsigned getReg ( ValueType Entry,
ScopedHTType & ScopedHT )
static

Return the destination virtual register of the last instruction that loads from object Entry.

Definition at line 173 of file MipsOptimizePICCall.cpp.

References assert(), and Reg.

◆ getRegTy()

◆ incCntAndSetReg()

void incCntAndSetReg ( ValueType Entry,
unsigned Reg,
ScopedHTType & ScopedHT )
static

Update ScopedHT.

Definition at line 180 of file MipsOptimizePICCall.cpp.

References P, and Reg.

Referenced by visitNode().

◆ isCallViaRegister()

bool isCallViaRegister ( MachineInstr & MI,
unsigned & Reg,
ValueType & Val )
static

Test if MI jumps to a function via a register.

Also, return the virtual register containing the target function's address and the underlying object in Reg and Val respectively, if the function's address can be resolved lazily.

Definition at line 191 of file MipsOptimizePICCall.cpp.

References assert(), DefMI, getCallTargetRegOpnd(), llvm::MachineOperand::getReg(), MI, llvm::MipsII::MO_CALL_LO16, llvm::MipsII::MO_GOT_CALL, MRI, and Reg.

Referenced by visitNode().

◆ optimizePICCallsInFunction()

◆ setCallTargetReg()

void setCallTargetReg ( MachineBasicBlock * MBB,
MachineBasicBlock::iterator I )
static

Do the following transformation:

jalr $vreg => copy $t9, $vreg jalr $t9

Definition at line 119 of file MipsOptimizePICCall.cpp.

References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::TargetSubtargetInfo::getInstrInfo(), getRegTy(), llvm::MachineFunction::getSubtarget(), I, MBB, and TII.

Referenced by visitNode().

◆ visitNode()