Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOL] Set max stores per mem func depending on the target features #14

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/lib/Target/BPF/BPFISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ BPFTargetLowering::BPFTargetLowering(const TargetMachine &TM,
MaxStoresPerMemcpy = MaxStoresPerMemcpyOptSize = 0;
MaxStoresPerMemmove = MaxStoresPerMemmoveOptSize = 0;
} else {
auto SelectionDAGInfo = STI.getSelectionDAGInfo();
SelectionDAGInfo->setSolanaFlag(STI.isSolana());
// inline memcpy() for kernel to see explicit copy
unsigned CommonMaxStores =
STI.getSelectionDAGInfo()->getCommonMaxStoresPerMemFunc();
SelectionDAGInfo->getCommonMaxStoresPerMemFunc();

MaxStoresPerMemset = MaxStoresPerMemsetOptSize = CommonMaxStores;
MaxStoresPerMemcpy = MaxStoresPerMemcpyOptSize = CommonMaxStores;
Expand Down
11 changes: 10 additions & 1 deletion llvm/lib/Target/BPF/BPFSelectionDAGInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ namespace llvm {

class BPFSelectionDAGInfo : public SelectionDAGTargetInfo {
public:
BPFSelectionDAGInfo() : isSolana(false) {}
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl,
SDValue Chain, SDValue Dst, SDValue Src,
SDValue Size, Align Alignment,
bool isVolatile, bool AlwaysInline,
MachinePointerInfo DstPtrInfo,
MachinePointerInfo SrcPtrInfo) const override;

unsigned getCommonMaxStoresPerMemFunc() const { return 128; }
unsigned getCommonMaxStoresPerMemFunc() const {
return isSolana ? 4 : 128;
}
void setSolanaFlag(bool value) const {
isSolana = value;
}

private:
mutable bool isSolana;

};

Expand Down
4 changes: 3 additions & 1 deletion llvm/lib/Target/BPF/BPFSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ BPFSubtarget::BPFSubtarget(const Triple &TT, const std::string &CPU,
const std::string &FS, const TargetMachine &TM)
: BPFGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS), InstrInfo(),
FrameLowering(initializeSubtargetDependencies(CPU, FS)),
TLInfo(TM, *this) {}
TLInfo(TM, *this) {
TSInfo.setSolanaFlag(IsSolana);
}