|
|
|||
File indexing completed on 2026-05-10 08:43:15
0001 //===- ObjCARCAliasAnalysis.h - ObjC ARC Alias Analysis ---------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 /// \file 0009 /// This file declares a simple ARC-aware AliasAnalysis using special knowledge 0010 /// of Objective C to enhance other optimization passes which rely on the Alias 0011 /// Analysis infrastructure. 0012 /// 0013 /// WARNING: This file knows about certain library functions. It recognizes them 0014 /// by name, and hardwires knowledge of their semantics. 0015 /// 0016 /// WARNING: This file knows about how certain Objective-C library functions are 0017 /// used. Naive LLVM IR transformations which would otherwise be 0018 /// behavior-preserving may break these assumptions. 0019 /// 0020 //===----------------------------------------------------------------------===// 0021 0022 #ifndef LLVM_ANALYSIS_OBJCARCALIASANALYSIS_H 0023 #define LLVM_ANALYSIS_OBJCARCALIASANALYSIS_H 0024 0025 #include "llvm/Analysis/AliasAnalysis.h" 0026 0027 namespace llvm { 0028 namespace objcarc { 0029 0030 /// This is a simple alias analysis implementation that uses knowledge 0031 /// of ARC constructs to answer queries. 0032 /// 0033 /// TODO: This class could be generalized to know about other ObjC-specific 0034 /// tricks. Such as knowing that ivars in the non-fragile ABI are non-aliasing 0035 /// even though their offsets are dynamic. 0036 class ObjCARCAAResult : public AAResultBase { 0037 const DataLayout &DL; 0038 0039 public: 0040 explicit ObjCARCAAResult(const DataLayout &DL) : DL(DL) {} 0041 ObjCARCAAResult(ObjCARCAAResult &&Arg) 0042 : AAResultBase(std::move(Arg)), DL(Arg.DL) {} 0043 0044 /// Handle invalidation events from the new pass manager. 0045 /// 0046 /// By definition, this result is stateless and so remains valid. 0047 bool invalidate(Function &, const PreservedAnalyses &, 0048 FunctionAnalysisManager::Invalidator &) { 0049 return false; 0050 } 0051 0052 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, 0053 AAQueryInfo &AAQI, const Instruction *CtxI); 0054 ModRefInfo getModRefInfoMask(const MemoryLocation &Loc, AAQueryInfo &AAQI, 0055 bool IgnoreLocals); 0056 0057 using AAResultBase::getMemoryEffects; 0058 MemoryEffects getMemoryEffects(const Function *F); 0059 0060 using AAResultBase::getModRefInfo; 0061 ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, 0062 AAQueryInfo &AAQI); 0063 }; 0064 0065 /// Analysis pass providing a never-invalidated alias analysis result. 0066 class ObjCARCAA : public AnalysisInfoMixin<ObjCARCAA> { 0067 friend AnalysisInfoMixin<ObjCARCAA>; 0068 static AnalysisKey Key; 0069 0070 public: 0071 typedef ObjCARCAAResult Result; 0072 0073 ObjCARCAAResult run(Function &F, FunctionAnalysisManager &AM); 0074 }; 0075 0076 } // namespace objcarc 0077 } // namespace llvm 0078 0079 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|