Skip to content

Commit 276ef73

Browse files
committed
BPF
1 parent 3be191c commit 276ef73

File tree

6 files changed

+32
-37
lines changed

6 files changed

+32
-37
lines changed

llvm/lib/Target/BPF/BPFISelLowering.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -701,26 +701,6 @@ SDValue BPFTargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const {
701701
return DAG.getNode(BPFISD::SELECT_CC, DL, Op.getValueType(), Ops);
702702
}
703703

704-
const char *BPFTargetLowering::getTargetNodeName(unsigned Opcode) const {
705-
switch ((BPFISD::NodeType)Opcode) {
706-
case BPFISD::FIRST_NUMBER:
707-
break;
708-
case BPFISD::RET_GLUE:
709-
return "BPFISD::RET_GLUE";
710-
case BPFISD::CALL:
711-
return "BPFISD::CALL";
712-
case BPFISD::SELECT_CC:
713-
return "BPFISD::SELECT_CC";
714-
case BPFISD::BR_CC:
715-
return "BPFISD::BR_CC";
716-
case BPFISD::Wrapper:
717-
return "BPFISD::Wrapper";
718-
case BPFISD::MEMCPY:
719-
return "BPFISD::MEMCPY";
720-
}
721-
return nullptr;
722-
}
723-
724704
static SDValue getTargetNode(GlobalAddressSDNode *N, const SDLoc &DL, EVT Ty,
725705
SelectionDAG &DAG, unsigned Flags) {
726706
return DAG.getTargetGlobalAddress(N->getGlobal(), DL, Ty, 0, Flags);

llvm/lib/Target/BPF/BPFISelLowering.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@
2020

2121
namespace llvm {
2222
class BPFSubtarget;
23-
namespace BPFISD {
24-
enum NodeType : unsigned {
25-
FIRST_NUMBER = ISD::BUILTIN_OP_END,
26-
RET_GLUE,
27-
CALL,
28-
SELECT_CC,
29-
BR_CC,
30-
Wrapper,
31-
MEMCPY
32-
};
33-
}
3423

3524
class BPFTargetLowering : public TargetLowering {
3625
public:
@@ -39,9 +28,6 @@ class BPFTargetLowering : public TargetLowering {
3928
// Provide custom lowering hooks for some operations.
4029
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
4130

42-
// This method returns the name of a target specific DAG node.
43-
const char *getTargetNodeName(unsigned Opcode) const override;
44-
4531
// This method decides whether folding a constant offset
4632
// with the given GlobalAddress is legal.
4733
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;

llvm/lib/Target/BPF/BPFInstrInfo.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def BPFcallseq_start: SDNode<"ISD::CALLSEQ_START", SDT_BPFCallSeqStart,
4141
[SDNPHasChain, SDNPOutGlue]>;
4242
def BPFcallseq_end : SDNode<"ISD::CALLSEQ_END", SDT_BPFCallSeqEnd,
4343
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
44-
def BPFbrcc : SDNode<"BPFISD::BR_CC", SDT_BPFBrCC,
45-
[SDNPHasChain, SDNPOutGlue, SDNPInGlue]>;
44+
def BPFbrcc : SDNode<"BPFISD::BR_CC", SDT_BPFBrCC, [SDNPHasChain]>;
4645

4746
def BPFselectcc : SDNode<"BPFISD::SELECT_CC", SDT_BPFSelectCC>;
4847
def BPFWrapper : SDNode<"BPFISD::Wrapper", SDT_BPFWrapper>;

llvm/lib/Target/BPF/BPFSelectionDAGInfo.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,33 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#include "BPFSelectionDAGInfo.h"
1314
#include "BPFTargetMachine.h"
1415
#include "llvm/CodeGen/SelectionDAG.h"
16+
17+
#define GET_SDNODE_DESC
18+
#include "BPFGenSDNodeInfo.inc"
19+
1520
using namespace llvm;
1621

1722
#define DEBUG_TYPE "bpf-selectiondag-info"
1823

24+
BPFSelectionDAGInfo::BPFSelectionDAGInfo()
25+
: SelectionDAGGenTargetInfo(BPFGenSDNodeInfo) {}
26+
27+
void BPFSelectionDAGInfo::verifyTargetNode(const SelectionDAG &DAG,
28+
const SDNode *N) const {
29+
switch (N->getOpcode()) {
30+
default:
31+
break;
32+
case BPFISD::MEMCPY:
33+
// invalid number of operands; expected 6, got 5
34+
return;
35+
}
36+
37+
SelectionDAGGenTargetInfo::verifyTargetNode(DAG, N);
38+
}
39+
1940
SDValue BPFSelectionDAGInfo::EmitTargetCodeForMemcpy(
2041
SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src,
2142
SDValue Size, Align Alignment, bool isVolatile, bool AlwaysInline,

llvm/lib/Target/BPF/BPFSelectionDAGInfo.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@
1515

1616
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
1717

18+
#define GET_SDNODE_ENUM
19+
#include "BPFGenSDNodeInfo.inc"
20+
1821
namespace llvm {
1922

20-
class BPFSelectionDAGInfo : public SelectionDAGTargetInfo {
23+
class BPFSelectionDAGInfo : public SelectionDAGGenTargetInfo {
2124
public:
25+
BPFSelectionDAGInfo();
26+
27+
void verifyTargetNode(const SelectionDAG &DAG,
28+
const SDNode *N) const override;
29+
2230
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl,
2331
SDValue Chain, SDValue Dst, SDValue Src,
2432
SDValue Size, Align Alignment,

llvm/lib/Target/BPF/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ tablegen(LLVM BPFGenDisassemblerTables.inc -gen-disassembler)
1010
tablegen(LLVM BPFGenInstrInfo.inc -gen-instr-info)
1111
tablegen(LLVM BPFGenMCCodeEmitter.inc -gen-emitter)
1212
tablegen(LLVM BPFGenRegisterInfo.inc -gen-register-info)
13+
tablegen(LLVM BPFGenSDNodeInfo.inc -gen-sd-node-info)
1314
tablegen(LLVM BPFGenSubtargetInfo.inc -gen-subtarget)
1415
tablegen(LLVM BPFGenGlobalISel.inc -gen-global-isel)
1516
tablegen(LLVM BPFGenRegisterBank.inc -gen-register-bank)

0 commit comments

Comments
 (0)