LLVM 24.0.0git
RISCVRegisterBankInfo.cpp File Reference

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

#include "RISCVRegisterBankInfo.h"
#include "MCTargetDesc/RISCVMCTargetDesc.h"
#include "RISCVSubtarget.h"
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterBank.h"
#include "llvm/CodeGen/RegisterBankInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/IR/IntrinsicsRISCV.h"
#include "RISCVGenRegisterBank.inc"

Go to the source code of this file.

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
namespace  llvm::RISCV

Macros

#define GET_TARGET_REGBANK_IMPL

Enumerations

enum  llvm::RISCV::PartialMappingIdx {
  llvm::RISCV::PMI_GPRB32 = 0 , llvm::RISCV::PMI_GPRB64 = 1 , llvm::RISCV::PMI_FPRB16 = 2 , llvm::RISCV::PMI_FPRB32 = 3 ,
  llvm::RISCV::PMI_FPRB64 = 4 , llvm::RISCV::PMI_VRB64 = 5 , llvm::RISCV::PMI_VRB128 = 6 , llvm::RISCV::PMI_VRB256 = 7 ,
  llvm::RISCV::PMI_VRB512 = 8
}
enum  llvm::RISCV::ValueMappingIdx {
  llvm::RISCV::InvalidIdx = 0 , llvm::RISCV::GPRB32Idx = 1 , llvm::RISCV::GPRB64Idx = 4 , llvm::RISCV::FPRB16Idx = 7 ,
  llvm::RISCV::FPRB32Idx = 10 , llvm::RISCV::FPRB64Idx = 13 , llvm::RISCV::VRB64Idx = 16 , llvm::RISCV::VRB128Idx = 19 ,
  llvm::RISCV::VRB256Idx = 22 , llvm::RISCV::VRB512Idx = 25
}

Functions

static const RegisterBankInfo::ValueMapping * getFPValueMapping (unsigned Size)
static bool useGPRPairForS64 (const RISCVSubtarget &ST, LLT Ty)
 Decide whether an s64 value on RV32 belongs in a GPRPair (an i64, needs Zilsd) rather than in FPR64 (an f64, needs D).
static const RegisterBankInfo::ValueMapping * getVRBValueMapping (unsigned Size)

Variables

const RegisterBankInfo::PartialMapping llvm::RISCV::PartMappings []
const RegisterBankInfo::ValueMapping llvm::RISCV::ValueMappings []

Detailed Description

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

Todo
This should be generated by TableGen.

Definition in file RISCVRegisterBankInfo.cpp.

Macro Definition Documentation

◆ GET_TARGET_REGBANK_IMPL

#define GET_TARGET_REGBANK_IMPL

Definition at line 23 of file RISCVRegisterBankInfo.cpp.

Function Documentation

◆ getFPValueMapping()

◆ getVRBValueMapping()

◆ useGPRPairForS64()

bool useGPRPairForS64 ( const RISCVSubtarget & ST,
LLT Ty )
static

Decide whether an s64 value on RV32 belongs in a GPRPair (an i64, needs Zilsd) rather than in FPR64 (an f64, needs D).

With extended LLTs the type answers this directly. Without them every 64-bit scalar is an ANY_SCALAR LLT, so i64 and f64 are indistinguishable – guessing from the uses gets it wrong, e.g. an f64 whose only use is a G_SELECT looks like an integer because G_SELECT is not itself floating point constrained. So fall back to using a GPRPair only where the value cannot be an f64 at all.

Definition at line 215 of file RISCVRegisterBankInfo.cpp.

References llvm::LLT::getUseExtended().

Referenced by llvm::RISCVRegisterBankInfo::getInstrMapping().