Jlm
AliasAnalysis.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2025 HÃ¥vard Krogstie <krogstie.havard@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_LLVM_OPT_ALIAS_ANALYSES_ALIASANALYSIS_HPP
7 #define JLM_LLVM_OPT_ALIAS_ANALYSES_ALIASANALYSIS_HPP
8 
9 #include <jlm/rvsdg/node.hpp>
10 
11 namespace jlm::llvm::aa
12 {
13 
26 {
27 public:
32  {
33  // The analysis guarantees that [p1, p1+s1) and [p2, p2+s2) never overlap
35 
36  // The analysis is unable to determine any facts about p1 and p2
38 
39  // p1 and p2 always have identical values (s1 and s2 are ignored)
40  MustAlias
41  };
42 
44 
45  virtual ~AliasAnalysis() noexcept;
46 
50  [[nodiscard]] virtual std::string
51  ToString() const = 0;
52 
61  virtual AliasQueryResponse
62  Query(const rvsdg::Output & p1, size_t s1, const rvsdg::Output & p2, size_t s2) = 0;
63 };
64 
69 class ChainedAliasAnalysis final : public AliasAnalysis
70 {
71 public:
73 
74  ~ChainedAliasAnalysis() noexcept override;
75 
76  std::string
77  ToString() const override;
78 
80  Query(const rvsdg::Output & p1, size_t s1, const rvsdg::Output & p2, size_t s2) override;
81 
82 private:
83  AliasAnalysis & First_;
84  AliasAnalysis & Second_;
85 };
86 
92 [[nodiscard]] bool
93 IsPointerCompatible(const rvsdg::Output & value);
94 
95 }
96 
97 #endif // JLM_LLVM_OPT_ALIAS_ANALYSES_ALIASANALYSIS_HPP
virtual std::string ToString() const =0
virtual ~AliasAnalysis() noexcept
virtual AliasQueryResponse Query(const rvsdg::Output &p1, size_t s1, const rvsdg::Output &p2, size_t s2)=0
~ChainedAliasAnalysis() noexcept override
bool IsPointerCompatible(const rvsdg::Output &value)