|
LLVM
5.0.0
|
Custom DAG lowering for SI. More...
#include "SIISelLowering.h"#include "AMDGPU.h"#include "AMDGPUIntrinsicInfo.h"#include "AMDGPUSubtarget.h"#include "AMDGPUTargetMachine.h"#include "SIDefines.h"#include "SIInstrInfo.h"#include "SIMachineFunctionInfo.h"#include "SIRegisterInfo.h"#include "Utils/AMDGPUBaseInfo.h"#include "llvm/ADT/APFloat.h"#include "llvm/ADT/APInt.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/BitVector.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/StringRef.h"#include "llvm/ADT/StringSwitch.h"#include "llvm/ADT/Twine.h"#include "llvm/CodeGen/Analysis.h"#include "llvm/CodeGen/CallingConvLower.h"#include "llvm/CodeGen/DAGCombine.h"#include "llvm/CodeGen/ISDOpcodes.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/MachineMemOperand.h"#include "llvm/CodeGen/MachineOperand.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/MachineValueType.h"#include "llvm/CodeGen/SelectionDAG.h"#include "llvm/CodeGen/SelectionDAGNodes.h"#include "llvm/CodeGen/ValueTypes.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/DebugLoc.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/DiagnosticInfo.h"#include "llvm/IR/Function.h"#include "llvm/IR/GlobalValue.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/Type.h"#include "llvm/Support/Casting.h"#include "llvm/Support/CodeGen.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Compiler.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/KnownBits.h"#include "llvm/Support/MathExtras.h"#include "llvm/Target/TargetCallingConv.h"#include "llvm/Target/TargetOptions.h"#include "llvm/Target/TargetRegisterInfo.h"#include <cassert>#include <cmath>#include <cstdint>#include <iterator>#include <tuple>#include <utility>#include <vector>Go to the source code of this file.
Variables | |
| static cl::opt< bool > | EnableVGPRIndexMode ("amdgpu-vgpr-index-mode", cl::desc("Use GPR indexing mode instead of movrel for vector indexing"), cl::init(false)) |
Custom DAG lowering for SI.
Definition in file SIISelLowering.cpp.
|
static |
Definition at line 1068 of file SIISelLowering.cpp.
References llvm::SIMachineFunctionInfo::addDispatchID(), llvm::SIMachineFunctionInfo::addDispatchPtr(), llvm::SIMachineFunctionInfo::addFlatScratchInit(), llvm::SIMachineFunctionInfo::addImplicitBufferPtr(), llvm::SIMachineFunctionInfo::addKernargSegmentPtr(), llvm::MachineFunction::addLiveIn(), llvm::SIMachineFunctionInfo::addPrivateSegmentBuffer(), llvm::SIMachineFunctionInfo::addQueuePtr(), llvm::CCState::AllocateReg(), llvm::SIMachineFunctionInfo::hasDispatchID(), llvm::SIMachineFunctionInfo::hasDispatchPtr(), llvm::SIMachineFunctionInfo::hasFlatScratchInit(), llvm::SIMachineFunctionInfo::hasImplicitBufferPtr(), llvm::SIMachineFunctionInfo::hasKernargSegmentPtr(), llvm::SIMachineFunctionInfo::hasPrivateSegmentBuffer(), and llvm::SIMachineFunctionInfo::hasQueuePtr().
Referenced by llvm::SITargetLowering::LowerFormalArguments().
|
static |
Definition at line 1044 of file SIISelLowering.cpp.
References llvm::MachineFunction::addLiveIn(), llvm::CCState::AllocateReg(), llvm::SIRegisterInfo::getPreloadedValue(), llvm::SIMachineFunctionInfo::hasWorkItemIDX(), llvm::SIMachineFunctionInfo::hasWorkItemIDY(), llvm::SIMachineFunctionInfo::hasWorkItemIDZ(), llvm::SIRegisterInfo::WORKITEM_ID_X, llvm::SIRegisterInfo::WORKITEM_ID_Y, and llvm::SIRegisterInfo::WORKITEM_ID_Z.
Referenced by llvm::SITargetLowering::LowerFormalArguments().
|
static |
Definition at line 1120 of file SIISelLowering.cpp.
References llvm::MachineFunction::addLiveIn(), llvm::SIMachineFunctionInfo::addPrivateSegmentWaveByteOffset(), llvm::SIMachineFunctionInfo::addWorkGroupIDX(), llvm::SIMachineFunctionInfo::addWorkGroupIDY(), llvm::SIMachineFunctionInfo::addWorkGroupIDZ(), llvm::SIMachineFunctionInfo::addWorkGroupInfo(), llvm::CCState::AllocateReg(), findFirstFreeSGPR(), llvm::SIMachineFunctionInfo::getPrivateSegmentWaveByteOffsetSystemSGPR(), llvm::SIMachineFunctionInfo::hasPrivateSegmentWaveByteOffset(), llvm::SIMachineFunctionInfo::hasWorkGroupIDX(), llvm::SIMachineFunctionInfo::hasWorkGroupIDY(), llvm::SIMachineFunctionInfo::hasWorkGroupIDZ(), llvm::SIMachineFunctionInfo::hasWorkGroupInfo(), and llvm::SIMachineFunctionInfo::setPrivateSegmentWaveByteOffset().
Referenced by llvm::SITargetLowering::LowerFormalArguments().
Definition at line 4284 of file SIISelLowering.cpp.
References llvm::ISD::AND, llvm::ISD::OR, and llvm::ISD::XOR.
|
static |
Definition at line 2875 of file SIISelLowering.cpp.
References llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getTargetGlobalAddress(), llvm::MVT::i32, llvm::SIInstrInfo::MO_NONE, and llvm::AMDGPUISD::PC_ADD_REL_OFFSET.
|
static |
Definition at line 5679 of file SIISelLowering.cpp.
References llvm::SelectionDAG::getMachineNode(), llvm::SelectionDAG::getTargetConstant(), and llvm::MVT::i32.
Referenced by llvm::SITargetLowering::buildRSRC(), and llvm::SITargetLowering::wrapAddr64Rsrc().
|
static |
Return true if the given offset Size in bytes can be folded into the immediate offsets of a memory instruction for the given address space.
Definition at line 4192 of file SIISelLowering.cpp.
References llvm::AMDGPUTargetLowering::AMDGPUASI, AMDGPUAS::CONSTANT_ADDRESS, llvm::AMDGPUSubtarget::getAMDGPUAS(), llvm::AMDGPUSubtarget::getGeneration(), AMDGPUAS::GLOBAL_ADDRESS, llvm::isUInt< 16 >(), llvm::isUInt< 8 >(), AMDGPUAS::LOCAL_ADDRESS, AMDGPUAS::REGION_ADDRESS, and llvm::AMDGPUSubtarget::VOLCANIC_ISLANDS.
|
static |
Definition at line 1821 of file SIISelLowering.cpp.
Referenced by emitIndirectDst(), and emitIndirectSrc().
|
static |
Definition at line 1992 of file SIISelLowering.cpp.
References llvm::ARM_AM::add, llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), llvm::MachineRegisterInfo::clearKillFlags(), computeIndirectRegAndOffset(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::RegState::Define, llvm::VGPRIndexMode::DST_ENABLE, EnableVGPRIndexMode, llvm::MachineInstr::eraseFromParent(), llvm::MachineInstr::getDebugLoc(), llvm::MachineOperand::getImm(), llvm::SISubtarget::getInstrInfo(), getMOVRELDPseudo(), llvm::SIInstrInfo::getNamedOperand(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::SIInstrInfo::getRegisterInfo(), I, llvm::RegState::Implicit, llvm::RegState::ImplicitDefine, llvm::MachineOperand::isReg(), loadM0FromVGPR(), llvm::MachineOperand::setIsUndef(), setM0ToIndexFromSGPR(), SubReg, TII, llvm::RegState::Undef, and llvm::SISubtarget::useVGPRIndexMode().
Referenced by llvm::SITargetLowering::EmitInstrWithCustomInserter().
|
static |
Definition at line 1893 of file SIISelLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), computeIndirectRegAndOffset(), llvm::MachineRegisterInfo::createVirtualRegister(), EnableVGPRIndexMode, llvm::MachineInstr::eraseFromParent(), llvm::MachineInstr::getDebugLoc(), llvm::MachineOperand::getImm(), llvm::SISubtarget::getInstrInfo(), llvm::SIInstrInfo::getNamedOperand(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::SIInstrInfo::getRegisterInfo(), I, llvm::RegState::Implicit, loadM0FromVGPR(), llvm::MachineOperand::setIsUndef(), setM0ToIndexFromSGPR(), llvm::VGPRIndexMode::SRC0_ENABLE, SubReg, TII, llvm::RegState::Undef, and llvm::SISubtarget::useVGPRIndexMode().
Referenced by llvm::SITargetLowering::EmitInstrWithCustomInserter().
|
static |
Definition at line 1670 of file SIISelLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getSubReg(), llvm::getUndefRegState(), I, llvm::MachineOperand::isUndef(), llvm::RegState::Kill, llvm::MachineOperand::setIsUndef(), and llvm::MachineRegisterInfo::setSimpleHint().
Referenced by loadM0FromVGPR().
|
static |
Definition at line 2978 of file SIISelLowering.cpp.
References llvm::LLVMContext::diagnose(), llvm::SelectionDAG::getContext(), llvm::SDLoc::getDebugLoc(), llvm::MachineFunction::getFunction(), llvm::SelectionDAG::getMachineFunction(), and llvm::SelectionDAG::getUNDEF().
|
static |
Definition at line 2987 of file SIISelLowering.cpp.
References llvm::LLVMContext::diagnose(), llvm::SelectionDAG::getContext(), llvm::SDLoc::getDebugLoc(), llvm::MachineFunction::getFunction(), llvm::SelectionDAG::getMachineFunction(), and llvm::SelectionDAG::getUNDEF().
Definition at line 91 of file SIISelLowering.cpp.
References llvm::CCState::isAllocated(), and llvm_unreachable().
Referenced by allocateSystemSGPRs().
Helper function for LowerBRCOND.
Definition at line 2422 of file SIISelLowering.cpp.
References E, llvm::SDValue::getNode(), I, llvm::SDNode::use_begin(), and llvm::SDNode::use_end().
Definition at line 4529 of file SIISelLowering.cpp.
References llvm::AMDGPUISD::CLAMP, llvm::AMDGPUISD::COS_HW, llvm::ISD::FABS, llvm::ISD::FADD, llvm::ISD::FCANONICALIZE, llvm::ISD::FCEIL, llvm::ISD::FCOS, llvm::ISD::FDIV, llvm::ISD::FEXP, llvm::ISD::FEXP2, llvm::ISD::FFLOOR, llvm::ISD::FLOG, llvm::ISD::FLOG10, llvm::ISD::FLOG2, llvm::ISD::FMA, llvm::ISD::FMAD, llvm::AMDGPUISD::FMAD_FTZ, llvm::AMDGPUISD::FMAX3, llvm::ISD::FMAXNUM, llvm::AMDGPUISD::FMED3, llvm::AMDGPUISD::FMIN3, llvm::ISD::FMINNUM, llvm::ISD::FMUL, llvm::ISD::FNEARBYINT, llvm::ISD::FP_ROUND, llvm::ISD::FPOW, llvm::ISD::FPOWI, llvm::AMDGPUISD::FRACT, llvm::ISD::FREM, llvm::ISD::FRINT, llvm::ISD::FROUND, llvm::ISD::FSIN, llvm::ISD::FSQRT, llvm::ISD::FSUB, llvm::ISD::FTRUNC, llvm::AMDGPUISD::LDEXP, llvm::AMDGPUISD::RCP, llvm::AMDGPUISD::RSQ, llvm::AMDGPUISD::SIN_HW, llvm::ISD::SINT_TO_FP, and llvm::ISD::UINT_TO_FP.
|
static |
Definition at line 3788 of file SIISelLowering.cpp.
References A, assert(), B, llvm::ISD::FMUL, llvm::AMDGPUISD::FMUL_W_CHAIN, llvm::SelectionDAG::getNode(), llvm::SDNode::getNumValues(), llvm::SDValue::getValue(), llvm::SelectionDAG::getVTList(), llvm::MVT::Glue, llvm_unreachable(), and llvm::MVT::Other.
|
static |
Definition at line 3808 of file SIISelLowering.cpp.
References A, assert(), B, C, llvm::ISD::FMA, llvm::AMDGPUISD::FMA_W_CHAIN, llvm::SelectionDAG::getNode(), llvm::SDNode::getNumValues(), llvm::SDValue::getValue(), llvm::SelectionDAG::getVTList(), llvm::MVT::Glue, llvm_unreachable(), and llvm::MVT::Other.
|
static |
Definition at line 1974 of file SIISelLowering.cpp.
References llvm_unreachable().
Referenced by emitIndirectDst().
Definition at line 4319 of file SIISelLowering.cpp.
References llvm::ISD::AND, llvm::AMDGPUISD::FP_CLASS, llvm::SDValue::getOpcode(), llvm::SDValue::getValueType(), llvm::MVT::i1, llvm::ISD::OR, llvm::ISD::SETCC, and llvm::ISD::XOR.
|
static |
Definition at line 4632 of file SIISelLowering.cpp.
References llvm::ISD::ConstantFP, F, llvm::MVT::f16, llvm::ISD::FABS, llvm::ISD::FADD, llvm::ISD::FCANONICALIZE, llvm::ISD::FCEIL, llvm::ISD::FCOS, llvm::ISD::FFLOOR, llvm::ISD::FMA, llvm::ISD::FMAD, llvm::ISD::FMAXNAN, llvm::ISD::FMAXNUM, llvm::ISD::FMINNAN, llvm::ISD::FMINNUM, llvm::ISD::FMUL, llvm::ISD::FNEG, llvm::ISD::FP16_TO_FP, llvm::ISD::FP_EXTEND, llvm::ISD::FP_ROUND, llvm::ISD::FP_TO_FP16, llvm::ISD::FSIN, llvm::ISD::FSINCOS, llvm::ISD::FSQRT, llvm::ISD::FSUB, llvm::SDValue::getOpcode(), llvm::SDValue::getOperand(), llvm::EVT::getScalarType(), llvm::SDValue::getValueType(), llvm::AMDGPUSubtarget::hasFP16Denormals(), llvm::SelectionDAG::isKnownNeverNaN(), MaxDepth, llvm::ARM_MB::ST, and llvm::AMDGPUSubtarget::supportsMinMaxDenormModes().
Definition at line 4930 of file SIISelLowering.cpp.
Definition at line 810 of file SIISelLowering.cpp.
References AMDGPUAS::CONSTANT_ADDRESS, AMDGPUAS::FLAT_ADDRESS, and AMDGPUAS::GLOBAL_ADDRESS.
Referenced by llvm::SITargetLowering::isNoopAddrSpaceCast().
Definition at line 5531 of file SIISelLowering.cpp.
References llvm::ISD::AssertZext, llvm::SDValue::getOpcode(), and llvm::SDValue::getOperand().
Referenced by llvm::SITargetLowering::legalizeTargetIndependentNode().
|
static |
Definition at line 4625 of file SIISelLowering.cpp.
References llvm::SelectionDAG::getTargetLoweringInfo(), llvm::TargetLoweringBase::hasFloatingPointExceptions(), and llvm::SelectionDAG::isKnownNeverNaN().
|
static |
Definition at line 1765 of file SIISelLowering.cpp.
References llvm::MachineBasicBlock::addSuccessor(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::MachineRegisterInfo::createVirtualRegister(), emitLoadM0FromVGPRLoop(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::getDebugLoc(), llvm::SIInstrInfo::getNamedOperand(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), I, llvm::MachineFunction::insert(), llvm::MachineBasicBlock::splice(), and llvm::MachineBasicBlock::transferSuccessorsAndUpdatePHIs().
Referenced by emitIndirectDst(), and emitIndirectSrc().
Definition at line 4764 of file SIISelLowering.cpp.
References llvm::AMDGPUISD::FMAX3, llvm::ISD::FMAXNUM, llvm::AMDGPUISD::FMIN3, llvm::ISD::FMINNUM, llvm_unreachable(), llvm::ISD::SMAX, llvm::AMDGPUISD::SMAX3, llvm::ISD::SMIN, llvm::AMDGPUISD::SMIN3, llvm::ISD::UMAX, llvm::AMDGPUISD::UMAX3, llvm::ISD::UMIN, and llvm::AMDGPUISD::UMIN3.
|
static |
Definition at line 994 of file SIISelLowering.cpp.
References llvm::CallingConv::AMDGPU_PS, E, llvm::ISD::InputArg::Flags, llvm::ISD::InputArg::getOrigArgIndex(), llvm::FunctionType::getParamType(), llvm::MVT::getStoreSize(), llvm::MVT::getVectorElementType(), llvm::Type::getVectorNumElements(), I, llvm::ISD::ArgFlagsTy::isByVal(), llvm::ISD::ArgFlagsTy::isInReg(), llvm::SIMachineFunctionInfo::isPSInputAllocated(), llvm::MVT::isVector(), llvm::SIMachineFunctionInfo::markPSInputAllocated(), llvm::SIMachineFunctionInfo::markPSInputEnabled(), llvm::ISD::InputArg::PartOffset, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::BitVector::set(), llvm::ISD::ArgFlagsTy::setSplit(), llvm::ArrayRef< T >::size(), llvm::ISD::InputArg::Used, and llvm::ISD::InputArg::VT.
Referenced by llvm::SITargetLowering::LowerFormalArguments().
|
static |
Definition at line 1171 of file SIISelLowering.cpp.
References llvm::MachineFunction::getFrameInfo(), llvm::TargetMachine::getOptLevel(), llvm::SIRegisterInfo::getPreloadedValue(), llvm::MachineFunction::getSubtarget(), llvm::MachineFrameInfo::hasStackObjects(), llvm::AMDGPUSubtarget::isAmdCodeObjectV2(), llvm::CodeGenOpt::None, llvm::SIRegisterInfo::PRIVATE_SEGMENT_BUFFER, llvm::SIRegisterInfo::PRIVATE_SEGMENT_WAVE_BYTE_OFFSET, llvm::SIRegisterInfo::reservedPrivateSegmentBufferReg(), llvm::SIRegisterInfo::reservedPrivateSegmentWaveByteOffsetReg(), llvm::SIMachineFunctionInfo::setHasNonSpillStackObjects(), llvm::SIMachineFunctionInfo::setScratchRSrcReg(), llvm::SIMachineFunctionInfo::setScratchWaveOffsetReg(), and llvm::ARM_MB::ST.
Referenced by llvm::SITargetLowering::finalizeLowering().
|
static |
Definition at line 1836 of file SIISelLowering.cpp.
References llvm::ARM_AM::add, llvm::MachineInstrBuilder::addImm(), assert(), llvm::BuildMI(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::VGPRIndexMode::DST_ENABLE, llvm::MachineInstr::getDebugLoc(), llvm::SIInstrInfo::getNamedOperand(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::SIInstrInfo::getRegisterInfo(), I, llvm::SIRegisterInfo::isSGPRClass(), llvm::RegState::Kill, llvm::MachineOperand::setIsUndef(), and llvm::VGPRIndexMode::SRC0_ENABLE.
Referenced by emitIndirectDst(), and emitIndirectSrc().
Helper function for adjustWritemask.
Definition at line 5436 of file SIISelLowering.cpp.
|
static |
Referenced by emitIndirectDst(), and emitIndirectSrc().
1.8.6