#include "PPC.h"
#include "PPCInstrInfo.h"
#include "PPCMachineFunctionInfo.h"
#include "PPCRegisterBankInfo.h"
#include "PPCSubtarget.h"
#include "PPCTargetMachine.h"
#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h"
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/IR/IntrinsicsPowerPC.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE …
usingnamespacellvm;
namespace {
#define GET_GLOBALISEL_PREDICATE_BITSET
#include "PPCGenGlobalISel.inc"
#undef GET_GLOBALISEL_PREDICATE_BITSET
class PPCInstructionSelector : public InstructionSelector { … };
}
#define GET_GLOBALISEL_IMPL
#include "PPCGenGlobalISel.inc"
#undef GET_GLOBALISEL_IMPL
PPCInstructionSelector::PPCInstructionSelector(const PPCTargetMachine &TM,
const PPCSubtarget &STI,
const PPCRegisterBankInfo &RBI)
: … { … }
static const TargetRegisterClass *getRegClass(LLT Ty, const RegisterBank *RB) { … }
static bool selectCopy(MachineInstr &I, const TargetInstrInfo &TII,
MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI,
const RegisterBankInfo &RBI) { … }
static unsigned selectLoadStoreOp(unsigned GenericOpc, unsigned RegBankID,
unsigned OpSize) { … }
bool PPCInstructionSelector::selectIntToFP(MachineInstr &I,
MachineBasicBlock &MBB,
MachineRegisterInfo &MRI) const { … }
bool PPCInstructionSelector::selectFPToInt(MachineInstr &I,
MachineBasicBlock &MBB,
MachineRegisterInfo &MRI) const { … }
bool PPCInstructionSelector::selectZExt(MachineInstr &I, MachineBasicBlock &MBB,
MachineRegisterInfo &MRI) const { … }
static uint32_t findContiguousZerosAtLeast(uint64_t Imm, unsigned Num) { … }
std::optional<bool> PPCInstructionSelector::selectI64ImmDirect(MachineInstr &I,
MachineBasicBlock &MBB,
MachineRegisterInfo &MRI,
Register Reg,
uint64_t Imm) const { … }
bool PPCInstructionSelector::selectI64Imm(MachineInstr &I,
MachineBasicBlock &MBB,
MachineRegisterInfo &MRI) const { … }
bool PPCInstructionSelector::selectConstantPool(
MachineInstr &I, MachineBasicBlock &MBB, MachineRegisterInfo &MRI) const { … }
bool PPCInstructionSelector::select(MachineInstr &I) { … }
namespace llvm {
InstructionSelector *
createPPCInstructionSelector(const PPCTargetMachine &TM,
const PPCSubtarget &Subtarget,
const PPCRegisterBankInfo &RBI) { … }
}