LLVM 20.0.0git
SpeculateAnalyses.h
Go to the documentation of this file.
1//===-- SpeculateAnalyses.h --*- 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/// \file
9/// Contains the Analyses and Result Interpretation to select likely functions
10/// to Speculatively compile before they are called. [Purely Experimentation]
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_SPECULATEANALYSES_H
14#define LLVM_EXECUTIONENGINE_ORC_SPECULATEANALYSES_H
15
19
20namespace llvm {
21
22namespace orc {
23
24// Provides common code.
26protected:
28 bool isStraightLine(const Function &F);
29
30public:
31 using ResultTy = std::optional<DenseMap<StringRef, DenseSet<StringRef>>>;
32};
33
34// Direct calls in high frequency basic blocks are extracted.
36 size_t numBBToGet(size_t);
37
38public:
39 // Find likely next executables based on IR Block Frequency
41};
42
43// This Query generates a sequence of basic blocks which follows the order of
44// execution.
45// A handful of BB with higher block frequencies are taken, then path to entry
46// and end BB are discovered by traversing up & down the CFG.
48 struct WalkDirection {
49 bool Upward = true, Downward = true;
50 // the block associated contain a call
51 bool CallerBlock = false;
52 };
53
54public:
61
62private:
63 std::size_t getHottestBlocks(std::size_t TotalBlocks);
64 BlockListTy rearrangeBB(const Function &, const BlockListTy &);
65 BlockListTy queryCFG(Function &, const BlockListTy &);
66 void traverseToEntryBlock(const BasicBlock *, const BlockListTy &,
67 const BackEdgesInfoTy &,
70 void traverseToExitBlock(const BasicBlock *, const BlockListTy &,
71 const BackEdgesInfoTy &,
74
75public:
77};
78
79} // namespace orc
80} // namespace llvm
81
82#endif // LLVM_EXECUTIONENGINE_ORC_SPECULATEANALYSES_H
#define F(x, y, z)
Definition: MD5.cpp:55
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
Analysis providing branch probability information.
Implements a dense probed hash-table based set.
Definition: DenseSet.h:278
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
ResultTy operator()(Function &F)
ResultTy operator()(Function &F)
std::optional< DenseMap< StringRef, DenseSet< StringRef > > > ResultTy
bool isStraightLine(const Function &F)
void findCalles(const BasicBlock *, DenseSet< StringRef > &)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18