37
37
#ifndef LLVM_ANALYSIS_ALIASANALYSIS_H
38
38
#define LLVM_ANALYSIS_ALIASANALYSIS_H
39
39
40
+ #include " llvm/Support/Compiler.h"
40
41
#include " llvm/ADT/DenseMap.h"
41
42
#include " llvm/ADT/SmallVector.h"
42
43
#include " llvm/Analysis/MemoryLocation.h"
@@ -142,10 +143,10 @@ static_assert(sizeof(AliasResult) == 4,
142
143
" AliasResult size is intended to be 4 bytes!" );
143
144
144
145
// / << operator for AliasResult.
145
- raw_ostream &operator <<(raw_ostream &OS, AliasResult AR);
146
+ LLVM_ABI raw_ostream &operator <<(raw_ostream &OS, AliasResult AR);
146
147
147
148
// / Virtual base class for providers of capture analysis.
148
- struct CaptureAnalysis {
149
+ struct LLVM_ABI CaptureAnalysis {
149
150
virtual ~CaptureAnalysis () = 0 ;
150
151
151
152
// / Check whether Object is not captured before instruction I. If OrAt is
@@ -159,7 +160,7 @@ struct CaptureAnalysis {
159
160
// / Context-free CaptureAnalysis provider, which computes and caches whether an
160
161
// / object is captured in the function at all, but does not distinguish whether
161
162
// / it was captured before or after the context instruction.
162
- class SimpleCaptureAnalysis final : public CaptureAnalysis {
163
+ class LLVM_ABI SimpleCaptureAnalysis final : public CaptureAnalysis {
163
164
SmallDenseMap<const Value *, bool , 8 > IsCapturedCache;
164
165
165
166
public:
@@ -170,7 +171,7 @@ class SimpleCaptureAnalysis final : public CaptureAnalysis {
170
171
// / Context-sensitive CaptureAnalysis provider, which computes and caches the
171
172
// / earliest common dominator closure of all captures. It provides a good
172
173
// / approximation to a precise "captures before" analysis.
173
- class EarliestEscapeAnalysis final : public CaptureAnalysis {
174
+ class LLVM_ABI EarliestEscapeAnalysis final : public CaptureAnalysis {
174
175
DominatorTree &DT;
175
176
const LoopInfo *LI;
176
177
@@ -315,9 +316,9 @@ class AAResults {
315
316
public:
316
317
// Make these results default constructable and movable. We have to spell
317
318
// these out because MSVC won't synthesize them.
318
- AAResults (const TargetLibraryInfo &TLI);
319
- AAResults (AAResults &&Arg);
320
- ~AAResults ();
319
+ LLVM_ABI AAResults (const TargetLibraryInfo &TLI);
320
+ LLVM_ABI AAResults (AAResults &&Arg);
321
+ LLVM_ABI ~AAResults ();
321
322
322
323
// / Register a specific AA result.
323
324
template <typename AAResultT> void addAAResult (AAResultT &AAResult) {
@@ -338,7 +339,7 @@ class AAResults {
338
339
// /
339
340
// / The aggregation is invalidated if any of the underlying analyses is
340
341
// / invalidated.
341
- bool invalidate (Function &F, const PreservedAnalyses &PA,
342
+ LLVM_ABI bool invalidate (Function &F, const PreservedAnalyses &PA,
342
343
FunctionAnalysisManager::Invalidator &Inv);
343
344
344
345
// ===--------------------------------------------------------------------===//
@@ -349,7 +350,7 @@ class AAResults {
349
350
// / Returns an AliasResult indicating whether the two pointers are aliased to
350
351
// / each other. This is the interface that must be implemented by specific
351
352
// / alias analysis implementations.
352
- AliasResult alias (const MemoryLocation &LocA, const MemoryLocation &LocB);
353
+ LLVM_ABI AliasResult alias (const MemoryLocation &LocA, const MemoryLocation &LocB);
353
354
354
355
// / A convenience wrapper around the primary \c alias interface.
355
356
AliasResult alias (const Value *V1, LocationSize V1Size, const Value *V2,
@@ -417,7 +418,7 @@ class AAResults {
417
418
// /
418
419
// / If IgnoreLocals is true, then this method returns NoModRef for memory
419
420
// / that points to a local alloca.
420
- ModRefInfo getModRefInfoMask (const MemoryLocation &Loc,
421
+ LLVM_ABI ModRefInfo getModRefInfoMask (const MemoryLocation &Loc,
421
422
bool IgnoreLocals = false );
422
423
423
424
// / A convenience wrapper around the primary \c getModRefInfoMask
@@ -431,13 +432,13 @@ class AAResults {
431
432
// / that these bits do not necessarily account for the overall behavior of
432
433
// / the function, but rather only provide additional per-argument
433
434
// / information.
434
- ModRefInfo getArgModRefInfo (const CallBase *Call, unsigned ArgIdx);
435
+ LLVM_ABI ModRefInfo getArgModRefInfo (const CallBase *Call, unsigned ArgIdx);
435
436
436
437
// / Return the behavior of the given call site.
437
- MemoryEffects getMemoryEffects (const CallBase *Call);
438
+ LLVM_ABI MemoryEffects getMemoryEffects (const CallBase *Call);
438
439
439
440
// / Return the behavior when calling the given function.
440
- MemoryEffects getMemoryEffects (const Function *F);
441
+ LLVM_ABI MemoryEffects getMemoryEffects (const Function *F);
441
442
442
443
// / Checks if the specified call is known to never read or write memory.
443
444
// /
@@ -519,11 +520,11 @@ class AAResults {
519
520
520
521
// / Return information about whether a call and an instruction may refer to
521
522
// / the same memory locations.
522
- ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call);
523
+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call);
523
524
524
525
// / Return information about whether two instructions may refer to the same
525
526
// / memory locations.
526
- ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2);
527
+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2);
527
528
528
529
// / Return information about whether a particular call site modifies
529
530
// / or reads the specified memory location \p MemLoc before instruction \p I
@@ -548,7 +549,7 @@ class AAResults {
548
549
549
550
// / Check if it is possible for execution of the specified basic block to
550
551
// / modify the location Loc.
551
- bool canBasicBlockModify (const BasicBlock &BB, const MemoryLocation &Loc);
552
+ LLVM_ABI bool canBasicBlockModify (const BasicBlock &BB, const MemoryLocation &Loc);
552
553
553
554
// / A convenience wrapper synthesizing a memory location.
554
555
bool canBasicBlockModify (const BasicBlock &BB, const Value *P,
@@ -561,7 +562,7 @@ class AAResults {
561
562
// /
562
563
// / The instructions to consider are all of the instructions in the range of
563
564
// / [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block.
564
- bool canInstructionRangeModRef (const Instruction &I1, const Instruction &I2,
565
+ LLVM_ABI bool canInstructionRangeModRef (const Instruction &I1, const Instruction &I2,
565
566
const MemoryLocation &Loc,
566
567
const ModRefInfo Mode);
567
568
@@ -574,42 +575,42 @@ class AAResults {
574
575
575
576
// CtxI can be nullptr, in which case the query is whether or not the aliasing
576
577
// relationship holds through the entire function.
577
- AliasResult alias (const MemoryLocation &LocA, const MemoryLocation &LocB,
578
+ LLVM_ABI AliasResult alias (const MemoryLocation &LocA, const MemoryLocation &LocB,
578
579
AAQueryInfo &AAQI, const Instruction *CtxI = nullptr );
579
580
580
- ModRefInfo getModRefInfoMask (const MemoryLocation &Loc, AAQueryInfo &AAQI,
581
+ LLVM_ABI ModRefInfo getModRefInfoMask (const MemoryLocation &Loc, AAQueryInfo &AAQI,
581
582
bool IgnoreLocals = false );
582
- ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call2,
583
+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call2,
583
584
AAQueryInfo &AAQIP);
584
- ModRefInfo getModRefInfo (const CallBase *Call, const MemoryLocation &Loc,
585
+ LLVM_ABI ModRefInfo getModRefInfo (const CallBase *Call, const MemoryLocation &Loc,
585
586
AAQueryInfo &AAQI);
586
- ModRefInfo getModRefInfo (const CallBase *Call1, const CallBase *Call2,
587
+ LLVM_ABI ModRefInfo getModRefInfo (const CallBase *Call1, const CallBase *Call2,
587
588
AAQueryInfo &AAQI);
588
- ModRefInfo getModRefInfo (const VAArgInst *V, const MemoryLocation &Loc,
589
+ LLVM_ABI ModRefInfo getModRefInfo (const VAArgInst *V, const MemoryLocation &Loc,
589
590
AAQueryInfo &AAQI);
590
- ModRefInfo getModRefInfo (const LoadInst *L, const MemoryLocation &Loc,
591
+ LLVM_ABI ModRefInfo getModRefInfo (const LoadInst *L, const MemoryLocation &Loc,
591
592
AAQueryInfo &AAQI);
592
- ModRefInfo getModRefInfo (const StoreInst *S, const MemoryLocation &Loc,
593
+ LLVM_ABI ModRefInfo getModRefInfo (const StoreInst *S, const MemoryLocation &Loc,
593
594
AAQueryInfo &AAQI);
594
- ModRefInfo getModRefInfo (const FenceInst *S, const MemoryLocation &Loc,
595
+ LLVM_ABI ModRefInfo getModRefInfo (const FenceInst *S, const MemoryLocation &Loc,
595
596
AAQueryInfo &AAQI);
596
- ModRefInfo getModRefInfo (const AtomicCmpXchgInst *CX,
597
+ LLVM_ABI ModRefInfo getModRefInfo (const AtomicCmpXchgInst *CX,
597
598
const MemoryLocation &Loc, AAQueryInfo &AAQI);
598
- ModRefInfo getModRefInfo (const AtomicRMWInst *RMW, const MemoryLocation &Loc,
599
+ LLVM_ABI ModRefInfo getModRefInfo (const AtomicRMWInst *RMW, const MemoryLocation &Loc,
599
600
AAQueryInfo &AAQI);
600
- ModRefInfo getModRefInfo (const CatchPadInst *I, const MemoryLocation &Loc,
601
+ LLVM_ABI ModRefInfo getModRefInfo (const CatchPadInst *I, const MemoryLocation &Loc,
601
602
AAQueryInfo &AAQI);
602
- ModRefInfo getModRefInfo (const CatchReturnInst *I, const MemoryLocation &Loc,
603
+ LLVM_ABI ModRefInfo getModRefInfo (const CatchReturnInst *I, const MemoryLocation &Loc,
603
604
AAQueryInfo &AAQI);
604
- ModRefInfo getModRefInfo (const Instruction *I,
605
+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I,
605
606
const std::optional<MemoryLocation> &OptLoc,
606
607
AAQueryInfo &AAQIP);
607
- ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2,
608
+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2,
608
609
AAQueryInfo &AAQI);
609
- ModRefInfo callCapturesBefore (const Instruction *I,
610
+ LLVM_ABI ModRefInfo callCapturesBefore (const Instruction *I,
610
611
const MemoryLocation &MemLoc, DominatorTree *DT,
611
612
AAQueryInfo &AAQIP);
612
- MemoryEffects getMemoryEffects (const CallBase *Call, AAQueryInfo &AAQI);
613
+ LLVM_ABI MemoryEffects getMemoryEffects (const CallBase *Call, AAQueryInfo &AAQI);
613
614
614
615
private:
615
616
class Concept ;
@@ -708,7 +709,7 @@ using AliasAnalysis = AAResults;
708
709
// / All of these methods model methods by the same name in the \c
709
710
// / AAResults class. Only differences and specifics to how the
710
711
// / implementations are called are documented here.
711
- class AAResults ::Concept {
712
+ class LLVM_ABI AAResults::Concept {
712
713
public:
713
714
virtual ~Concept () = 0 ;
714
715
@@ -869,7 +870,7 @@ class AAResultBase {
869
870
};
870
871
871
872
// / Return true if this pointer is returned by a noalias function.
872
- bool isNoAliasCall (const Value *V);
873
+ LLVM_ABI bool isNoAliasCall (const Value *V);
873
874
874
875
// / Return true if this pointer refers to a distinct and identifiable object.
875
876
// / This returns true for:
@@ -878,32 +879,32 @@ bool isNoAliasCall(const Value *V);
878
879
// / ByVal and NoAlias Arguments
879
880
// / NoAlias returns (e.g. calls to malloc)
880
881
// /
881
- bool isIdentifiedObject (const Value *V);
882
+ LLVM_ABI bool isIdentifiedObject (const Value *V);
882
883
883
884
// / Return true if V is umabigously identified at the function-level.
884
885
// / Different IdentifiedFunctionLocals can't alias.
885
886
// / Further, an IdentifiedFunctionLocal can not alias with any function
886
887
// / arguments other than itself, which is not necessarily true for
887
888
// / IdentifiedObjects.
888
- bool isIdentifiedFunctionLocal (const Value *V);
889
+ LLVM_ABI bool isIdentifiedFunctionLocal (const Value *V);
889
890
890
891
// / Return true if we know V to the base address of the corresponding memory
891
892
// / object. This implies that any address less than V must be out of bounds
892
893
// / for the underlying object. Note that just being isIdentifiedObject() is
893
894
// / not enough - For example, a negative offset from a noalias argument or call
894
895
// / can be inbounds w.r.t the actual underlying object.
895
- bool isBaseOfObject (const Value *V);
896
+ LLVM_ABI bool isBaseOfObject (const Value *V);
896
897
897
898
// / Returns true if the pointer is one which would have been considered an
898
899
// / escape by isNonEscapingLocalObject.
899
- bool isEscapeSource (const Value *V);
900
+ LLVM_ABI bool isEscapeSource (const Value *V);
900
901
901
902
// / Return true if Object memory is not visible after an unwind, in the sense
902
903
// / that program semantics cannot depend on Object containing any particular
903
904
// / value on unwind. If the RequiresNoCaptureBeforeUnwind out parameter is set
904
905
// / to true, then the memory is only not visible if the object has not been
905
906
// / captured prior to the unwind. Otherwise it is not visible even if captured.
906
- bool isNotVisibleOnUnwind (const Value *Object,
907
+ LLVM_ABI bool isNotVisibleOnUnwind (const Value *Object,
907
908
bool &RequiresNoCaptureBeforeUnwind);
908
909
909
910
// / Return true if the Object is writable, in the sense that any location based
@@ -917,7 +918,7 @@ bool isNotVisibleOnUnwind(const Value *Object,
917
918
// / using the dereferenceable(N) attribute. It does not necessarily hold for
918
919
// / parts that are only known to be dereferenceable due to the presence of
919
920
// / loads.
920
- bool isWritableObject (const Value *Object, bool &ExplicitlyDereferenceableOnly);
921
+ LLVM_ABI bool isWritableObject (const Value *Object, bool &ExplicitlyDereferenceableOnly);
921
922
922
923
// / A manager for alias analyses.
923
924
// /
@@ -950,7 +951,7 @@ class AAManager : public AnalysisInfoMixin<AAManager> {
950
951
ResultGetters.push_back (&getModuleAAResultImpl<AnalysisT>);
951
952
}
952
953
953
- Result run (Function &F, FunctionAnalysisManager &AM);
954
+ LLVM_ABI Result run (Function &F, FunctionAnalysisManager &AM);
954
955
955
956
private:
956
957
friend AnalysisInfoMixin<AAManager>;
@@ -984,7 +985,7 @@ class AAManager : public AnalysisInfoMixin<AAManager> {
984
985
985
986
// / A wrapper pass to provide the legacy pass manager access to a suitably
986
987
// / prepared AAResults object.
987
- class AAResultsWrapperPass : public FunctionPass {
988
+ class LLVM_ABI AAResultsWrapperPass : public FunctionPass {
988
989
std::unique_ptr<AAResults> AAR;
989
990
990
991
public:
@@ -1007,11 +1008,11 @@ struct ExternalAAWrapperPass : ImmutablePass {
1007
1008
1008
1009
CallbackT CB;
1009
1010
1010
- static char ID;
1011
+ LLVM_ABI static char ID;
1011
1012
1012
- ExternalAAWrapperPass ();
1013
+ LLVM_ABI ExternalAAWrapperPass ();
1013
1014
1014
- explicit ExternalAAWrapperPass (CallbackT CB);
1015
+ LLVM_ABI explicit ExternalAAWrapperPass (CallbackT CB);
1015
1016
1016
1017
// / Returns whether this external AA should run before Basic AA.
1017
1018
// /
@@ -1037,7 +1038,7 @@ struct ExternalAAWrapperPass : ImmutablePass {
1037
1038
// / object, and will receive a reference to the function wrapper pass, the
1038
1039
// / function, and the AAResults object to populate. This should be used when
1039
1040
// / setting up a custom pass pipeline to inject a hook into the AA results.
1040
- ImmutablePass *createExternalAAWrapperPass (
1041
+ LLVM_ABI ImmutablePass *createExternalAAWrapperPass (
1041
1042
std::function<void (Pass &, Function &, AAResults &)> Callback);
1042
1043
1043
1044
} // end namespace llvm
0 commit comments