[llvm] [RISCV] Move RISCV vector load/store searchable tables from RISCVISelDAGToDAG.cpp to RISCVBaseInfo.cpp. NFC (PR #129172)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 27 19:19:04 PST 2025
https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/129172
>From 5a757c9d563583e51847d34f39ed2978c01ed404 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 27 Feb 2025 17:46:06 -0800
Subject: [PATCH 1/2] [RISCV] Move RISCV vector load/store searchable tables
from RISCVISelDAGToDAG.cpp to RISCVBaseInfo.cpp. NFC
llvm-mca needs some of them for #128978.
I'm relying on -fdata-sections allowing these to be stripped from
tools that don't need them like llvm-mc.
---
.../RISCV/MCTargetDesc/RISCVBaseInfo.cpp | 12 +++
.../Target/RISCV/MCTargetDesc/RISCVBaseInfo.h | 77 +++++++++++++++++++
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp | 12 ---
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h | 77 -------------------
4 files changed, 89 insertions(+), 89 deletions(-)
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
index 9c1c364c18549..1829291cd0348 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
@@ -39,6 +39,18 @@ using namespace RISCV;
#include "RISCVGenSearchableTables.inc"
} // namespace RISCVVInversePseudosTable
+namespace RISCV {
+#define GET_RISCVVSSEGTable_IMPL
+#define GET_RISCVVLSEGTable_IMPL
+#define GET_RISCVVLXSEGTable_IMPL
+#define GET_RISCVVSXSEGTable_IMPL
+#define GET_RISCVVLETable_IMPL
+#define GET_RISCVVSETable_IMPL
+#define GET_RISCVVLXTable_IMPL
+#define GET_RISCVVSXTable_IMPL
+#include "RISCVGenSearchableTables.inc"
+} // namespace RISCV
+
namespace RISCVABI {
ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits,
StringRef ABIName) {
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
index 88435b2b52ca5..6a87ffd0c899a 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -666,6 +666,83 @@ struct PseudoInfo {
#include "RISCVGenSearchableTables.inc"
} // namespace RISCVVInversePseudosTable
+namespace RISCV {
+struct VLSEGPseudo {
+ uint16_t NF : 4;
+ uint16_t Masked : 1;
+ uint16_t Strided : 1;
+ uint16_t FF : 1;
+ uint16_t Log2SEW : 3;
+ uint16_t LMUL : 3;
+ uint16_t Pseudo;
+};
+
+struct VLXSEGPseudo {
+ uint16_t NF : 4;
+ uint16_t Masked : 1;
+ uint16_t Ordered : 1;
+ uint16_t Log2SEW : 3;
+ uint16_t LMUL : 3;
+ uint16_t IndexLMUL : 3;
+ uint16_t Pseudo;
+};
+
+struct VSSEGPseudo {
+ uint16_t NF : 4;
+ uint16_t Masked : 1;
+ uint16_t Strided : 1;
+ uint16_t Log2SEW : 3;
+ uint16_t LMUL : 3;
+ uint16_t Pseudo;
+};
+
+struct VSXSEGPseudo {
+ uint16_t NF : 4;
+ uint16_t Masked : 1;
+ uint16_t Ordered : 1;
+ uint16_t Log2SEW : 3;
+ uint16_t LMUL : 3;
+ uint16_t IndexLMUL : 3;
+ uint16_t Pseudo;
+};
+
+struct VLEPseudo {
+ uint16_t Masked : 1;
+ uint16_t Strided : 1;
+ uint16_t FF : 1;
+ uint16_t Log2SEW : 3;
+ uint16_t LMUL : 3;
+ uint16_t Pseudo;
+};
+
+struct VSEPseudo {
+ uint16_t Masked :1;
+ uint16_t Strided : 1;
+ uint16_t Log2SEW : 3;
+ uint16_t LMUL : 3;
+ uint16_t Pseudo;
+};
+
+struct VLX_VSXPseudo {
+ uint16_t Masked : 1;
+ uint16_t Ordered : 1;
+ uint16_t Log2SEW : 3;
+ uint16_t LMUL : 3;
+ uint16_t IndexLMUL : 3;
+ uint16_t Pseudo;
+};
+
+#define GET_RISCVVSSEGTable_DECL
+#define GET_RISCVVLSEGTable_DECL
+#define GET_RISCVVLXSEGTable_DECL
+#define GET_RISCVVSXSEGTable_DECL
+#define GET_RISCVVLETable_DECL
+#define GET_RISCVVSETable_DECL
+#define GET_RISCVVLXTable_DECL
+#define GET_RISCVVSXTable_DECL
+#include "RISCVGenSearchableTables.inc"
+} // namespace RISCV
+
} // namespace llvm
#endif
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index 7ea4bd94c0065..f3cce950ed7b5 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -34,18 +34,6 @@ static cl::opt<bool> UsePseudoMovImm(
"constant materialization"),
cl::init(false));
-namespace llvm::RISCV {
-#define GET_RISCVVSSEGTable_IMPL
-#define GET_RISCVVLSEGTable_IMPL
-#define GET_RISCVVLXSEGTable_IMPL
-#define GET_RISCVVSXSEGTable_IMPL
-#define GET_RISCVVLETable_IMPL
-#define GET_RISCVVSETable_IMPL
-#define GET_RISCVVLXTable_IMPL
-#define GET_RISCVVSXTable_IMPL
-#include "RISCVGenSearchableTables.inc"
-} // namespace llvm::RISCV
-
void RISCVDAGToDAGISel::PreprocessISelDAG() {
SelectionDAG::allnodes_iterator Position = CurDAG->allnodes_end();
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
index bb786e4b2bb40..5048a80fdd18f 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
@@ -204,83 +204,6 @@ class RISCVDAGToDAGISelLegacy : public SelectionDAGISelLegacy {
CodeGenOptLevel OptLevel);
};
-namespace RISCV {
-struct VLSEGPseudo {
- uint16_t NF : 4;
- uint16_t Masked : 1;
- uint16_t Strided : 1;
- uint16_t FF : 1;
- uint16_t Log2SEW : 3;
- uint16_t LMUL : 3;
- uint16_t Pseudo;
-};
-
-struct VLXSEGPseudo {
- uint16_t NF : 4;
- uint16_t Masked : 1;
- uint16_t Ordered : 1;
- uint16_t Log2SEW : 3;
- uint16_t LMUL : 3;
- uint16_t IndexLMUL : 3;
- uint16_t Pseudo;
-};
-
-struct VSSEGPseudo {
- uint16_t NF : 4;
- uint16_t Masked : 1;
- uint16_t Strided : 1;
- uint16_t Log2SEW : 3;
- uint16_t LMUL : 3;
- uint16_t Pseudo;
-};
-
-struct VSXSEGPseudo {
- uint16_t NF : 4;
- uint16_t Masked : 1;
- uint16_t Ordered : 1;
- uint16_t Log2SEW : 3;
- uint16_t LMUL : 3;
- uint16_t IndexLMUL : 3;
- uint16_t Pseudo;
-};
-
-struct VLEPseudo {
- uint16_t Masked : 1;
- uint16_t Strided : 1;
- uint16_t FF : 1;
- uint16_t Log2SEW : 3;
- uint16_t LMUL : 3;
- uint16_t Pseudo;
-};
-
-struct VSEPseudo {
- uint16_t Masked :1;
- uint16_t Strided : 1;
- uint16_t Log2SEW : 3;
- uint16_t LMUL : 3;
- uint16_t Pseudo;
-};
-
-struct VLX_VSXPseudo {
- uint16_t Masked : 1;
- uint16_t Ordered : 1;
- uint16_t Log2SEW : 3;
- uint16_t LMUL : 3;
- uint16_t IndexLMUL : 3;
- uint16_t Pseudo;
-};
-
-#define GET_RISCVVSSEGTable_DECL
-#define GET_RISCVVLSEGTable_DECL
-#define GET_RISCVVLXSEGTable_DECL
-#define GET_RISCVVSXSEGTable_DECL
-#define GET_RISCVVLETable_DECL
-#define GET_RISCVVSETable_DECL
-#define GET_RISCVVLXTable_DECL
-#define GET_RISCVVSXTable_DECL
-#include "RISCVGenSearchableTables.inc"
-} // namespace RISCV
-
} // namespace llvm
#endif
>From 146b01cdd7e101cba60ccf1b7ee00b230493b2d1 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 27 Feb 2025 19:18:51 -0800
Subject: [PATCH 2/2] fixup! clang-format
---
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
index 6a87ffd0c899a..433be1f1e87d4 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -716,7 +716,7 @@ struct VLEPseudo {
};
struct VSEPseudo {
- uint16_t Masked :1;
+ uint16_t Masked : 1;
uint16_t Strided : 1;
uint16_t Log2SEW : 3;
uint16_t LMUL : 3;
More information about the llvm-commits
mailing list