LLVM 20.0.0git
Functions
RISCVLegalizerInfo.cpp File Reference

This file implements the targeting of the Machinelegalizer class for RISC-V. More...

#include "RISCVLegalizerInfo.h"
#include "MCTargetDesc/RISCVMatInt.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVSubtarget.h"
#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h"
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
#include "llvm/CodeGen/GlobalISel/LegalizerHelper.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Type.h"

Go to the source code of this file.

Functions

static LegalityPredicate typeIsLegalIntOrFPVec (unsigned TypeIdx, std::initializer_list< LLT > IntOrFPVecTys, const RISCVSubtarget &ST)
 
static LegalityPredicate typeIsLegalBoolVec (unsigned TypeIdx, std::initializer_list< LLT > BoolVecTys, const RISCVSubtarget &ST)
 
static LegalityPredicate typeIsLegalPtrVec (unsigned TypeIdx, std::initializer_list< LLT > PtrVecTys, const RISCVSubtarget &ST)
 
static LLT getMaskTypeFor (LLT VecTy)
 Return the type of the mask type suitable for masking the provided vector type.
 
static MachineInstrBuilder buildAllOnesMask (LLT VecTy, const SrcOp &VL, MachineIRBuilder &MIB, MachineRegisterInfo &MRI)
 Creates an all ones mask suitable for masking a vector of type VecTy with vector length VL.
 
static std::pair< MachineInstrBuilder, MachineInstrBuilderbuildDefaultVLOps (LLT VecTy, MachineIRBuilder &MIB, MachineRegisterInfo &MRI)
 Gets the two common "VL" operands: an all-ones mask and the vector length.
 
static MachineInstrBuilder buildSplatPartsS64WithVL (const DstOp &Dst, const SrcOp &Passthru, Register Lo, Register Hi, const SrcOp &VL, MachineIRBuilder &MIB, MachineRegisterInfo &MRI)
 
static MachineInstrBuilder buildSplatSplitS64WithVL (const DstOp &Dst, const SrcOp &Passthru, const SrcOp &Scalar, const SrcOp &VL, MachineIRBuilder &MIB, MachineRegisterInfo &MRI)
 
static LLT getLMUL1Ty (LLT VecTy)
 
static unsigned getRISCVWOpcode (unsigned Opcode)
 

Detailed Description

This file implements the targeting of the Machinelegalizer class for RISC-V.

Todo:
This should be generated by TableGen.

Definition in file RISCVLegalizerInfo.cpp.

Function Documentation

◆ buildAllOnesMask()

static MachineInstrBuilder buildAllOnesMask ( LLT  VecTy,
const SrcOp VL,
MachineIRBuilder MIB,
MachineRegisterInfo MRI 
)
static

Creates an all ones mask suitable for masking a vector of type VecTy with vector length VL.

Definition at line 952 of file RISCVLegalizerInfo.cpp.

References llvm::MachineIRBuilder::buildInstr(), and getMaskTypeFor().

Referenced by buildDefaultVLOps().

◆ buildDefaultVLOps()

static std::pair< MachineInstrBuilder, MachineInstrBuilder > buildDefaultVLOps ( LLT  VecTy,
MachineIRBuilder MIB,
MachineRegisterInfo MRI 
)
static

Gets the two common "VL" operands: an all-ones mask and the vector length.

VecTy is a scalable vector type.

Definition at line 962 of file RISCVLegalizerInfo.cpp.

References assert(), buildAllOnesMask(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::getMF(), llvm::MachineFunction::getSubtarget(), llvm::RISCVSubtarget::getXLenVT(), llvm::LLT::isScalableVector(), and MRI.

◆ buildSplatPartsS64WithVL()

static MachineInstrBuilder buildSplatPartsS64WithVL ( const DstOp Dst,
const SrcOp Passthru,
Register  Lo,
Register  Hi,
const SrcOp VL,
MachineIRBuilder MIB,
MachineRegisterInfo MRI 
)
static

◆ buildSplatSplitS64WithVL()

static MachineInstrBuilder buildSplatSplitS64WithVL ( const DstOp Dst,
const SrcOp Passthru,
const SrcOp Scalar,
const SrcOp VL,
MachineIRBuilder MIB,
MachineRegisterInfo MRI 
)
static

◆ getLMUL1Ty()

static LLT getLMUL1Ty ( LLT  VecTy)
static

◆ getMaskTypeFor()

static LLT getMaskTypeFor ( LLT  VecTy)
static

Return the type of the mask type suitable for masking the provided vector type.

This is simply an i1 element type vector of the same (possibly scalable) length.

Definition at line 944 of file RISCVLegalizerInfo.cpp.

References assert(), llvm::LLT::getElementCount(), llvm::LLT::isVector(), llvm::LLT::scalar(), and llvm::LLT::vector().

Referenced by buildAllOnesMask(), getAllOnesMask(), lowerFMAXIMUM_FMINIMUM(), lowerVectorFTRUNC_FCEIL_FFLOOR_FROUND(), and llvm::RISCVTargetLowering::PerformDAGCombine().

◆ getRISCVWOpcode()

static unsigned getRISCVWOpcode ( unsigned  Opcode)
static

◆ typeIsLegalBoolVec()

static LegalityPredicate typeIsLegalBoolVec ( unsigned  TypeIdx,
std::initializer_list< LLT BoolVecTys,
const RISCVSubtarget ST 
)
static

◆ typeIsLegalIntOrFPVec()

static LegalityPredicate typeIsLegalIntOrFPVec ( unsigned  TypeIdx,
std::initializer_list< LLT IntOrFPVecTys,
const RISCVSubtarget ST 
)
static

◆ typeIsLegalPtrVec()

static LegalityPredicate typeIsLegalPtrVec ( unsigned  TypeIdx,
std::initializer_list< LLT PtrVecTys,
const RISCVSubtarget ST 
)
static