|
LLVM 24.0.0git
|
#include "MCTargetDesc/MipsBaseInfo.h"#include "Mips.h"#include "MipsRegisterInfo.h"#include "MipsSubtarget.h"#include "llvm/ADT/PointerUnion.h"#include "llvm/ADT/ScopedHashTable.h"#include "llvm/ADT/SmallVector.h"#include "llvm/CodeGen/MachineBasicBlock.h"#include "llvm/CodeGen/MachineDominators.h"#include "llvm/CodeGen/MachineFunction.h"#include "llvm/CodeGen/MachineFunctionAnalysisManager.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/MachineInstr.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/MachineOperand.h"#include "llvm/CodeGen/MachinePassManager.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/TargetInstrInfo.h"#include "llvm/CodeGen/TargetOpcodes.h"#include "llvm/CodeGen/TargetRegisterInfo.h"#include "llvm/CodeGen/TargetSubtargetInfo.h"#include "llvm/CodeGenTypes/MachineValueType.h"#include "llvm/IR/Analysis.h"#include "llvm/Support/Allocator.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/RecyclingAllocator.h"#include <cassert>#include <utility>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) |
| #define DEBUG_TYPE "optimize-mips-pic-call" |
Definition at line 45 of file MipsOptimizePICCall.cpp.
|
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().
|
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().
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().
Return the destination virtual register of the last instruction that loads from object Entry.
Definition at line 173 of file MipsOptimizePICCall.cpp.
|
static |
Return type of register Reg.
Definition at line 106 of file MipsOptimizePICCall.cpp.
References assert(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), Reg, and TRI.
Referenced by eraseGPOpnd(), and setCallTargetReg().
|
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().
|
static |
Definition at line 279 of file MipsOptimizePICCall.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::back(), Changed, llvm::SmallVectorTemplateCommon< T, typename >::empty(), F, llvm::DominatorTreeBase< NodeT, IsPostDom >::getRootNode(), llvm::MipsSubtarget::inMips16Mode(), MBBI, llvm::SmallVectorTemplateBase< T, bool >::pop_back(), and visitNode().
Referenced by llvm::MipsOptimizePICCallPass::run().
|
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().
|
static |
Visit MBB.
Definition at line 228 of file MipsOptimizePICCall.cpp.
References Changed, E(), eraseGPOpnd(), getCallTargetRegOpnd(), llvm::MipsSubtarget::getCLOpts(), getCount(), getReg(), llvm::MipsSubtarget::getRegisterInfo(), llvm::Mips::GP, I, incCntAndSetReg(), isCallViaRegister(), MBB, MBBI, N, Reg, setCallTargetReg(), llvm::MachineOperand::setIsDead(), llvm::MachineOperand::setReg(), and TRI.
Referenced by optimizePICCallsInFunction().