74#ifndef LLVM_TRANSFORMS_IPO_FUNCTIONSPECIALIZATION_H
75#define LLVM_TRANSFORMS_IPO_FUNCTIONSPECIALIZATION_H
151 int64_t Ltc = *
Latency.getValue();
153 assert(Sz >= 0 && Ltc >= 0 &&
"CodeSize and Latency cannot be negative");
156 this->CodeSize =
static_cast<unsigned>(Sz);
157 this->Latency =
static_cast<unsigned>(Ltc);
197 :
DL(
DL), BFI(BFI),
TTI(
TTI), Solver(Solver) {}
233 bool discoverTransitivelyIncomingValues(
Constant *Const,
PHINode *Root,
269 unsigned NGlobals = 0;
278 : Solver(Solver), M(M),
FAM(
FAM), GetBFI(GetBFI), GetTLI(GetTLI),
279 GetTTI(GetTTI), GetAC(GetAC) {}
286 auto &BFI = GetBFI(*
F);
287 auto &
TTI = GetTTI(*
F);
301 void promoteConstantStackValues(
Function *
F);
304 void removeDeadFunctions();
315 bool findSpecializations(
Function *
F,
unsigned FuncSize,
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
FunctionAnalysisManager FAM
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
an instruction to allocate memory on the stack
A container for analyses that lazily runs them and caches their results.
This class represents an incoming formal argument to a Function.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Conditional or Unconditional Branch instruction.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This class represents a function call, abstracting a target machine's calling convention.
This is the base class for all instructions that perform data casts.
This class is the base class for the comparison instructions.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Implements a dense probed hash-table based set.
This class represents a freeze function that returns random concrete value if an operand is either a ...
bool run()
Attempt to specialize functions in the module to enable constant propagation across function boundari...
FunctionSpecializer(SCCPSolver &Solver, Module &M, FunctionAnalysisManager *FAM, std::function< BlockFrequencyInfo &(Function &)> GetBFI, std::function< const TargetLibraryInfo &(Function &)> GetTLI, std::function< TargetTransformInfo &(Function &)> GetTTI, std::function< AssumptionCache &(Function &)> GetAC)
InstCostVisitor getInstCostVisitorFor(Function *F)
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
bool isBlockExecutable(BasicBlock *BB)
Bonus getSpecializationBonus(Argument *A, Constant *C)
Compute a bonus for replacing argument A with constant C.
InstCostVisitor(const DataLayout &DL, BlockFrequencyInfo &BFI, TargetTransformInfo &TTI, SCCPSolver &Solver)
Bonus getBonusFromPendingPHIs()
Base class for instruction visitors.
An instruction for reading from memory.
A Module instance is used to store all the information related to an LLVM module.
SCCPSolver - This interface class is a general purpose solver for Sparse Conditional Constant Propaga...
bool isBlockExecutable(BasicBlock *BB) const
This class represents the LLVM 'select' instruction.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Provides information about what library functions are available for the current target.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
bool contains(const_arg_type_t< ValueT > V) const
Check if the set contains the given element.
An opaque object representing a hash code.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
bool operator==(const Bonus RHS) const
Bonus(Cost CodeSize, Cost Latency)
Bonus operator+(const Bonus RHS) const
Bonus & operator+=(const Bonus RHS)
SmallVector< ArgInfo, 4 > Args
bool operator==(const SpecSig &Other) const
friend hash_code hash_value(const SpecSig &S)
SmallVector< CallBase * > CallSites
Spec(Function *F, const SpecSig &S, unsigned Score)
Spec(Function *F, const SpecSig &&S, unsigned Score)