LLVM  13.0.0git
SCCP.h
Go to the documentation of this file.
1 //===- SCCP.cpp - Sparse Conditional Constant Propagation -------*- 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 // This file implements sparse conditional constant propagation and merging:
11 //
12 // Specifically, this:
13 // * Assumes values are constant unless proven otherwise
14 // * Assumes BasicBlocks are dead unless proven otherwise
15 // * Proves values to be constant, and replaces them with constants
16 // * Proves conditional branches to be unconditional
17 //
18 //===----------------------------------------------------------------------===//
19 
20 #ifndef LLVM_TRANSFORMS_SCALAR_SCCP_H
21 #define LLVM_TRANSFORMS_SCALAR_SCCP_H
22 
23 #include "llvm/ADT/STLExtras.h"
25 #include "llvm/IR/DataLayout.h"
26 #include "llvm/IR/Function.h"
27 #include "llvm/IR/Module.h"
28 #include "llvm/IR/PassManager.h"
30 
31 namespace llvm {
32 
33 class PostDominatorTree;
34 
35 /// This pass performs function-level constant propagation and merging.
36 class SCCPPass : public PassInfoMixin<SCCPPass> {
37 public:
39 };
40 
41 /// Helper struct for bundling up the analysis results per function for IPSCCP.
43  std::unique_ptr<PredicateInfo> PredInfo;
46 };
47 
48 bool runIPSCCP(Module &M, const DataLayout &DL,
49  std::function<const TargetLibraryInfo &(Function &)> GetTLI,
51 } // end namespace llvm
52 
53 #endif // LLVM_TRANSFORMS_SCALAR_SCCP_H
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm::AnalysisResultsForFn::PDT
PostDominatorTree * PDT
Definition: SCCP.h:45
llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:111
PredicateInfo.h
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
llvm::AnalysisResultsForFn
Helper struct for bundling up the analysis results per function for IPSCCP.
Definition: SCCP.h:42
llvm::Function
Definition: Function.h:61
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:151
Module.h
STLExtras.h
F
#define F(x, y, z)
Definition: MD5.cpp:56
TargetLibraryInfo.h
llvm::AnalysisResultsForFn::PredInfo
std::unique_ptr< PredicateInfo > PredInfo
Definition: SCCP.h:43
llvm::runIPSCCP
bool runIPSCCP(Module &M, const DataLayout &DL, std::function< const TargetLibraryInfo &(Function &)> GetTLI, function_ref< AnalysisResultsForFn(Function &)> getAnalysis)
Definition: SCCP.cpp:1927
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:176
llvm::SCCPPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: SCCP.cpp:1752
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
DataLayout.h
llvm::PostDominatorTree
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
Definition: PostDominators.h:28
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::SCCPPass
This pass performs function-level constant propagation and merging.
Definition: SCCP.h:36
Function.h
PassManager.h
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition: TargetLibraryInfo.h:202
llvm::AnalysisResultsForFn::DT
DominatorTree * DT
Definition: SCCP.h:44
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:43