Skip to content

Commit 75193b1

Browse files
authored
[BPF] use target triple for pattern predicates (llvm#74998)
This is used for eliminate uses of "CurDAG", which is SelectionDAG-spec, and not compatible with GIsel algorithms. (NFC)
1 parent 99430c5 commit 75193b1

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

llvm/lib/Target/BPF/BPFInstrInfo.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def BPFWrapper : SDNode<"BPFISD::Wrapper", SDT_BPFWrapper>;
4949
def BPFmemcpy : SDNode<"BPFISD::MEMCPY", SDT_BPFMEMCPY,
5050
[SDNPHasChain, SDNPInGlue, SDNPOutGlue,
5151
SDNPMayStore, SDNPMayLoad]>;
52-
def BPFIsLittleEndian : Predicate<"CurDAG->getDataLayout().isLittleEndian()">;
53-
def BPFIsBigEndian : Predicate<"!CurDAG->getDataLayout().isLittleEndian()">;
52+
def BPFIsLittleEndian : Predicate<"Subtarget->isLittleEndian()">;
53+
def BPFIsBigEndian : Predicate<"!Subtarget->isLittleEndian()">;
5454
def BPFHasALU32 : Predicate<"Subtarget->getHasAlu32()">;
5555
def BPFNoALU32 : Predicate<"!Subtarget->getHasAlu32()">;
5656
def BPFHasLdsx : Predicate<"Subtarget->hasLdsx()">;

llvm/lib/Target/BPF/BPFSubtarget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,6 @@ BPFSubtarget::BPFSubtarget(const Triple &TT, const std::string &CPU,
9393
const std::string &FS, const TargetMachine &TM)
9494
: BPFGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS),
9595
FrameLowering(initializeSubtargetDependencies(CPU, FS)),
96-
TLInfo(TM, *this) {}
96+
TLInfo(TM, *this) {
97+
IsLittleEndian = TT.isLittleEndian();
98+
}

llvm/lib/Target/BPF/BPFSubtarget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class BPFSubtarget : public BPFGenSubtargetInfo {
4343
// unused
4444
bool isDummyMode;
4545

46+
bool IsLittleEndian;
47+
4648
// whether the cpu supports jmp ext
4749
bool HasJmpExt;
4850

@@ -81,6 +83,8 @@ class BPFSubtarget : public BPFGenSubtargetInfo {
8183
bool hasGotol() const { return HasGotol; }
8284
bool hasStoreImm() const { return HasStoreImm; }
8385

86+
bool isLittleEndian() const { return IsLittleEndian; }
87+
8488
const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
8589
const BPFFrameLowering *getFrameLowering() const override {
8690
return &FrameLowering;

0 commit comments

Comments
 (0)