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 | ||
|---|---|---|
| 54 | probably should use int64_t offsets? | |
| llvm/include/llvm/ADT/ByteProvider.h | ||
|---|---|---|
| 23 | 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 | ||
|---|---|---|
| 7822–7823 | Is there anywhere we can safely put a typedef to avoid carrying around the same template argument? | |
| llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
|---|---|---|
| 7822–7823 | using SDByteProvider = ByteProvider<SDNode*>; | |
| llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
|---|---|---|
| 8244 | (style) missing assert message (or merge the 2 asserts): assert(P.hasSrc() && isa<LoadSDNode>(P.Src.value()) && "Must be a memory byte provider"); | |
| 8245 | auto* | |
| 8282 | (style) missing assert message (or merge the 2 asserts): assert(P->hasSrc() && isa<LoadSDNode>(P->Src.value()) && "provenance should either be memory or zero"); | |
| 8283 | auto* | |
| 8364–8365 | this assert isn't necessary as the cast<> will also assert (same for the other above which I suggested merging with the other assert....) | |
| 8365 | auto * | |
LGTM with one minor - does anyone else have any comments?
| llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
|---|---|---|
| 8365 | auto *FirstLoad | |
| llvm/include/llvm/CodeGen/ByteProvider.h | ||
|---|---|---|
| 1 ↗ | (On Diff #528971) | Missing include path |
Is there anyway that we can avoid an anonymous namespace in a header like this?