|
103 | 103 | #include "llvm/ADT/STLExtras.h"
|
104 | 104 | #include "llvm/ADT/SetOperations.h"
|
105 | 105 | #include "llvm/ADT/SetVector.h"
|
| 106 | +#include "llvm/ADT/SmallSet.h" |
106 | 107 | #include "llvm/ADT/iterator.h"
|
107 | 108 | #include "llvm/Analysis/AssumeBundleQueries.h"
|
108 | 109 | #include "llvm/Analysis/CFG.h"
|
|
132 | 133 | #include "llvm/Support/ErrorHandling.h"
|
133 | 134 | #include "llvm/Support/ModRef.h"
|
134 | 135 | #include "llvm/Support/TimeProfiler.h"
|
| 136 | +#include "llvm/Support/TypeSize.h" |
135 | 137 | #include "llvm/TargetParser/Triple.h"
|
136 | 138 | #include "llvm/Transforms/Utils/CallGraphUpdater.h"
|
137 | 139 |
|
@@ -6105,6 +6107,12 @@ struct AAPointerInfo : public AbstractAttribute {
|
6105 | 6107 | /// See AbstractAttribute::getIdAddr()
|
6106 | 6108 | const char *getIdAddr() const override { return &ID; }
|
6107 | 6109 |
|
| 6110 | + using OffsetBinsTy = DenseMap<AA::RangeTy, SmallSet<unsigned, 4>>; |
| 6111 | + using const_bin_iterator = OffsetBinsTy::const_iterator; |
| 6112 | + virtual const_bin_iterator begin() const = 0; |
| 6113 | + virtual const_bin_iterator end() const = 0; |
| 6114 | + virtual int64_t numOffsetBins() const = 0; |
| 6115 | + |
6108 | 6116 | /// Call \p CB on all accesses that might interfere with \p Range and return
|
6109 | 6117 | /// true if all such accesses were known and the callback returned true for
|
6110 | 6118 | /// all of them, false otherwise. An access interferes with an offset-size
|
@@ -6258,6 +6266,41 @@ struct AAAddressSpace : public StateWrapper<BooleanState, AbstractAttribute> {
|
6258 | 6266 | static const char ID;
|
6259 | 6267 | };
|
6260 | 6268 |
|
| 6269 | +struct AAAllocationInfo : public StateWrapper<BooleanState, AbstractAttribute> { |
| 6270 | + AAAllocationInfo(const IRPosition &IRP, Attributor &A) |
| 6271 | + : StateWrapper<BooleanState, AbstractAttribute>(IRP) {} |
| 6272 | + |
| 6273 | + /// See AbstractAttribute::isValidIRPositionForInit |
| 6274 | + static bool isValidIRPositionForInit(Attributor &A, const IRPosition &IRP) { |
| 6275 | + if (!IRP.getAssociatedType()->isPtrOrPtrVectorTy()) |
| 6276 | + return false; |
| 6277 | + return AbstractAttribute::isValidIRPositionForInit(A, IRP); |
| 6278 | + } |
| 6279 | + |
| 6280 | + /// Create an abstract attribute view for the position \p IRP. |
| 6281 | + static AAAllocationInfo &createForPosition(const IRPosition &IRP, |
| 6282 | + Attributor &A); |
| 6283 | + |
| 6284 | + virtual std::optional<TypeSize> getAllocatedSize() const = 0; |
| 6285 | + |
| 6286 | + /// See AbstractAttribute::getName() |
| 6287 | + const std::string getName() const override { return "AAAllocationInfo"; } |
| 6288 | + |
| 6289 | + /// See AbstractAttribute::getIdAddr() |
| 6290 | + const char *getIdAddr() const override { return &ID; } |
| 6291 | + |
| 6292 | + /// This function should return true if the type of the \p AA is |
| 6293 | + /// AAAllocationInfo |
| 6294 | + static bool classof(const AbstractAttribute *AA) { |
| 6295 | + return (AA->getIdAddr() == &ID); |
| 6296 | + } |
| 6297 | + |
| 6298 | + constexpr static const std::optional<TypeSize> HasNoAllocationSize = |
| 6299 | + std::optional<TypeSize>(TypeSize(-1, true)); |
| 6300 | + |
| 6301 | + static const char ID; |
| 6302 | +}; |
| 6303 | + |
6261 | 6304 | /// An abstract interface for llvm::GlobalValue information interference.
|
6262 | 6305 | struct AAGlobalValueInfo
|
6263 | 6306 | : public StateWrapper<BooleanState, AbstractAttribute> {
|
|
0 commit comments