llvm.org GIT mirror llvm / f55c1c8
Rename BlockFrequency to BlockFrequencyInfo and MachineBlockFrequency to MachineBlockFrequencyInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135937 91177308-0d34-0410-b5e6-96231b3b80d8 Jakub Staszak 9 years ago
14 changed file(s) with 235 addition(s) and 234 deletion(s). Raw diff Collapse all Expand all
+0
-53
include/llvm/Analysis/BlockFrequency.h less more
None //========-------- BlockFrequency.h - Block Frequency Analysis -------========//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_ANALYSIS_BLOCKFREQUENCY_H
14 #define LLVM_ANALYSIS_BLOCKFREQUENCY_H
15
16 #include "llvm/Pass.h"
17 #include
18
19 namespace llvm {
20
21 class BranchProbabilityInfo;
22 template
23 class BlockFrequencyImpl;
24
25 /// BlockFrequency pass uses BlockFrequencyImpl implementation to estimate
26 /// IR basic block frequencies.
27 class BlockFrequency : public FunctionPass {
28
29 BlockFrequencyImpl *BFI;
30
31 public:
32 static char ID;
33
34 BlockFrequency();
35
36 ~BlockFrequency();
37
38 void getAnalysisUsage(AnalysisUsage &AU) const;
39
40 bool runOnFunction(Function &F);
41
42 /// getblockFreq - Return block frequency. Return 0 if we don't have the
43 /// information. Please note that initial frequency is equal to 1024. It means
44 /// that we should not rely on the value itself, but only on the comparison to
45 /// the other block frequencies. We do this to avoid using of floating points.
46 ///
47 uint32_t getBlockFreq(BasicBlock *BB);
48 };
49
50 }
51
52 #endif
2828 namespace llvm {
2929
3030
31 class BlockFrequency;
32 class MachineBlockFrequency;
31 class BlockFrequencyInfo;
32 class MachineBlockFrequencyInfo;
3333
3434 /// BlockFrequencyImpl implements block frequency algorithm for IR and
3535 /// Machine Instructions. Algorithm starts with value 1024 (START_FREQ)
262262 }
263263 }
264264
265 friend class BlockFrequency;
266 friend class MachineBlockFrequency;
265 friend class BlockFrequencyInfo;
266 friend class MachineBlockFrequencyInfo;
267267
268268 void doFunction(FunctionT *fn, BlockProbInfoT *bpi) {
269269 Fn = fn;
0 //========-------- BlockFrequencyInfo.h - Block Frequency Analysis -------========//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_ANALYSIS_BLOCKFREQUENCYINFO_H
14 #define LLVM_ANALYSIS_BLOCKFREQUENCYINFO_H
15
16 #include "llvm/Pass.h"
17 #include
18
19 namespace llvm {
20
21 class BranchProbabilityInfo;
22 template
23 class BlockFrequencyImpl;
24
25 /// BlockFrequencyInfo pass uses BlockFrequencyImpl implementation to estimate
26 /// IR basic block frequencies.
27 class BlockFrequencyInfo : public FunctionPass {
28
29 BlockFrequencyImpl *BFI;
30
31 public:
32 static char ID;
33
34 BlockFrequencyInfo();
35
36 ~BlockFrequencyInfo();
37
38 void getAnalysisUsage(AnalysisUsage &AU) const;
39
40 bool runOnFunction(Function &F);
41
42 /// getblockFreq - Return block frequency. Return 0 if we don't have the
43 /// information. Please note that initial frequency is equal to 1024. It means
44 /// that we should not rely on the value itself, but only on the comparison to
45 /// the other block frequencies. We do this to avoid using of floating points.
46 ///
47 uint32_t getBlockFreq(BasicBlock *BB);
48 };
49
50 }
51
52 #endif
+0
-53
include/llvm/CodeGen/MachineBlockFrequency.h less more
None //====----- MachineBlockFrequency.h - MachineBlock Frequency Analysis ----====//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_CODEGEN_MACHINEBLOCKFREQUENCY_H
14 #define LLVM_CODEGEN_MACHINEBLOCKFREQUENCY_H
15
16 #include "llvm/CodeGen/MachineFunctionPass.h"
17 #include
18
19 namespace llvm {
20
21 class MachineBranchProbabilityInfo;
22 template
23 class BlockFrequencyImpl;
24
25 /// MachineBlockFrequency pass uses BlockFrequencyImpl implementation to estimate
26 /// machine basic block frequencies.
27 class MachineBlockFrequency : public MachineFunctionPass {
28
29 BlockFrequencyImpl *MBFI;
30
31 public:
32 static char ID;
33
34 MachineBlockFrequency();
35
36 ~MachineBlockFrequency();
37
38 void getAnalysisUsage(AnalysisUsage &AU) const;
39
40 bool runOnMachineFunction(MachineFunction &F);
41
42 /// getblockFreq - Return block frequency. Return 0 if we don't have the
43 /// information. Please note that initial frequency is equal to 1024. It means
44 /// that we should not rely on the value itself, but only on the comparison to
45 /// the other block frequencies. We do this to avoid using of floating points.
46 ///
47 uint32_t getBlockFreq(MachineBasicBlock *MBB);
48 };
49
50 }
51
52 #endif
0 //====----- MachineBlockFrequencyInfo.h - MachineBlock Frequency Analysis ----====//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_CODEGEN_MACHINEBLOCKFREQUENCY_H
14 #define LLVM_CODEGEN_MACHINEBLOCKFREQUENCY_H
15
16 #include "llvm/CodeGen/MachineFunctionPass.h"
17 #include
18
19 namespace llvm {
20
21 class MachineBranchProbabilityInfo;
22 template
23 class BlockFrequencyImpl;
24
25 /// MachineBlockFrequencyInfo pass uses BlockFrequencyImpl implementation to estimate
26 /// machine basic block frequencies.
27 class MachineBlockFrequencyInfo : public MachineFunctionPass {
28
29 BlockFrequencyImpl *MBFI;
30
31 public:
32 static char ID;
33
34 MachineBlockFrequencyInfo();
35
36 ~MachineBlockFrequencyInfo();
37
38 void getAnalysisUsage(AnalysisUsage &AU) const;
39
40 bool runOnMachineFunction(MachineFunction &F);
41
42 /// getblockFreq - Return block frequency. Return 0 if we don't have the
43 /// information. Please note that initial frequency is equal to 1024. It means
44 /// that we should not rely on the value itself, but only on the comparison to
45 /// the other block frequencies. We do this to avoid using of floating points.
46 ///
47 uint32_t getBlockFreq(MachineBasicBlock *MBB);
48 };
49
50 }
51
52 #endif
6464 void initializeBasicAliasAnalysisPass(PassRegistry&);
6565 void initializeBasicCallGraphPass(PassRegistry&);
6666 void initializeBlockExtractorPassPass(PassRegistry&);
67 void initializeBlockFrequencyPass(PassRegistry&);
67 void initializeBlockFrequencyInfoPass(PassRegistry&);
6868 void initializeBlockPlacementPass(PassRegistry&);
6969 void initializeBranchProbabilityInfoPass(PassRegistry&);
7070 void initializeBreakCriticalEdgesPass(PassRegistry&);
144144 void initializeLowerInvokePass(PassRegistry&);
145145 void initializeLowerSetJmpPass(PassRegistry&);
146146 void initializeLowerSwitchPass(PassRegistry&);
147 void initializeMachineBlockFrequencyPass(PassRegistry&);
147 void initializeMachineBlockFrequencyInfoPass(PassRegistry&);
148148 void initializeMachineBranchProbabilityInfoPass(PassRegistry&);
149149 void initializeMachineCSEPass(PassRegistry&);
150150 void initializeMachineDominatorTreePass(PassRegistry&);
2222 initializeAliasSetPrinterPass(Registry);
2323 initializeNoAAPass(Registry);
2424 initializeBasicAliasAnalysisPass(Registry);
25 initializeBlockFrequencyPass(Registry);
25 initializeBlockFrequencyInfoPass(Registry);
2626 initializeBranchProbabilityInfoPass(Registry);
2727 initializeCFGViewerPass(Registry);
2828 initializeCFGPrinterPass(Registry);
+0
-59
lib/Analysis/BlockFrequency.cpp less more
None //=======-------- BlockFrequency.cpp - Block Frequency Analysis -------=======//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/InitializePasses.h"
14 #include "llvm/Analysis/BlockFrequencyImpl.h"
15 #include "llvm/Analysis/BlockFrequency.h"
16 #include "llvm/Analysis/LoopInfo.h"
17 #include "llvm/Analysis/Passes.h"
18 #include "llvm/Analysis/BranchProbabilityInfo.h"
19
20 using namespace llvm;
21
22 INITIALIZE_PASS_BEGIN(BlockFrequency, "block-freq", "Block Frequency Analysis",
23 true, true)
24 INITIALIZE_PASS_DEPENDENCY(BranchProbabilityInfo)
25 INITIALIZE_PASS_END(BlockFrequency, "block-freq", "Block Frequency Analysis",
26 true, true)
27
28 char BlockFrequency::ID = 0;
29
30
31 BlockFrequency::BlockFrequency() : FunctionPass(ID) {
32 initializeBlockFrequencyPass(*PassRegistry::getPassRegistry());
33 BFI = new BlockFrequencyImpl();
34 }
35
36 BlockFrequency::~BlockFrequency() {
37 delete BFI;
38 }
39
40 void BlockFrequency::getAnalysisUsage(AnalysisUsage &AU) const {
41 AU.addRequired();
42 AU.setPreservesAll();
43 }
44
45 bool BlockFrequency::runOnFunction(Function &F) {
46 BranchProbabilityInfo &BPI = getAnalysis();
47 BFI->doFunction(&F, &BPI);
48 return false;
49 }
50
51 /// getblockFreq - Return block frequency. Return 0 if we don't have the
52 /// information. Please note that initial frequency is equal to 1024. It means
53 /// that we should not rely on the value itself, but only on the comparison to
54 /// the other block frequencies. We do this to avoid using of floating points.
55 ///
56 uint32_t BlockFrequency::getBlockFreq(BasicBlock *BB) {
57 return BFI->getBlockFreq(BB);
58 }
0 //=======-------- BlockFrequencyInfo.cpp - Block Frequency Analysis -------=======//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/InitializePasses.h"
14 #include "llvm/Analysis/BlockFrequencyImpl.h"
15 #include "llvm/Analysis/BlockFrequencyInfo.h"
16 #include "llvm/Analysis/LoopInfo.h"
17 #include "llvm/Analysis/Passes.h"
18 #include "llvm/Analysis/BranchProbabilityInfo.h"
19
20 using namespace llvm;
21
22 INITIALIZE_PASS_BEGIN(BlockFrequencyInfo, "block-freq", "Block Frequency Analysis",
23 true, true)
24 INITIALIZE_PASS_DEPENDENCY(BranchProbabilityInfo)
25 INITIALIZE_PASS_END(BlockFrequencyInfo, "block-freq", "Block Frequency Analysis",
26 true, true)
27
28 char BlockFrequencyInfo::ID = 0;
29
30
31 BlockFrequencyInfo::BlockFrequencyInfo() : FunctionPass(ID) {
32 initializeBlockFrequencyInfoPass(*PassRegistry::getPassRegistry());
33 BFI = new BlockFrequencyImpl();
34 }
35
36 BlockFrequencyInfo::~BlockFrequencyInfo() {
37 delete BFI;
38 }
39
40 void BlockFrequencyInfo::getAnalysisUsage(AnalysisUsage &AU) const {
41 AU.addRequired();
42 AU.setPreservesAll();
43 }
44
45 bool BlockFrequencyInfo::runOnFunction(Function &F) {
46 BranchProbabilityInfo &BPI = getAnalysis();
47 BFI->doFunction(&F, &BPI);
48 return false;
49 }
50
51 /// getblockFreq - Return block frequency. Return 0 if we don't have the
52 /// information. Please note that initial frequency is equal to 1024. It means
53 /// that we should not rely on the value itself, but only on the comparison to
54 /// the other block frequencies. We do this to avoid using of floating points.
55 ///
56 uint32_t BlockFrequencyInfo::getBlockFreq(BasicBlock *BB) {
57 return BFI->getBlockFreq(BB);
58 }
55 AliasSetTracker.cpp
66 Analysis.cpp
77 BasicAliasAnalysis.cpp
8 BlockFrequency.cpp
8 BlockFrequencyInfo.cpp
99 BranchProbabilityInfo.cpp
1010 CFGPrinter.cpp
1111 CaptureTracking.cpp
3232 LocalStackSlotAllocation.cpp
3333 LowerSubregs.cpp
3434 MachineBasicBlock.cpp
35 MachineBlockFrequency.cpp
35 MachineBlockFrequencyInfo.cpp
3636 MachineBranchProbabilityInfo.cpp
3737 MachineCSE.cpp
3838 MachineDominators.cpp
2626 initializeLiveIntervalsPass(Registry);
2727 initializeLiveStacksPass(Registry);
2828 initializeLiveVariablesPass(Registry);
29 initializeMachineBlockFrequencyInfoPass(Registry);
2930 initializeMachineCSEPass(Registry);
3031 initializeMachineDominatorTreePass(Registry);
3132 initializeMachineLICMPass(Registry);
+0
-60
lib/CodeGen/MachineBlockFrequency.cpp less more
None //====----- MachineBlockFrequency.cpp - Machine Block Frequency Analysis ----====//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/InitializePasses.h"
14 #include "llvm/Analysis/BlockFrequencyImpl.h"
15 #include "llvm/CodeGen/MachineBlockFrequency.h"
16 #include "llvm/CodeGen/Passes.h"
17 #include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
18
19 using namespace llvm;
20
21 INITIALIZE_PASS_BEGIN(MachineBlockFrequency, "machine-block-freq",
22 "Machine Block Frequency Analysis", true, true)
23 INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo)
24 INITIALIZE_PASS_END(MachineBlockFrequency, "machine-block-freq",
25 "Machine Block Frequency Analysis", true, true)
26
27 char MachineBlockFrequency::ID = 0;
28
29
30 MachineBlockFrequency::MachineBlockFrequency() : MachineFunctionPass(ID) {
31 initializeMachineBlockFrequencyPass(*PassRegistry::getPassRegistry());
32 MBFI = new BlockFrequencyImpl
33 MachineBranchProbabilityInfo>();
34 }
35
36 MachineBlockFrequency::~MachineBlockFrequency() {
37 delete MBFI;
38 }
39
40 void MachineBlockFrequency::getAnalysisUsage(AnalysisUsage &AU) const {
41 AU.addRequired();
42 AU.setPreservesAll();
43 MachineFunctionPass::getAnalysisUsage(AU);
44 }
45
46 bool MachineBlockFrequency::runOnMachineFunction(MachineFunction &F) {
47 MachineBranchProbabilityInfo &MBPI = getAnalysis();
48 MBFI->doFunction(&F, &MBPI);
49 return false;
50 }
51
52 /// getblockFreq - Return block frequency. Return 0 if we don't have the
53 /// information. Please note that initial frequency is equal to 1024. It means
54 /// that we should not rely on the value itself, but only on the comparison to
55 /// the other block frequencies. We do this to avoid using of floating points.
56 ///
57 uint32_t MachineBlockFrequency::getBlockFreq(MachineBasicBlock *MBB) {
58 return MBFI->getBlockFreq(MBB);
59 }
0 //====----- MachineBlockFrequencyInfo.cpp - Machine Block Frequency Analysis ----====//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Loops should be simplified before this analysis.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/InitializePasses.h"
14 #include "llvm/Analysis/BlockFrequencyImpl.h"
15 #include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
16 #include "llvm/CodeGen/Passes.h"
17 #include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
18
19 using namespace llvm;
20
21 INITIALIZE_PASS_BEGIN(MachineBlockFrequencyInfo, "machine-block-freq",
22 "Machine Block Frequency Analysis", true, true)
23 INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo)
24 INITIALIZE_PASS_END(MachineBlockFrequencyInfo, "machine-block-freq",
25 "Machine Block Frequency Analysis", true, true)
26
27 char MachineBlockFrequencyInfo::ID = 0;
28
29
30 MachineBlockFrequencyInfo::MachineBlockFrequencyInfo() : MachineFunctionPass(ID) {
31 initializeMachineBlockFrequencyInfoPass(*PassRegistry::getPassRegistry());
32 MBFI = new BlockFrequencyImpl
33 MachineBranchProbabilityInfo>();
34 }
35
36 MachineBlockFrequencyInfo::~MachineBlockFrequencyInfo() {
37 delete MBFI;
38 }
39
40 void MachineBlockFrequencyInfo::getAnalysisUsage(AnalysisUsage &AU) const {
41 AU.addRequired();
42 AU.setPreservesAll();
43 MachineFunctionPass::getAnalysisUsage(AU);
44 }
45
46 bool MachineBlockFrequencyInfo::runOnMachineFunction(MachineFunction &F) {
47 MachineBranchProbabilityInfo &MBPI = getAnalysis();
48 MBFI->doFunction(&F, &MBPI);
49 return false;
50 }
51
52 /// getblockFreq - Return block frequency. Return 0 if we don't have the
53 /// information. Please note that initial frequency is equal to 1024. It means
54 /// that we should not rely on the value itself, but only on the comparison to
55 /// the other block frequencies. We do this to avoid using of floating points.
56 ///
57 uint32_t MachineBlockFrequencyInfo::getBlockFreq(MachineBasicBlock *MBB) {
58 return MBFI->getBlockFreq(MBB);
59 }