3737#ifndef LLVM_ANALYSIS_ALIASANALYSIS_H
3838#define LLVM_ANALYSIS_ALIASANALYSIS_H
3939
40+ #include " llvm/Support/Compiler.h"
4041#include " llvm/ADT/DenseMap.h"
4142#include " llvm/ADT/SmallVector.h"
4243#include " llvm/Analysis/MemoryLocation.h"
@@ -142,7 +143,7 @@ static_assert(sizeof(AliasResult) == 4,
142143 " AliasResult size is intended to be 4 bytes!" );
143144
144145// / << operator for AliasResult.
145- raw_ostream &operator <<(raw_ostream &OS, AliasResult AR);
146+ LLVM_ABI raw_ostream &operator <<(raw_ostream &OS, AliasResult AR);
146147
147148// / Virtual base class for providers of capture analysis.
148149struct CaptureAnalysis {
@@ -163,7 +164,7 @@ class SimpleCaptureAnalysis final : public CaptureAnalysis {
163164 SmallDenseMap<const Value *, bool , 8 > IsCapturedCache;
164165
165166public:
166- bool isNotCapturedBefore (const Value *Object, const Instruction *I,
167+ LLVM_ABI bool isNotCapturedBefore (const Value *Object, const Instruction *I,
167168 bool OrAt) override ;
168169};
169170
@@ -188,10 +189,10 @@ class EarliestEscapeAnalysis final : public CaptureAnalysis {
188189 EarliestEscapeAnalysis (DominatorTree &DT, const LoopInfo *LI = nullptr )
189190 : DT(DT), LI(LI) {}
190191
191- bool isNotCapturedBefore (const Value *Object, const Instruction *I,
192+ LLVM_ABI bool isNotCapturedBefore (const Value *Object, const Instruction *I,
192193 bool OrAt) override ;
193194
194- void removeInstruction (Instruction *I);
195+ LLVM_ABI void removeInstruction (Instruction *I);
195196};
196197
197198// / Cache key for BasicAA results. It only includes the pointer and size from
@@ -315,9 +316,9 @@ class AAResults {
315316public:
316317 // Make these results default constructable and movable. We have to spell
317318 // 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 ();
321322
322323 // / Register a specific AA result.
323324 template <typename AAResultT> void addAAResult (AAResultT &AAResult) {
@@ -338,7 +339,7 @@ class AAResults {
338339 // /
339340 // / The aggregation is invalidated if any of the underlying analyses is
340341 // / invalidated.
341- bool invalidate (Function &F, const PreservedAnalyses &PA,
342+ LLVM_ABI bool invalidate (Function &F, const PreservedAnalyses &PA,
342343 FunctionAnalysisManager::Invalidator &Inv);
343344
344345 // ===--------------------------------------------------------------------===//
@@ -349,7 +350,7 @@ class AAResults {
349350 // / Returns an AliasResult indicating whether the two pointers are aliased to
350351 // / each other. This is the interface that must be implemented by specific
351352 // / alias analysis implementations.
352- AliasResult alias (const MemoryLocation &LocA, const MemoryLocation &LocB);
353+ LLVM_ABI AliasResult alias (const MemoryLocation &LocA, const MemoryLocation &LocB);
353354
354355 // / A convenience wrapper around the primary \c alias interface.
355356 AliasResult alias (const Value *V1, LocationSize V1Size, const Value *V2,
@@ -417,7 +418,7 @@ class AAResults {
417418 // /
418419 // / If IgnoreLocals is true, then this method returns NoModRef for memory
419420 // / that points to a local alloca.
420- ModRefInfo getModRefInfoMask (const MemoryLocation &Loc,
421+ LLVM_ABI ModRefInfo getModRefInfoMask (const MemoryLocation &Loc,
421422 bool IgnoreLocals = false );
422423
423424 // / A convenience wrapper around the primary \c getModRefInfoMask
@@ -431,13 +432,13 @@ class AAResults {
431432 // / that these bits do not necessarily account for the overall behavior of
432433 // / the function, but rather only provide additional per-argument
433434 // / information.
434- ModRefInfo getArgModRefInfo (const CallBase *Call, unsigned ArgIdx);
435+ LLVM_ABI ModRefInfo getArgModRefInfo (const CallBase *Call, unsigned ArgIdx);
435436
436437 // / Return the behavior of the given call site.
437- MemoryEffects getMemoryEffects (const CallBase *Call);
438+ LLVM_ABI MemoryEffects getMemoryEffects (const CallBase *Call);
438439
439440 // / Return the behavior when calling the given function.
440- MemoryEffects getMemoryEffects (const Function *F);
441+ LLVM_ABI MemoryEffects getMemoryEffects (const Function *F);
441442
442443 // / Checks if the specified call is known to never read or write memory.
443444 // /
@@ -519,11 +520,11 @@ class AAResults {
519520
520521 // / Return information about whether a call and an instruction may refer to
521522 // / the same memory locations.
522- ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call);
523+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call);
523524
524525 // / Return information about whether two instructions may refer to the same
525526 // / memory locations.
526- ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2);
527+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2);
527528
528529 // / Return information about whether a particular call site modifies
529530 // / or reads the specified memory location \p MemLoc before instruction \p I
@@ -548,7 +549,7 @@ class AAResults {
548549
549550 // / Check if it is possible for execution of the specified basic block to
550551 // / modify the location Loc.
551- bool canBasicBlockModify (const BasicBlock &BB, const MemoryLocation &Loc);
552+ LLVM_ABI bool canBasicBlockModify (const BasicBlock &BB, const MemoryLocation &Loc);
552553
553554 // / A convenience wrapper synthesizing a memory location.
554555 bool canBasicBlockModify (const BasicBlock &BB, const Value *P,
@@ -561,7 +562,7 @@ class AAResults {
561562 // /
562563 // / The instructions to consider are all of the instructions in the range of
563564 // / [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,
565566 const MemoryLocation &Loc,
566567 const ModRefInfo Mode);
567568
@@ -574,42 +575,42 @@ class AAResults {
574575
575576 // CtxI can be nullptr, in which case the query is whether or not the aliasing
576577 // 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,
578579 AAQueryInfo &AAQI, const Instruction *CtxI = nullptr );
579580
580- ModRefInfo getModRefInfoMask (const MemoryLocation &Loc, AAQueryInfo &AAQI,
581+ LLVM_ABI ModRefInfo getModRefInfoMask (const MemoryLocation &Loc, AAQueryInfo &AAQI,
581582 bool IgnoreLocals = false );
582- ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call2,
583+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call2,
583584 AAQueryInfo &AAQIP);
584- ModRefInfo getModRefInfo (const CallBase *Call, const MemoryLocation &Loc,
585+ LLVM_ABI ModRefInfo getModRefInfo (const CallBase *Call, const MemoryLocation &Loc,
585586 AAQueryInfo &AAQI);
586- ModRefInfo getModRefInfo (const CallBase *Call1, const CallBase *Call2,
587+ LLVM_ABI ModRefInfo getModRefInfo (const CallBase *Call1, const CallBase *Call2,
587588 AAQueryInfo &AAQI);
588- ModRefInfo getModRefInfo (const VAArgInst *V, const MemoryLocation &Loc,
589+ LLVM_ABI ModRefInfo getModRefInfo (const VAArgInst *V, const MemoryLocation &Loc,
589590 AAQueryInfo &AAQI);
590- ModRefInfo getModRefInfo (const LoadInst *L, const MemoryLocation &Loc,
591+ LLVM_ABI ModRefInfo getModRefInfo (const LoadInst *L, const MemoryLocation &Loc,
591592 AAQueryInfo &AAQI);
592- ModRefInfo getModRefInfo (const StoreInst *S, const MemoryLocation &Loc,
593+ LLVM_ABI ModRefInfo getModRefInfo (const StoreInst *S, const MemoryLocation &Loc,
593594 AAQueryInfo &AAQI);
594- ModRefInfo getModRefInfo (const FenceInst *S, const MemoryLocation &Loc,
595+ LLVM_ABI ModRefInfo getModRefInfo (const FenceInst *S, const MemoryLocation &Loc,
595596 AAQueryInfo &AAQI);
596- ModRefInfo getModRefInfo (const AtomicCmpXchgInst *CX,
597+ LLVM_ABI ModRefInfo getModRefInfo (const AtomicCmpXchgInst *CX,
597598 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,
599600 AAQueryInfo &AAQI);
600- ModRefInfo getModRefInfo (const CatchPadInst *I, const MemoryLocation &Loc,
601+ LLVM_ABI ModRefInfo getModRefInfo (const CatchPadInst *I, const MemoryLocation &Loc,
601602 AAQueryInfo &AAQI);
602- ModRefInfo getModRefInfo (const CatchReturnInst *I, const MemoryLocation &Loc,
603+ LLVM_ABI ModRefInfo getModRefInfo (const CatchReturnInst *I, const MemoryLocation &Loc,
603604 AAQueryInfo &AAQI);
604- ModRefInfo getModRefInfo (const Instruction *I,
605+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I,
605606 const std::optional<MemoryLocation> &OptLoc,
606607 AAQueryInfo &AAQIP);
607- ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2,
608+ LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2,
608609 AAQueryInfo &AAQI);
609- ModRefInfo callCapturesBefore (const Instruction *I,
610+ LLVM_ABI ModRefInfo callCapturesBefore (const Instruction *I,
610611 const MemoryLocation &MemLoc, DominatorTree *DT,
611612 AAQueryInfo &AAQIP);
612- MemoryEffects getMemoryEffects (const CallBase *Call, AAQueryInfo &AAQI);
613+ LLVM_ABI MemoryEffects getMemoryEffects (const CallBase *Call, AAQueryInfo &AAQI);
613614
614615private:
615616 class Concept ;
@@ -869,7 +870,7 @@ class AAResultBase {
869870};
870871
871872// / 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);
873874
874875// / Return true if this pointer refers to a distinct and identifiable object.
875876// / This returns true for:
@@ -878,32 +879,32 @@ bool isNoAliasCall(const Value *V);
878879// / ByVal and NoAlias Arguments
879880// / NoAlias returns (e.g. calls to malloc)
880881// /
881- bool isIdentifiedObject (const Value *V);
882+ LLVM_ABI bool isIdentifiedObject (const Value *V);
882883
883884// / Return true if V is umabigously identified at the function-level.
884885// / Different IdentifiedFunctionLocals can't alias.
885886// / Further, an IdentifiedFunctionLocal can not alias with any function
886887// / arguments other than itself, which is not necessarily true for
887888// / IdentifiedObjects.
888- bool isIdentifiedFunctionLocal (const Value *V);
889+ LLVM_ABI bool isIdentifiedFunctionLocal (const Value *V);
889890
890891// / Return true if we know V to the base address of the corresponding memory
891892// / object. This implies that any address less than V must be out of bounds
892893// / for the underlying object. Note that just being isIdentifiedObject() is
893894// / not enough - For example, a negative offset from a noalias argument or call
894895// / can be inbounds w.r.t the actual underlying object.
895- bool isBaseOfObject (const Value *V);
896+ LLVM_ABI bool isBaseOfObject (const Value *V);
896897
897898// / Returns true if the pointer is one which would have been considered an
898899// / escape by isNonEscapingLocalObject.
899- bool isEscapeSource (const Value *V);
900+ LLVM_ABI bool isEscapeSource (const Value *V);
900901
901902// / Return true if Object memory is not visible after an unwind, in the sense
902903// / that program semantics cannot depend on Object containing any particular
903904// / value on unwind. If the RequiresNoCaptureBeforeUnwind out parameter is set
904905// / to true, then the memory is only not visible if the object has not been
905906// / 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,
907908 bool &RequiresNoCaptureBeforeUnwind);
908909
909910// / Return true if the Object is writable, in the sense that any location based
@@ -917,7 +918,7 @@ bool isNotVisibleOnUnwind(const Value *Object,
917918// / using the dereferenceable(N) attribute. It does not necessarily hold for
918919// / parts that are only known to be dereferenceable due to the presence of
919920// / loads.
920- bool isWritableObject (const Value *Object, bool &ExplicitlyDereferenceableOnly);
921+ LLVM_ABI bool isWritableObject (const Value *Object, bool &ExplicitlyDereferenceableOnly);
921922
922923// / A manager for alias analyses.
923924// /
@@ -950,7 +951,7 @@ class AAManager : public AnalysisInfoMixin<AAManager> {
950951 ResultGetters.push_back (&getModuleAAResultImpl<AnalysisT>);
951952 }
952953
953- Result run (Function &F, FunctionAnalysisManager &AM);
954+ LLVM_ABI Result run (Function &F, FunctionAnalysisManager &AM);
954955
955956private:
956957 friend AnalysisInfoMixin<AAManager>;
@@ -988,16 +989,16 @@ class AAResultsWrapperPass : public FunctionPass {
988989 std::unique_ptr<AAResults> AAR;
989990
990991public:
991- static char ID;
992+ LLVM_ABI static char ID;
992993
993- AAResultsWrapperPass ();
994+ LLVM_ABI AAResultsWrapperPass ();
994995
995996 AAResults &getAAResults () { return *AAR; }
996997 const AAResults &getAAResults () const { return *AAR; }
997998
998- bool runOnFunction (Function &F) override ;
999+ LLVM_ABI bool runOnFunction (Function &F) override ;
9991000
1000- void getAnalysisUsage (AnalysisUsage &AU) const override ;
1001+ LLVM_ABI void getAnalysisUsage (AnalysisUsage &AU) const override ;
10011002};
10021003
10031004// / A wrapper pass for external alias analyses. This just squirrels away the
@@ -1007,11 +1008,11 @@ struct ExternalAAWrapperPass : ImmutablePass {
10071008
10081009 CallbackT CB;
10091010
1010- static char ID;
1011+ LLVM_ABI static char ID;
10111012
1012- ExternalAAWrapperPass ();
1013+ LLVM_ABI ExternalAAWrapperPass ();
10131014
1014- explicit ExternalAAWrapperPass (CallbackT CB);
1015+ LLVM_ABI explicit ExternalAAWrapperPass (CallbackT CB);
10151016
10161017 void getAnalysisUsage (AnalysisUsage &AU) const override {
10171018 AU.setPreservesAll ();
@@ -1025,7 +1026,7 @@ struct ExternalAAWrapperPass : ImmutablePass {
10251026// / object, and will receive a reference to the function wrapper pass, the
10261027// / function, and the AAResults object to populate. This should be used when
10271028// / setting up a custom pass pipeline to inject a hook into the AA results.
1028- ImmutablePass *createExternalAAWrapperPass (
1029+ LLVM_ABI ImmutablePass *createExternalAAWrapperPass (
10291030 std::function<void (Pass &, Function &, AAResults &)> Callback);
10301031
10311032} // end namespace llvm
0 commit comments