Skip to content

Commit f09470c

Browse files
committed
[llvm] IDS auto codemod for Analysis library
1 parent 864f0ff commit f09470c

File tree

82 files changed

+1593
-1514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1593
-1514
lines changed

llvm/include/llvm/Analysis/AliasAnalysis.h

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
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,10 +143,10 @@ 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.
148-
struct CaptureAnalysis {
149+
struct LLVM_ABI CaptureAnalysis {
149150
virtual ~CaptureAnalysis() = 0;
150151

151152
/// Check whether Object is not captured before instruction I. If OrAt is
@@ -159,7 +160,7 @@ struct CaptureAnalysis {
159160
/// Context-free CaptureAnalysis provider, which computes and caches whether an
160161
/// object is captured in the function at all, but does not distinguish whether
161162
/// it was captured before or after the context instruction.
162-
class SimpleCaptureAnalysis final : public CaptureAnalysis {
163+
class LLVM_ABI SimpleCaptureAnalysis final : public CaptureAnalysis {
163164
SmallDenseMap<const Value *, bool, 8> IsCapturedCache;
164165

165166
public:
@@ -170,7 +171,7 @@ class SimpleCaptureAnalysis final : public CaptureAnalysis {
170171
/// Context-sensitive CaptureAnalysis provider, which computes and caches the
171172
/// earliest common dominator closure of all captures. It provides a good
172173
/// approximation to a precise "captures before" analysis.
173-
class EarliestEscapeAnalysis final : public CaptureAnalysis {
174+
class LLVM_ABI EarliestEscapeAnalysis final : public CaptureAnalysis {
174175
DominatorTree &DT;
175176
const LoopInfo *LI;
176177

@@ -315,9 +316,9 @@ class AAResults {
315316
public:
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

614615
private:
615616
class Concept;
@@ -708,7 +709,7 @@ using AliasAnalysis = AAResults;
708709
/// All of these methods model methods by the same name in the \c
709710
/// AAResults class. Only differences and specifics to how the
710711
/// implementations are called are documented here.
711-
class AAResults::Concept {
712+
class LLVM_ABI AAResults::Concept {
712713
public:
713714
virtual ~Concept() = 0;
714715

@@ -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

955956
private:
956957
friend AnalysisInfoMixin<AAManager>;
@@ -984,7 +985,7 @@ class AAManager : public AnalysisInfoMixin<AAManager> {
984985

985986
/// A wrapper pass to provide the legacy pass manager access to a suitably
986987
/// prepared AAResults object.
987-
class AAResultsWrapperPass : public FunctionPass {
988+
class LLVM_ABI AAResultsWrapperPass : public FunctionPass {
988989
std::unique_ptr<AAResults> AAR;
989990

990991
public:
@@ -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
/// Returns whether this external AA should run before Basic AA.
10171018
///
@@ -1037,7 +1038,7 @@ struct ExternalAAWrapperPass : ImmutablePass {
10371038
/// object, and will receive a reference to the function wrapper pass, the
10381039
/// function, and the AAResults object to populate. This should be used when
10391040
/// setting up a custom pass pipeline to inject a hook into the AA results.
1040-
ImmutablePass *createExternalAAWrapperPass(
1041+
LLVM_ABI ImmutablePass *createExternalAAWrapperPass(
10411042
std::function<void(Pass &, Function &, AAResults &)> Callback);
10421043

10431044
} // end namespace llvm

llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#ifndef LLVM_ANALYSIS_ALIASANALYSISEVALUATOR_H
2525
#define LLVM_ANALYSIS_ALIASANALYSISEVALUATOR_H
2626

27+
#include "llvm/Support/Compiler.h"
2728
#include "llvm/IR/PassManager.h"
2829

2930
namespace llvm {
@@ -47,10 +48,10 @@ class AAEvaluator : public PassInfoMixin<AAEvaluator> {
4748
ModRefCount(Arg.ModRefCount) {
4849
Arg.FunctionCount = 0;
4950
}
50-
~AAEvaluator();
51+
LLVM_ABI ~AAEvaluator();
5152

5253
/// Run the pass over the function.
53-
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
54+
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
5455

5556
private:
5657
void runInternal(Function &F, AAResults &AA);

0 commit comments

Comments
 (0)