This change does not change functionality but I believe it does slightly
Additionally, this change is required for our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we can no longer use ISD::ADD for our patterns that operate on
pointers and added a DAG.getPointerAdd() function that uses a custom
Committing this change will significantly reduce our merge conflicts
for each upstream merge.
I noticed that this is effectively the same as getMemBasePlusOffset().
However, that function only allows unsigned arguments.
The only other difference is that the operands are in the same order as
DAG.getNode(). Should I be using getMemBasePlusOffset() instead and add
an overload that takes an SDNode and a signed offset?
To find potential opportunities to use getPointerAdd() I looked at
all ISD::ADD uses found with the regex getNode\(ISD::ADD,.+,.+Ptr
in lib/CodeGen/SelectionDAG. If this patch is accepted I will convert
the files in the individual backens too.