Skip to content

Commit bb9500f

Browse files
lenarys-barannikov
andcommitted
[RISCV] TableGen RISC-V ISD Nodes
This commit moves RISC-V to auto-generate its target-specific SDNode types. The biggest change is that SDNodes can now be validated against their expected type profiles, and that we don't need to edit several different files when declaring a new one. This takes Sergei's work in llvm#119709 and "finishes" it - by moving the final five RISCVISD opcodes into tablegen (including defining their types), and by ensuring the tablegen has expected closing scope comments. Only one opcode is not currently verifying on the in-tree tests: PROBED_ALLOCA, which I cannot make head or tail of what it should be doing, so I have just ensured it skips verification for the moment (as in Sergei's patch). Co-authored-by: Sergei Barannikov <[email protected]>
1 parent 692f832 commit bb9500f

23 files changed

+557
-1202
lines changed

llvm/lib/Target/RISCV/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tablegen(LLVM RISCVGenRegisterInfo.inc -gen-register-info)
1616
tablegen(LLVM RISCVGenSearchableTables.inc -gen-searchable-tables)
1717
tablegen(LLVM RISCVGenSubtargetInfo.inc -gen-subtarget)
1818
tablegen(LLVM RISCVGenExegesis.inc -gen-exegesis)
19+
tablegen(LLVM RISCVGenSDNodeInfo.inc -gen-sd-node-info)
1920

2021
set(LLVM_TARGET_DEFINITIONS RISCVGISel.td)
2122
tablegen(LLVM RISCVGenGlobalISel.inc -gen-global-isel)

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "RISCVISelDAGToDAG.h"
14+
#include "RISCVSelectionDAGInfo.h"
1415
#include "MCTargetDesc/RISCVBaseInfo.h"
1516
#include "MCTargetDesc/RISCVMCTargetDesc.h"
1617
#include "MCTargetDesc/RISCVMatInt.h"
@@ -34,6 +35,9 @@ static cl::opt<bool> UsePseudoMovImm(
3435
"constant materialization"),
3536
cl::init(false));
3637

38+
#define GET_DAGISEL_BODY RISCVDAGToDAGISel
39+
#include "RISCVGenDAGISel.inc"
40+
3741
void RISCVDAGToDAGISel::PreprocessISelDAG() {
3842
SelectionDAG::allnodes_iterator Position = CurDAG->allnodes_end();
3943

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ class RISCVDAGToDAGISel : public SelectionDAGISel {
191191
}
192192

193193
// Include the pieces autogenerated from the target description.
194+
#define GET_DAGISEL_DECL
194195
#include "RISCVGenDAGISel.inc"
195196

196197
private:

0 commit comments

Comments
 (0)