diff --git a/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp b/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp --- a/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp +++ b/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp @@ -20,26 +20,6 @@ #define DEBUG_TYPE "llvm-mca-riscv-custombehaviour" -// This brings in a table with primary key of -// base instruction opcode and lmul and maps -// to the opcode of the pseudo instruction. -namespace RISCVVInversePseudosTable { -using namespace llvm; -using namespace llvm::RISCV; - -struct PseudoInfo { - uint16_t Pseudo; - uint16_t BaseInstr; - uint8_t VLMul; - uint8_t SEW; -}; - -#define GET_RISCVVInversePseudosTable_IMPL -#define GET_RISCVVInversePseudosTable_DECL -#include "RISCVGenSearchableTables.inc" - -} // end namespace RISCVVInversePseudosTable - namespace llvm { namespace mca { @@ -215,11 +195,11 @@ // and SEW, or (Opcode, LMUL, 0) if does not depend on SEW. uint8_t SEW = SI ? SI->getSEW() : 0; // Check if it depends on LMUL and SEW - const RISCVVInversePseudosTable::PseudoInfo *RVV = - RISCVVInversePseudosTable::getBaseInfo(Opcode, LMUL, SEW); + const RISCVVPseudosTable::PseudoInfo *RVV = + RISCVVPseudosTable::getBaseInfo(Opcode, LMUL, SEW); // Check if it depends only on LMUL if (!RVV) - RVV = RISCVVInversePseudosTable::getBaseInfo(Opcode, LMUL, 0); + RVV = RISCVVPseudosTable::getBaseInfo(Opcode, LMUL, 0); // Not a RVV instr if (!RVV) { diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h @@ -444,6 +444,20 @@ #include "RISCVGenSearchableTables.inc" } // end namespace RISCVInsnOpcode +namespace RISCVVPseudosTable { + +struct PseudoInfo { + uint16_t Pseudo; + uint16_t BaseInstr; + uint8_t VLMul; + uint8_t SEW; +}; + +#define GET_RISCVVPseudosTable_DECL +#include "RISCVGenSearchableTables.inc" + +} // end namespace RISCVVPseudosTable + namespace RISCVABI { enum ABI { diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp @@ -36,6 +36,15 @@ #include "RISCVGenSearchableTables.inc" } // namespace RISCVInsnOpcode +namespace RISCVVPseudosTable { + +using namespace RISCV; + +#define GET_RISCVVPseudosTable_IMPL +#include "RISCVGenSearchableTables.inc" + +} // namespace RISCVVPseudosTable + namespace RISCVABI { ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits, StringRef ABIName) { diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.h b/llvm/lib/Target/RISCV/RISCVInstrInfo.h --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.h +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.h @@ -281,17 +281,5 @@ static constexpr unsigned FPMASK_Quiet_NaN = 0x200; } // namespace RISCV -namespace RISCVVPseudosTable { - -struct PseudoInfo { - uint16_t Pseudo; - uint16_t BaseInstr; -}; - -#define GET_RISCVVPseudosTable_DECL -#include "RISCVGenSearchableTables.inc" - -} // end namespace RISCVVPseudosTable - } // end namespace llvm #endif diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -55,15 +55,6 @@ clEnumValN(MachineTraceStrategy::TS_MinInstrCount, "min-instr", "MinInstrCount strategy."))); -namespace llvm::RISCVVPseudosTable { - -using namespace RISCV; - -#define GET_RISCVVPseudosTable_IMPL -#include "RISCVGenSearchableTables.inc" - -} // namespace llvm::RISCVVPseudosTable - RISCVInstrInfo::RISCVInstrInfo(RISCVSubtarget &STI) : RISCVGenInstrInfo(RISCV::ADJCALLSTACKDOWN, RISCV::ADJCALLSTACKUP), STI(STI) {} diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -534,19 +534,15 @@ def RISCVVPseudosTable : GenericTable { let FilterClass = "RISCVVPseudo"; let CppTypeName = "PseudoInfo"; - let Fields = [ "Pseudo", "BaseInstr" ]; + let Fields = [ "Pseudo", "BaseInstr", "VLMul", "SEW"]; let PrimaryKey = [ "Pseudo" ]; let PrimaryKeyName = "getPseudoInfo"; let PrimaryKeyEarlyOut = true; } -def RISCVVInversePseudosTable : GenericTable { - let FilterClass = "RISCVVPseudo"; - let CppTypeName = "PseudoInfo"; - let Fields = [ "Pseudo", "BaseInstr", "VLMul", "SEW"]; - let PrimaryKey = [ "BaseInstr", "VLMul", "SEW"]; - let PrimaryKeyName = "getBaseInfo"; - let PrimaryKeyEarlyOut = true; +def getBaseInfo : SearchIndex { + let Table = RISCVVPseudosTable; + let Key = [ "BaseInstr", "VLMul", "SEW"]; } def RISCVVIntrinsicsTable : GenericTable {