LLVM  5.0.0
FunctionAttrs.h
Go to the documentation of this file.
1 //===-- FunctionAttrs.h - Compute function attrs --------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 /// Provides passes for computing function attributes based on interprocedural
11 /// analyses.
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H
15 #define LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H
16 
19 #include "llvm/IR/PassManager.h"
20 
21 namespace llvm {
22 
23 class AAResults;
24 
25 /// The three kinds of memory access relevant to 'readonly' and
26 /// 'readnone' attributes.
31 };
32 
33 /// Returns the memory access properties of this copy of the function.
34 MemoryAccessKind computeFunctionBodyMemoryAccess(Function &F, AAResults &AAR);
35 
36 /// Computes function attributes in post-order over the call graph.
37 ///
38 /// By operating in post-order, this pass computes precise attributes for
39 /// called functions prior to processsing their callers. This "bottom-up"
40 /// approach allows powerful interprocedural inference of function attributes
41 /// like memory access patterns, etc. It can discover functions that do not
42 /// access memory, or only read memory, and give them the readnone/readonly
43 /// attribute. It also discovers function arguments that are not captured by
44 /// the function and marks them with the nocapture attribute.
45 struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> {
48 };
49 
50 /// Create a legacy pass manager instance of a pass to compute function attrs
51 /// in post-order.
53 
54 /// A pass to do RPO deduction and propagation of function attributes.
55 ///
56 /// This pass provides a general RPO or "top down" propagation of
57 /// function attributes. For a few (rare) cases, we can deduce significantly
58 /// more about function attributes by working in RPO, so this pass
59 /// provides the complement to the post-order pass above where the majority of
60 /// deduction is performed.
61 // FIXME: Currently there is no RPO CGSCC pass structure to slide into and so
62 // this is a boring module pass, but eventually it should be an RPO CGSCC pass
63 // when such infrastructure is available.
65  : public PassInfoMixin<ReversePostOrderFunctionAttrsPass> {
66 public:
68 };
69 }
70 
71 #endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:81
Computes function attributes in post-order over the call graph.
Definition: FunctionAttrs.h:45
MemoryAccessKind
The three kinds of memory access relevant to 'readonly' and 'readnone' attributes.
Definition: FunctionAttrs.h:27
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
Implements a lazy call graph analysis and related passes for the new pass manager.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
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:64
#define F(x, y, z)
Definition: MD5.cpp:55
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:365
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.
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR)
#define C
Definition: LargeTest.cpp:25
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.