LLVM  9.0.0svn
FunctionAttrs.h
Go to the documentation of this file.
1 //===- FunctionAttrs.h - Compute function attributes ------------*- 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 //
9 /// \file
10 /// Provides passes for computing function attributes based on interprocedural
11 /// analyses.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H
16 #define LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H
17 
20 #include "llvm/IR/PassManager.h"
21 
22 namespace llvm {
23 
24 class AAResults;
25 class Function;
26 class Module;
27 class Pass;
28 
29 /// The three kinds of memory access relevant to 'readonly' and
30 /// 'readnone' attributes.
36 };
37 
38 /// Returns the memory access properties of this copy of the function.
40 
41 /// Computes function attributes in post-order over the call graph.
42 ///
43 /// By operating in post-order, this pass computes precise attributes for
44 /// called functions prior to processsing their callers. This "bottom-up"
45 /// approach allows powerful interprocedural inference of function attributes
46 /// like memory access patterns, etc. It can discover functions that do not
47 /// access memory, or only read memory, and give them the readnone/readonly
48 /// attribute. It also discovers function arguments that are not captured by
49 /// the function and marks them with the nocapture attribute.
50 struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> {
53 };
54 
55 /// Create a legacy pass manager instance of a pass to compute function attrs
56 /// in post-order.
58 
59 /// A pass to do RPO deduction and propagation of function attributes.
60 ///
61 /// This pass provides a general RPO or "top down" propagation of
62 /// function attributes. For a few (rare) cases, we can deduce significantly
63 /// more about function attributes by working in RPO, so this pass
64 /// provides the complement to the post-order pass above where the majority of
65 /// deduction is performed.
66 // FIXME: Currently there is no RPO CGSCC pass structure to slide into and so
67 // this is a boring module pass, but eventually it should be an RPO CGSCC pass
68 // when such infrastructure is available.
70  : public PassInfoMixin<ReversePostOrderFunctionAttrsPass> {
71 public:
73 };
74 
75 } // end namespace llvm
76 
77 #endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H
Pass interface - Implemented by all &#39;passes&#39;.
Definition: Pass.h:80
uint64_t CallInst * C
Computes function attributes in post-order over the call graph.
Definition: FunctionAttrs.h:50
MemoryAccessKind
The three kinds of memory access relevant to &#39;readonly&#39; and &#39;readnone&#39; attributes.
Definition: FunctionAttrs.h:31
This class represents lattice values for constants.
Definition: AllocatorList.h:23
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
Implements a lazy call graph analysis and related passes for the new pass manager.
F(f)
MemoryAccessKind computeFunctionBodyMemoryAccess(Function &F, AAResults &AAR)
Returns the memory access properties of this copy of the function.
Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager...
A pass to do RPO deduction and propagation of function attributes.
Definition: FunctionAttrs.h:69
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:372
A lazily constructed view of the call graph of a module.
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:153
Pass * createPostOrderFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to compute function attrs in post-order.
print lazy value Lazy Value Info Printer Pass
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR)
This header provides classes for managing passes over SCCs of the call graph.
An SCC of the call graph.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.