Bring ByteProvider into header to serve as generic utility.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Factor out common code for use in https://reviews.llvm.org/D142782 . Template class for eventual porting to GlobalISel.
Require contained class in ByteProvider to have getOpcode (class must be node in selection DAG)
llvm/include/llvm/ADT/ByteProvider.h | ||
---|---|---|
53 ↗ | (On Diff #500262) | probably should use int64_t offsets? |
llvm/include/llvm/ADT/ByteProvider.h | ||
---|---|---|
23 ↗ | (On Diff #506212) | Is there anyway that we can avoid an anonymous namespace in a header like this? |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
21 | (Just being skeptical.) |
Hi @barannikov88 -- thanks for your comments. I tend to agree that it is not "abstract enough" for ADT as it is basically an ISel util -- I have moved it into include/llvm/CodeGen
That said, I think it should be generic in that it should be agnostic between SDNode and SDValu -- DAGCombiner currently uses SDNode but I am working on a patch which calculates ByteProviders in terms of SDValues https://reviews.llvm.org/D142782 . Eventually we will want to extend this work to GlobalISel as well, so it seems we may also want MachineInstrs as the Src.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
8401–8403 | Is there anywhere we can safely put a typedef to avoid carrying around the same template argument? |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
8401 | using SDByteProvider = ByteProvider<SDNode*>; |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
8829 | (style) missing assert message (or merge the 2 asserts): assert(P.hasSrc() && isa<LoadSDNode>(P.Src.value()) && "Must be a memory byte provider"); | |
8830 | auto* | |
8867 | (style) missing assert message (or merge the 2 asserts): assert(P->hasSrc() && isa<LoadSDNode>(P->Src.value()) && "provenance should either be memory or zero"); | |
8868 | auto* | |
8949–8950 | this assert isn't necessary as the cast<> will also assert (same for the other above which I suggested merging with the other assert....) | |
8950 | auto * |
LGTM with one minor - does anyone else have any comments?
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
8950 | auto *FirstLoad |
llvm/include/llvm/CodeGen/ByteProvider.h | ||
---|---|---|
2 | Missing include path |
llvm/CodeGen/ByteProvider.h