#include "MipsInstrInfo.h"
#include "MCTargetDesc/MipsBaseInfo.h"
#include "MCTargetDesc/MipsMCTargetDesc.h"
#include "Mips.h"
#include "MipsSubtarget.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
usingnamespacellvm;
#define GET_INSTRINFO_CTOR_DTOR
#include "MipsGenInstrInfo.inc"
void MipsInstrInfo::anchor() { … }
MipsInstrInfo::MipsInstrInfo(const MipsSubtarget &STI, unsigned UncondBr)
: … { … }
const MipsInstrInfo *MipsInstrInfo::create(MipsSubtarget &STI) { … }
bool MipsInstrInfo::isZeroImm(const MachineOperand &op) const { … }
void MipsInstrInfo::
insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const
{ … }
MachineInstrBuilder MipsInstrInfo::insertNop(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
DebugLoc DL) const { … }
MachineMemOperand *
MipsInstrInfo::GetMemOperand(MachineBasicBlock &MBB, int FI,
MachineMemOperand::Flags Flags) const { … }
void MipsInstrInfo::AnalyzeCondBr(const MachineInstr *Inst, unsigned Opc,
MachineBasicBlock *&BB,
SmallVectorImpl<MachineOperand> &Cond) const { … }
bool MipsInstrInfo::analyzeBranch(MachineBasicBlock &MBB,
MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
SmallVectorImpl<MachineOperand> &Cond,
bool AllowModify) const { … }
void MipsInstrInfo::BuildCondBr(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
const DebugLoc &DL,
ArrayRef<MachineOperand> Cond) const { … }
unsigned MipsInstrInfo::insertBranch(MachineBasicBlock &MBB,
MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
ArrayRef<MachineOperand> Cond,
const DebugLoc &DL,
int *BytesAdded) const { … }
unsigned MipsInstrInfo::removeBranch(MachineBasicBlock &MBB,
int *BytesRemoved) const { … }
bool MipsInstrInfo::reverseBranchCondition(
SmallVectorImpl<MachineOperand> &Cond) const { … }
MipsInstrInfo::BranchType MipsInstrInfo::analyzeBranch(
MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB,
SmallVectorImpl<MachineOperand> &Cond, bool AllowModify,
SmallVectorImpl<MachineInstr *> &BranchInstrs) const { … }
bool MipsInstrInfo::isBranchOffsetInRange(unsigned BranchOpc,
int64_t BrOffset) const { … }
unsigned MipsInstrInfo::getEquivalentCompactForm(
const MachineBasicBlock::iterator I) const { … }
bool MipsInstrInfo::SafeAfterMflo(const MachineInstr &MI) const { … }
bool MipsInstrInfo::SafeInForbiddenSlot(const MachineInstr &MI) const { … }
bool MipsInstrInfo::SafeInFPUDelaySlot(const MachineInstr &MIInSlot,
const MachineInstr &FPUMI) const { … }
bool MipsInstrInfo::SafeInLoadDelaySlot(const MachineInstr &MIInSlot,
const MachineInstr &LoadMI) const { … }
bool MipsInstrInfo::IsMfloOrMfhi(const MachineInstr &MI) const { … }
bool MipsInstrInfo::HasForbiddenSlot(const MachineInstr &MI) const { … }
bool MipsInstrInfo::HasFPUDelaySlot(const MachineInstr &MI) const { … }
bool MipsInstrInfo::HasLoadDelaySlot(const MachineInstr &MI) const { … }
unsigned MipsInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const { … }
MachineInstrBuilder
MipsInstrInfo::genInstrWithNewOpc(unsigned NewOpc,
MachineBasicBlock::iterator I) const { … }
bool MipsInstrInfo::findCommutedOpIndices(const MachineInstr &MI,
unsigned &SrcOpIdx1,
unsigned &SrcOpIdx2) const { … }
static bool verifyInsExtInstruction(const MachineInstr &MI, StringRef &ErrInfo,
const int64_t PosLow, const int64_t PosHigh,
const int64_t SizeLow,
const int64_t SizeHigh,
const int64_t BothLow,
const int64_t BothHigh) { … }
bool MipsInstrInfo::verifyInstruction(const MachineInstr &MI,
StringRef &ErrInfo) const { … }
std::pair<unsigned, unsigned>
MipsInstrInfo::decomposeMachineOperandsTargetFlags(unsigned TF) const { … }
ArrayRef<std::pair<unsigned, const char*>>
MipsInstrInfo::getSerializableDirectMachineOperandTargetFlags() const { … }
std::optional<ParamLoadedValue>
MipsInstrInfo::describeLoadedValue(const MachineInstr &MI, Register Reg) const { … }
std::optional<RegImmPair> MipsInstrInfo::isAddImmediate(const MachineInstr &MI,
Register Reg) const { … }