LLVM 19.0.0git
ObjCARCAliasAnalysis.h
Go to the documentation of this file.
1//===- ObjCARCAliasAnalysis.h - ObjC ARC Alias Analysis ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file
9/// This file declares a simple ARC-aware AliasAnalysis using special knowledge
10/// of Objective C to enhance other optimization passes which rely on the Alias
11/// Analysis infrastructure.
12///
13/// WARNING: This file knows about certain library functions. It recognizes them
14/// by name, and hardwires knowledge of their semantics.
15///
16/// WARNING: This file knows about how certain Objective-C library functions are
17/// used. Naive LLVM IR transformations which would otherwise be
18/// behavior-preserving may break these assumptions.
19///
20//===----------------------------------------------------------------------===//
21
22#ifndef LLVM_ANALYSIS_OBJCARCALIASANALYSIS_H
23#define LLVM_ANALYSIS_OBJCARCALIASANALYSIS_H
24
26#include "llvm/Pass.h"
27
28namespace llvm {
29namespace objcarc {
30
31/// This is a simple alias analysis implementation that uses knowledge
32/// of ARC constructs to answer queries.
33///
34/// TODO: This class could be generalized to know about other ObjC-specific
35/// tricks. Such as knowing that ivars in the non-fragile ABI are non-aliasing
36/// even though their offsets are dynamic.
38 const DataLayout &DL;
39
40public:
41 explicit ObjCARCAAResult(const DataLayout &DL) : DL(DL) {}
43 : AAResultBase(std::move(Arg)), DL(Arg.DL) {}
44
45 /// Handle invalidation events from the new pass manager.
46 ///
47 /// By definition, this result is stateless and so remains valid.
50 return false;
51 }
52
53 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
54 AAQueryInfo &AAQI, const Instruction *CtxI);
56 bool IgnoreLocals);
57
60
63 AAQueryInfo &AAQI);
64};
65
66/// Analysis pass providing a never-invalidated alias analysis result.
67class ObjCARCAA : public AnalysisInfoMixin<ObjCARCAA> {
69 static AnalysisKey Key;
70
71public:
73
75};
76
77} // namespace objcarc
78} // namespace llvm
79
80#endif
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define F(x, y, z)
Definition: MD5.cpp:55
This class stores info we want to provide to or retain within an alias query.
A base class to help implement the function alias analysis results concept.
MemoryEffects getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI)
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)
The possible results of an alias query.
Definition: AliasAnalysis.h:81
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:360
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:321
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1494
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
Representation for a specific memory location.
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:109
This is a simple alias analysis implementation that uses knowledge of ARC constructs to answer querie...
MemoryEffects getMemoryEffects(const Function *F)
ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI, bool IgnoreLocals)
ObjCARCAAResult(ObjCARCAAResult &&Arg)
ObjCARCAAResult(const DataLayout &DL)
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
Handle invalidation events from the new pass manager.
Analysis pass providing a never-invalidated alias analysis result.
ObjCARCAAResult run(Function &F, FunctionAnalysisManager &AM)
@ Call
could call objc_release
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition: ModRef.h:27
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1849
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:97
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:26