LLVM 20.0.0git
|
This file implements the WebAssemblyTargetLowering class. More...
#include "WebAssemblyISelLowering.h"
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "Utils/WebAssemblyTypeUtilities.h"
#include "WebAssemblyMachineFunctionInfo.h"
#include "WebAssemblySubtarget.h"
#include "WebAssemblyTargetMachine.h"
#include "WebAssemblyUtilities.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/MachineFrameInfo.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/SelectionDAGNodes.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetOptions.h"
#include "WebAssemblyISD.def"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "wasm-lower" |
#define | HANDLE_NODETYPE(NODE) |
#define | HANDLE_MEM_NODETYPE(NODE) HANDLE_NODETYPE(NODE) |
This file implements the WebAssemblyTargetLowering class.
Definition in file WebAssemblyISelLowering.cpp.
#define DEBUG_TYPE "wasm-lower" |
Definition at line 40 of file WebAssemblyISelLowering.cpp.
#define HANDLE_MEM_NODETYPE | ( | NODE | ) | HANDLE_NODETYPE(NODE) |
#define HANDLE_NODETYPE | ( | NODE | ) |
|
static |
Definition at line 1136 of file WebAssemblyISelLowering.cpp.
References llvm::CallingConv::C, llvm::CallingConv::Cold, llvm::CallingConv::CXX_FAST_TLS, llvm::CallingConv::Fast, llvm::CallingConv::PreserveAll, llvm::CallingConv::PreserveMost, llvm::CallingConv::Swift, and llvm::CallingConv::WASM_EmscriptenInvoke.
|
static |
Definition at line 2923 of file WebAssemblyISelLowering.cpp.
References assert(), llvm::ISD::BUILD_VECTOR, DL, llvm::ISD::EXTRACT_SUBVECTOR, llvm::SelectionDAG::getBuildVector(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getIntPtrConstant(), llvm::SelectionDAG::getNode(), llvm::SDValue::getOpcode(), llvm::EVT::getSizeInBits(), llvm::SDValue::getValueType(), llvm::EVT::getVectorElementType(), llvm::EVT::getVectorNumElements(), llvm::EVT::getVectorVT(), llvm::isPowerOf2_32(), and llvm::SDNode::ops().
Referenced by combineBROADCAST_LOAD(), combineConcatVectorOps(), combineConstantPoolLoads(), combineEXTRACT_SUBVECTOR(), combineLoad(), combineOr(), combineScalarToVector(), combineSelect(), combineTargetShuffle(), combineX86ShuffleChain(), combineX86ShuffleChainWithExtract(), createVariablePermute(), extract128BitVector(), extract256BitVector(), getAVX512Node(), getAVX512TruncNode(), getEXTEND_VECTOR_INREG(), getHopForBuildVector(), lowerBuildVectorAsBroadcast(), LowerEXTEND_VECTOR_INREG(), lowerShuffleAsBroadcast(), lowerShuffleWithPERMV(), llvm::X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(), SplitOpsAndApply(), splitVector(), truncateVectorWithNARROW(), and truncateVectorWithPACK().
|
static |
Definition at line 1129 of file WebAssemblyISelLowering.cpp.
References llvm::LLVMContext::diagnose(), DL, llvm::SelectionDAG::getContext(), llvm::MachineFunction::getFunction(), and llvm::SelectionDAG::getMachineFunction().
Definition at line 1651 of file WebAssemblyISelLowering.cpp.
References llvm::GlobalAddressSDNode::getAddressSpace(), and llvm::WebAssembly::isWasmVarAddressSpace().
|
static |
Definition at line 1658 of file WebAssemblyISelLowering.cpp.
References llvm::FrameIndexSDNode::getIndex(), llvm::WebAssemblyFrameLowering::getLocalForStackObject(), and llvm::SelectionDAG::getMachineFunction().
|
static |
Definition at line 700 of file WebAssemblyISelLowering.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstr::addOperand(), llvm::MachineInstrBuilder::addReg(), llvm::MachineInstrBuilder::addSym(), assert(), llvm::BuildMI(), llvm::MachineFunction::CreateMachineInstr(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::MachineInstr::defs(), DL, llvm::MachineInstr::eraseFromParent(), llvm::MachineFunction::getContext(), llvm::MachineInstrBuilder::getInstr(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::WebAssembly::getOrCreateFuncrefCallTableSymbol(), llvm::WebAssembly::getOrCreateFunctionTableSymbol(), llvm::MachineBasicBlock::getParent(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getPrevNode(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::WebAssemblySubtarget::hasCallIndirectOverlong(), llvm::WebAssemblySubtarget::hasReferenceTypes(), llvm::MachineBasicBlock::insert(), llvm::MachineBasicBlock::insertAfter(), llvm::MachineOperand::isFI(), llvm::MachineOperand::isReg(), MRI, llvm::MachineInstr::removeOperand(), llvm::MCSymbolWasm::setNoStrip(), TII, and llvm::MachineInstr::uses().
|
static |
Definition at line 2191 of file WebAssemblyISelLowering.cpp.
References DL, llvm::ISD::EXTRACT_VECTOR_ELT, llvm::ISD::FP_EXTEND, llvm::SelectionDAG::getNode(), llvm::SDValue::getValueType(), llvm::SelectionDAG::getVectorShuffle(), llvm::ISD::SINT_TO_FP, and llvm::ISD::UINT_TO_FP.
|
static |
Definition at line 474 of file WebAssemblyISelLowering.cpp.
References llvm::MachineInstrBuilder::addFPImm(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), llvm::And, llvm::MachineBasicBlock::begin(), llvm::BuildMI(), DL, llvm::MachineBasicBlock::end(), F, llvm::MachineBasicBlock::getBasicBlock(), llvm::Function::getContext(), llvm::Type::getDoubleTy(), llvm::Type::getFloatTy(), llvm::MachineFunction::getFunction(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getRegInfo(), Int64, INT64_MIN, MI, MRI, llvm::MachineBasicBlock::splice(), TII, and llvm::MachineBasicBlock::transferSuccessorsAndUpdatePHIs().
|
static |
Definition at line 569 of file WebAssemblyISelLowering.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), DL, llvm::MachineBasicBlock::end(), F, llvm::MachineBasicBlock::getBasicBlock(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getRegInfo(), Int64, MI, MRI, llvm::MachineOperand::setIsKill(), llvm::MachineBasicBlock::splice(), TII, and llvm::MachineBasicBlock::transferSuccessorsAndUpdatePHIs().
|
static |
Definition at line 638 of file WebAssemblyISelLowering.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), DL, llvm::MachineBasicBlock::end(), F, llvm::MachineBasicBlock::getBasicBlock(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getRegInfo(), Int64, MI, MRI, llvm::MachineOperand::setIsKill(), llvm::MachineBasicBlock::splice(), TII, and llvm::MachineBasicBlock::transferSuccessorsAndUpdatePHIs().
|
static |
Definition at line 3030 of file WebAssemblyISelLowering.cpp.
References llvm::TargetLowering::DAGCombinerInfo::DAG, DL, llvm::MVT::getIntegerVT(), llvm::SelectionDAG::getNode(), llvm::EVT::getScalarType(), llvm::EVT::getVectorNumElements(), llvm::SelectionDAG::getZExtOrTrunc(), llvm::ISD::INTRINSIC_WO_CHAIN, llvm::TargetLowering::DAGCombinerInfo::isBeforeLegalize(), llvm::EVT::isFixedLengthVector(), llvm::EVT::isScalarInteger(), and N.
|
static |
Definition at line 3057 of file WebAssemblyISelLowering.cpp.
References llvm::ISD::BITCAST, Cond, llvm::TargetLowering::DAGCombinerInfo::DAG, DL, llvm::MVT::getIntegerVT(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getNOT(), llvm::EVT::getVectorElementType(), llvm::EVT::getVectorNumElements(), llvm::SelectionDAG::getZExtOrTrunc(), llvm::ISD::INTRINSIC_WO_CHAIN, llvm::isAllOnesConstant(), llvm::TargetLowering::DAGCombinerInfo::isBeforeLegalize(), llvm::EVT::isFixedLengthVector(), llvm::isNullConstant(), llvm::EVT::isScalarInteger(), LHS, N, RHS, llvm::ISD::SETEQ, and llvm::ISD::SETNE.
|
static |
Definition at line 3003 of file WebAssemblyISelLowering.cpp.
References llvm::ISD::AND, llvm::TargetLowering::DAGCombinerInfo::DAG, DL, llvm::SelectionDAG::getConstant(), llvm::APInt::getLowBitsSet(), llvm::SelectionDAG::getNode(), llvm::EVT::getScalarSizeInBits(), llvm::EVT::getVectorElementType(), llvm::EVT::is128BitVector(), llvm::EVT::isSimple(), llvm::EVT::isVector(), N, and truncateVectorWithNARROW().
|
static |
Definition at line 2704 of file WebAssemblyISelLowering.cpp.
References llvm::ISD::BITCAST, llvm::TargetLowering::DAGCombinerInfo::DAG, llvm::SelectionDAG::getBitcast(), llvm::SelectionDAG::getUNDEF(), llvm::SDValue::getValueType(), llvm::EVT::getVectorNumElements(), llvm::SelectionDAG::getVectorShuffle(), llvm::EVT::is128BitVector(), and N.
|
static |
Definition at line 2755 of file WebAssemblyISelLowering.cpp.
References assert(), llvm::TargetLowering::DAGCombinerInfo::DAG, llvm::ISD::EXTRACT_SUBVECTOR, llvm::SelectionDAG::getNode(), llvm::SDValue::getOpcode(), llvm::SDValue::getOperand(), llvm::SDValue::getValueType(), N, llvm::ISD::SIGN_EXTEND, and llvm::ISD::ZERO_EXTEND.
|
static |
Convert ({u,s}itofp vec) --> ({u,s}itofp ({s,z}ext vec)) so it doesn't get split up into scalar instructions during legalization, and the vector extending instructions are selected in performVectorExtendCombine below.
Definition at line 2732 of file WebAssemblyISelLowering.cpp.
References assert(), llvm::TargetLowering::DAGCombinerInfo::DAG, llvm::SelectionDAG::getNode(), N, llvm::ISD::SIGN_EXTEND, llvm::ISD::SINT_TO_FP, llvm::ISD::UINT_TO_FP, and llvm::ISD::ZERO_EXTEND.
|
static |
Definition at line 2802 of file WebAssemblyISelLowering.cpp.
References Concat, llvm::ISD::CONCAT_VECTORS, Conversion, llvm::TargetLowering::DAGCombinerInfo::DAG, llvm::ISD::FP_ROUND, llvm::ISD::FP_TO_SINT_SAT, llvm::ISD::FP_TO_UINT_SAT, llvm::SelectionDAG::getNode(), llvm_unreachable, N, and llvm::Splat.
|
static |
Definition at line 2952 of file WebAssemblyISelLowering.cpp.
References assert(), llvm::ISD::CONCAT_VECTORS, DL, extractSubVector(), llvm::SelectionDAG::getBitcast(), llvm::SelectionDAG::getContext(), llvm::EVT::getIntegerVT(), llvm::SelectionDAG::getNode(), llvm::EVT::getScalarSizeInBits(), llvm::EVT::getSizeInBits(), llvm::EVT::getVectorNumElements(), llvm::EVT::getVectorVT(), llvm::Hi, llvm::EVT::is128BitVector(), llvm::EVT::is256BitVector(), llvm::isPowerOf2_32(), llvm::Lo, and truncateVectorWithNARROW().
Referenced by performTruncateCombine(), and truncateVectorWithNARROW().
|
static |
Definition at line 2588 of file WebAssemblyISelLowering.cpp.
References llvm::ISD::AND, llvm::EVT::bitsGE(), DL, llvm::SelectionDAG::ExtractVectorElements(), llvm::SelectionDAG::getBuildVector(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getNode(), llvm::EVT::getSizeInBits(), llvm::SelectionDAG::getValueType(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::ISD::SIGN_EXTEND_INREG, llvm::ISD::SRA, and llvm::SelectionDAG::UnrollVectorOp().