#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/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineOperand.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/Support/Allocator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/RecyclingAllocator.h"
#include <cassert>
#include <utility>
usingnamespacellvm;
#define DEBUG_TYPE …
static cl::opt<bool> LoadTargetFromGOT("mips-load-target-from-got",
cl::init(true),
cl::desc("Load target address from GOT"),
cl::Hidden);
static cl::opt<bool> EraseGPOpnd("mips-erase-gp-opnd",
cl::init(true), cl::desc("Erase GP Operand"),
cl::Hidden);
namespace {
ValueType;
CntRegP;
AllocatorTy;
ScopedHTType;
class MBBInfo { … };
class OptimizePICCall : public MachineFunctionPass { … };
}
char OptimizePICCall::ID = …;
static MachineOperand *getCallTargetRegOpnd(MachineInstr &MI) { … }
static MVT::SimpleValueType getRegTy(unsigned Reg, MachineFunction &MF) { … }
static void setCallTargetReg(MachineBasicBlock *MBB,
MachineBasicBlock::iterator I) { … }
static void eraseGPOpnd(MachineInstr &MI) { … }
MBBInfo::MBBInfo(MachineDomTreeNode *N) : … { … }
const MachineDomTreeNode *MBBInfo::getNode() const { … }
bool MBBInfo::isVisited() const { … }
void MBBInfo::preVisit(ScopedHTType &ScopedHT) { … }
void MBBInfo::postVisit() { … }
bool OptimizePICCall::runOnMachineFunction(MachineFunction &F) { … }
bool OptimizePICCall::visitNode(MBBInfo &MBBI) { … }
bool OptimizePICCall::isCallViaRegister(MachineInstr &MI, unsigned &Reg,
ValueType &Val) const { … }
unsigned OptimizePICCall::getCount(ValueType Entry) { … }
unsigned OptimizePICCall::getReg(ValueType Entry) { … }
void OptimizePICCall::incCntAndSetReg(ValueType Entry, unsigned Reg) { … }
FunctionPass *llvm::createMipsOptimizePICCallPass() { … }