LLVM  4.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 /// Computes function attributes in post-order over the call graph.
24 ///
25 /// By operating in post-order, this pass computes precise attributes for
26 /// called functions prior to processsing their callers. This "bottom-up"
27 /// approach allows powerful interprocedural inference of function attributes
28 /// like memory access patterns, etc. It can discover functions that do not
29 /// access memory, or only read memory, and give them the readnone/readonly
30 /// attribute. It also discovers function arguments that are not captured by
31 /// the function and marks them with the nocapture attribute.
32 struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> {
35 };
36 
37 /// Create a legacy pass manager instance of a pass to compute function attrs
38 /// in post-order.
40 
41 /// A pass to do RPO deduction and propagation of function attributes.
42 ///
43 /// This pass provides a general RPO or "top down" propagation of
44 /// function attributes. For a few (rare) cases, we can deduce significantly
45 /// more about function attributes by working in RPO, so this pass
46 /// provides the compliment to the post-order pass above where the majority of
47 /// deduction is performed.
48 // FIXME: Currently there is no RPO CGSCC pass structure to slide into and so
49 // this is a boring module pass, but eventually it should be an RPO CGSCC pass
50 // when such infrastructure is available.
52  : public PassInfoMixin<ReversePostOrderFunctionAttrsPass> {
53 public:
55 };
56 }
57 
58 #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:32
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:52
Implements a lazy call graph analysis and related passes for the new pass manager.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
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:51
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:311
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:107
Pass * createPostOrderFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to compute function attrs in post-order.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
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.