[llvm] [SCEV] Introduce SCEVUse, use it instead of const SCEV * (NFCI) (WIP). (PR #91961)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 01:56:24 PDT 2024


================
@@ -69,6 +69,99 @@ enum SCEVTypes : unsigned short;
 
 extern bool VerifySCEV;
 
+class SCEV;
+
+class SCEVUse : public PointerIntPair<const SCEV *, 2> {
+public:
+  SCEVUse() : PointerIntPair(nullptr, 0) {}
+  SCEVUse(const SCEV *S) : PointerIntPair(S, 0) {}
+  SCEVUse(const SCEV *S, int Flags) : PointerIntPair(S, Flags) {}
+
+  operator const SCEV *() const { return getPointer(); }
+  const SCEV *operator->() const { return getPointer(); }
+  const SCEV *operator->() { return getPointer(); }
+
+  void *getRawPointer() { return getOpaqueValue(); }
+
+  /// Print out the internal representation of this scalar to the specified
+  /// stream.  This should really only be used for debugging purposes.
+  void print(raw_ostream &OS) const;
+
+  /// This method is used for debugging.
+  void dump() const;
+};
+
+template <> struct PointerLikeTypeTraits<SCEVUse> {
----------------
nikic wrote:

Why do we need PointerLikeTypeTraits on SCEVUse?

https://github.com/llvm/llvm-project/pull/91961


More information about the llvm-commits mailing list