LLVM  15.0.0git
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 
21 #include "llvm/IR/PassManager.h"
22 
23 namespace llvm {
24 
25 class GlobalValueSummary;
26 class ModuleSummaryIndex;
27 class Function;
28 class Module;
29 class Pass;
30 
31 /// Returns the memory access properties of this copy of the function.
33  AAResults &AAR);
34 
35 /// Propagate function attributes for function summaries along the index's
36 /// callgraph during thinlink
38  ModuleSummaryIndex &Index,
39  function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
40  isPrevailing);
41 
42 /// Computes function attributes in post-order over the call graph.
43 ///
44 /// By operating in post-order, this pass computes precise attributes for
45 /// called functions prior to processsing their callers. This "bottom-up"
46 /// approach allows powerful interprocedural inference of function attributes
47 /// like memory access patterns, etc. It can discover functions that do not
48 /// access memory, or only read memory, and give them the readnone/readonly
49 /// attribute. It also discovers function arguments that are not captured by
50 /// the function and marks them with the nocapture attribute.
51 struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> {
54 };
55 
56 /// Create a legacy pass manager instance of a pass to compute function attrs
57 /// in post-order.
59 
60 /// A pass to do RPO deduction and propagation of function attributes.
61 ///
62 /// This pass provides a general RPO or "top down" propagation of
63 /// function attributes. For a few (rare) cases, we can deduce significantly
64 /// more about function attributes by working in RPO, so this pass
65 /// provides the complement to the post-order pass above where the majority of
66 /// deduction is performed.
67 // FIXME: Currently there is no RPO CGSCC pass structure to slide into and so
68 // this is a boring module pass, but eventually it should be an RPO CGSCC pass
69 // when such infrastructure is available.
71  : public PassInfoMixin<ReversePostOrderFunctionAttrsPass> {
72 public:
74 };
75 
76 } // end namespace llvm
77 
78 #endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H
llvm::GlobalValue::GUID
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
Definition: GlobalValue.h:508
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1978
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:371
llvm::ReversePostOrderFunctionAttrsPass
A pass to do RPO deduction and propagation of function attributes.
Definition: FunctionAttrs.h:70
F
#define F(x, y, z)
Definition: MD5.cpp:55
AliasAnalysis.h
llvm::LazyCallGraph::SCC
An SCC of the call graph.
Definition: LazyCallGraph.h:419
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::PostOrderFunctionAttrsPass
Computes function attributes in post-order over the call graph.
Definition: FunctionAttrs.h:51
LazyCallGraph.h
Index
uint32_t Index
Definition: ELFObjHandler.cpp:82
CGSCCPassManager.h
llvm::ReversePostOrderFunctionAttrsPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: FunctionAttrs.cpp:2066
llvm::createPostOrderFunctionAttrsLegacyPass
Pass * createPostOrderFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to compute function attrs in post-order.
Definition: FunctionAttrs.cpp:1943
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::computeFunctionBodyMemoryAccess
FunctionModRefBehavior computeFunctionBodyMemoryAccess(Function &F, AAResults &AAR)
Returns the memory access properties of this copy of the function.
Definition: FunctionAttrs.cpp:256
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::FunctionModRefBehavior
FunctionModRefBehavior
Summary of how a function affects memory in the program.
Definition: AliasAnalysis.h:262
llvm::CGSCCUpdateResult
Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager...
Definition: CGSCCPassManager.h:232
llvm::PostOrderFunctionAttrsPass::run
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR)
Definition: FunctionAttrs.cpp:1863
llvm::thinLTOPropagateFunctionAttrs
bool thinLTOPropagateFunctionAttrs(ModuleSummaryIndex &Index, function_ref< bool(GlobalValue::GUID, const GlobalValueSummary *)> isPrevailing)
Propagate function attributes for function summaries along the index's callgraph during thinlink.
Definition: FunctionAttrs.cpp:458
PassManager.h
llvm::Pass
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:91
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
llvm::LazyCallGraph
A lazily constructed view of the call graph of a module.
Definition: LazyCallGraph.h:110
llvm::codeview::PublicSymFlags::Function
@ Function