#include "MipsTargetMachine.h"
#include "MCTargetDesc/MipsABIInfo.h"
#include "MCTargetDesc/MipsMCTargetDesc.h"
#include "Mips.h"
#include "Mips16ISelDAGToDAG.h"
#include "MipsMachineFunction.h"
#include "MipsSEISelDAGToDAG.h"
#include "MipsSubtarget.h"
#include "MipsTargetObjectFile.h"
#include "MipsTargetTransformInfo.h"
#include "TargetInfo/MipsTargetInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/BasicTTIImpl.h"
#include "llvm/CodeGen/GlobalISel/CSEInfo.h"
#include "llvm/CodeGen/GlobalISel/IRTranslator.h"
#include "llvm/CodeGen/GlobalISel/InstructionSelect.h"
#include "llvm/CodeGen/GlobalISel/Legalizer.h"
#include "llvm/CodeGen/GlobalISel/RegBankSelect.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Function.h"
#include "llvm/InitializePasses.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetOptions.h"
#include <optional>
#include <string>
usingnamespacellvm;
#define DEBUG_TYPE …
static cl::opt<bool>
EnableMulMulFix("mfix4300", cl::init(false),
cl::desc("Enable the VR4300 mulmul bug fix."), cl::Hidden);
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsTarget() { … }
static std::string computeDataLayout(const Triple &TT, StringRef CPU,
const TargetOptions &Options,
bool isLittle) { … }
static Reloc::Model getEffectiveRelocModel(bool JIT,
std::optional<Reloc::Model> RM) { … }
MipsTargetMachine::MipsTargetMachine(const Target &T, const Triple &TT,
StringRef CPU, StringRef FS,
const TargetOptions &Options,
std::optional<Reloc::Model> RM,
std::optional<CodeModel::Model> CM,
CodeGenOptLevel OL, bool JIT,
bool isLittle)
: … { … }
MipsTargetMachine::~MipsTargetMachine() = default;
void MipsebTargetMachine::anchor() { … }
MipsebTargetMachine::MipsebTargetMachine(const Target &T, const Triple &TT,
StringRef CPU, StringRef FS,
const TargetOptions &Options,
std::optional<Reloc::Model> RM,
std::optional<CodeModel::Model> CM,
CodeGenOptLevel OL, bool JIT)
: … { … }
void MipselTargetMachine::anchor() { … }
MipselTargetMachine::MipselTargetMachine(const Target &T, const Triple &TT,
StringRef CPU, StringRef FS,
const TargetOptions &Options,
std::optional<Reloc::Model> RM,
std::optional<CodeModel::Model> CM,
CodeGenOptLevel OL, bool JIT)
: … { … }
const MipsSubtarget *
MipsTargetMachine::getSubtargetImpl(const Function &F) const { … }
void MipsTargetMachine::resetSubtarget(MachineFunction *MF) { … }
namespace {
class MipsPassConfig : public TargetPassConfig { … };
}
TargetPassConfig *MipsTargetMachine::createPassConfig(PassManagerBase &PM) { … }
std::unique_ptr<CSEConfigBase> MipsPassConfig::getCSEConfig() const { … }
void MipsPassConfig::addIRPasses() { … }
bool MipsPassConfig::addInstSelector() { … }
void MipsPassConfig::addPreRegAlloc() { … }
TargetTransformInfo
MipsTargetMachine::getTargetTransformInfo(const Function &F) const { … }
MachineFunctionInfo *MipsTargetMachine::createMachineFunctionInfo(
BumpPtrAllocator &Allocator, const Function &F,
const TargetSubtargetInfo *STI) const { … }
void MipsPassConfig::addPreEmitPass() { … }
bool MipsPassConfig::addIRTranslator() { … }
void MipsPassConfig::addPreLegalizeMachineIR() { … }
bool MipsPassConfig::addLegalizeMachineIR() { … }
void MipsPassConfig::addPreRegBankSelect() { … }
bool MipsPassConfig::addRegBankSelect() { … }
bool MipsPassConfig::addGlobalInstructionSelect() { … }