================ @@ -80,6 +94,139 @@ class Address { return Alignment; } + /// Return address with different element type, but same pointer and + /// alignment. + RawAddress withElementType(llvm::Type *ElemTy) const { + return RawAddress(getPointer(), ElemTy, getAlignment(), isKnownNonNull()); + } + + KnownNonNull_t isKnownNonNull() const { + assert(isValid()); + return (KnownNonNull_t)PointerAndKnownNonNull.getInt(); + } +}; + +/// Like RawAddress, an abstract representation of an aligned address, but the +/// pointer contained in this class is possibly signed. +class Address { + friend class CGBuilderTy; + + // The boolean flag indicates whether the pointer is known to be non-null. + llvm::PointerIntPair<llvm::Value *, 1, bool> Pointer; + + /// The expected IR type of the pointer. When the address is a raw pointer, + /// this is currently redundant with the pointer's type, but for signed + /// pointers it is useful if the pointer has been offsetted or cast from the + /// original type. In the long run, when LLVM adopts opaque pointer types, + /// this should become the notional element type of the address. ---------------- efriedma-quic wrote:
This comment probably needs to be updated? https://github.com/llvm/llvm-project/pull/67454 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits