#include "VEISelLowering.h"
#include "MCTargetDesc/VEMCExpr.h"
#include "VECustomDAG.h"
#include "VEInstrBuilder.h"
#include "VEMachineFunctionInfo.h"
#include "VERegisterInfo.h"
#include "VETargetMachine.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
usingnamespacellvm;
#define DEBUG_TYPE …
#include "VEGenCallingConv.inc"
CCAssignFn *getReturnCC(CallingConv::ID CallConv) { … }
CCAssignFn *getParamCC(CallingConv::ID CallConv, bool IsVarArg) { … }
bool VETargetLowering::CanLowerReturn(
CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context) const { … }
static const MVT AllVectorVTs[] = …;
static const MVT AllMaskVTs[] = …;
static const MVT AllPackedVTs[] = …;
void VETargetLowering::initRegisterClasses() { … }
void VETargetLowering::initSPUActions() { … }
void VETargetLowering::initVPUActions() { … }
SDValue
VETargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
bool IsVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs,
const SmallVectorImpl<SDValue> &OutVals,
const SDLoc &DL, SelectionDAG &DAG) const { … }
SDValue VETargetLowering::LowerFormalArguments(
SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &DL,
SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals) const { … }
Register VETargetLowering::getRegisterByName(const char *RegName, LLT VT,
const MachineFunction &MF) const { … }
SDValue VETargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
SmallVectorImpl<SDValue> &InVals) const { … }
bool VETargetLowering::isOffsetFoldingLegal(
const GlobalAddressSDNode *GA) const { … }
bool VETargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
bool ForCodeSize) const { … }
bool VETargetLowering::allowsMisalignedMemoryAccesses(EVT VT,
unsigned AddrSpace,
Align A,
MachineMemOperand::Flags,
unsigned *Fast) const { … }
VETargetLowering::VETargetLowering(const TargetMachine &TM,
const VESubtarget &STI)
: … { … }
const char *VETargetLowering::getTargetNodeName(unsigned Opcode) const { … }
EVT VETargetLowering::getSetCCResultType(const DataLayout &, LLVMContext &,
EVT VT) const { … }
SDValue VETargetLowering::withTargetFlags(SDValue Op, unsigned TF,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::makeHiLoPair(SDValue Op, unsigned HiTF, unsigned LoTF,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::makeAddress(SDValue Op, SelectionDAG &DAG) const { … }
Instruction *VETargetLowering::emitLeadingFence(IRBuilderBase &Builder,
Instruction *Inst,
AtomicOrdering Ord) const { … }
Instruction *VETargetLowering::emitTrailingFence(IRBuilderBase &Builder,
Instruction *Inst,
AtomicOrdering Ord) const { … }
SDValue VETargetLowering::lowerATOMIC_FENCE(SDValue Op,
SelectionDAG &DAG) const { … }
TargetLowering::AtomicExpansionKind
VETargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const { … }
static SDValue prepareTS1AM(SDValue Op, SelectionDAG &DAG, SDValue &Flag,
SDValue &Bits) { … }
static SDValue finalizeTS1AM(SDValue Op, SelectionDAG &DAG, SDValue Data,
SDValue Bits) { … }
SDValue VETargetLowering::lowerATOMIC_SWAP(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerGlobalAddress(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerBlockAddress(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerConstantPool(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue
VETargetLowering::lowerToTLSGeneralDynamicModel(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerGlobalTLSAddress(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerJumpTable(SDValue Op, SelectionDAG &DAG) const { … }
static SDValue lowerLoadF128(SDValue Op, SelectionDAG &DAG) { … }
static SDValue lowerLoadI1(SDValue Op, SelectionDAG &DAG) { … }
SDValue VETargetLowering::lowerLOAD(SDValue Op, SelectionDAG &DAG) const { … }
static SDValue lowerStoreF128(SDValue Op, SelectionDAG &DAG) { … }
static SDValue lowerStoreI1(SDValue Op, SelectionDAG &DAG) { … }
SDValue VETargetLowering::lowerSTORE(SDValue Op, SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerVASTART(SDValue Op, SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerVAARG(SDValue Op, SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerDYNAMIC_STACKALLOC(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerEH_SJLJ_LONGJMP(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerEH_SJLJ_SETJMP(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerEH_SJLJ_SETUP_DISPATCH(SDValue Op,
SelectionDAG &DAG) const { … }
static SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG,
const VETargetLowering &TLI,
const VESubtarget *Subtarget) { … }
static SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG,
const VETargetLowering &TLI,
const VESubtarget *Subtarget) { … }
SDValue VETargetLowering::lowerINTRINSIC_WO_CHAIN(SDValue Op,
SelectionDAG &DAG) const { … }
static bool getUniqueInsertion(SDNode *N, unsigned &UniqueIdx) { … }
static SDValue getSplatValue(SDNode *N) { … }
SDValue VETargetLowering::lowerBUILD_VECTOR(SDValue Op,
SelectionDAG &DAG) const { … }
TargetLowering::LegalizeAction
VETargetLowering::getCustomOperationAction(SDNode &Op) const { … }
SDValue VETargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const { … }
void VETargetLowering::ReplaceNodeResults(SDNode *N,
SmallVectorImpl<SDValue> &Results,
SelectionDAG &DAG) const { … }
unsigned VETargetLowering::getJumpTableEncoding() const { … }
const MCExpr *VETargetLowering::LowerCustomJumpTableEntry(
const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB,
unsigned Uid, MCContext &Ctx) const { … }
SDValue VETargetLowering::getPICJumpTableRelocBase(SDValue Table,
SelectionDAG &DAG) const { … }
Register VETargetLowering::prepareMBB(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
MachineBasicBlock *TargetBB,
const DebugLoc &DL) const { … }
Register VETargetLowering::prepareSymbol(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
StringRef Symbol, const DebugLoc &DL,
bool IsLocal = false,
bool IsCall = false) const { … }
void VETargetLowering::setupEntryBlockForSjLj(MachineInstr &MI,
MachineBasicBlock *MBB,
MachineBasicBlock *DispatchBB,
int FI, int Offset) const { … }
MachineBasicBlock *
VETargetLowering::emitEHSjLjSetJmp(MachineInstr &MI,
MachineBasicBlock *MBB) const { … }
MachineBasicBlock *
VETargetLowering::emitEHSjLjLongJmp(MachineInstr &MI,
MachineBasicBlock *MBB) const { … }
MachineBasicBlock *
VETargetLowering::emitSjLjDispatchBlock(MachineInstr &MI,
MachineBasicBlock *BB) const { … }
MachineBasicBlock *
VETargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
MachineBasicBlock *BB) const { … }
static bool isSimm7(SDValue V) { … }
static bool isMImm(SDValue V) { … }
static unsigned decideComp(EVT SrcVT, ISD::CondCode CC) { … }
static EVT decideCompType(EVT SrcVT) { … }
static bool safeWithoutCompWithNull(EVT SrcVT, ISD::CondCode CC,
bool WithCMov) { … }
static SDValue generateComparison(EVT VT, SDValue LHS, SDValue RHS,
ISD::CondCode CC, bool WithCMov,
const SDLoc &DL, SelectionDAG &DAG) { … }
SDValue VETargetLowering::combineSelect(SDNode *N,
DAGCombinerInfo &DCI) const { … }
SDValue VETargetLowering::combineSelectCC(SDNode *N,
DAGCombinerInfo &DCI) const { … }
static bool isI32InsnAllUses(const SDNode *User, const SDNode *N);
static bool isI32Insn(const SDNode *User, const SDNode *N) { … }
static bool isI32InsnAllUses(const SDNode *User, const SDNode *N) { … }
SDValue VETargetLowering::combineTRUNCATE(SDNode *N,
DAGCombinerInfo &DCI) const { … }
SDValue VETargetLowering::PerformDAGCombine(SDNode *N,
DAGCombinerInfo &DCI) const { … }
VETargetLowering::ConstraintType
VETargetLowering::getConstraintType(StringRef Constraint) const { … }
std::pair<unsigned, const TargetRegisterClass *>
VETargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
StringRef Constraint,
MVT VT) const { … }
unsigned VETargetLowering::getMinimumJumpTableEntries() const { … }
bool VETargetLowering::hasAndNot(SDValue Y) const { … }
SDValue VETargetLowering::lowerEXTRACT_VECTOR_ELT(SDValue Op,
SelectionDAG &DAG) const { … }
SDValue VETargetLowering::lowerINSERT_VECTOR_ELT(SDValue Op,
SelectionDAG &DAG) const { … }