From 875ebd5f5d6fa0d447244d376cc95853b652bca6 Mon Sep 17 00:00:00 2001 From: Jakub Staszak Date: Mon, 25 Jul 2011 19:25:40 +0000 Subject: Rename BlockFrequency to BlockFrequencyInfo and MachineBlockFrequency to MachineBlockFrequencyInfo. llvm-svn: 135937 --- llvm/lib/CodeGen/CMakeLists.txt | 2 +- llvm/lib/CodeGen/CodeGen.cpp | 1 + llvm/lib/CodeGen/MachineBlockFrequency.cpp | 60 -------------------------- llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp | 60 ++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 61 deletions(-) delete mode 100644 llvm/lib/CodeGen/MachineBlockFrequency.cpp create mode 100644 llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt index 06d2a959ac8..5e4fb442199 100644 --- a/llvm/lib/CodeGen/CMakeLists.txt +++ b/llvm/lib/CodeGen/CMakeLists.txt @@ -33,7 +33,7 @@ add_llvm_library(LLVMCodeGen LocalStackSlotAllocation.cpp LowerSubregs.cpp MachineBasicBlock.cpp - MachineBlockFrequency.cpp + MachineBlockFrequencyInfo.cpp MachineBranchProbabilityInfo.cpp MachineCSE.cpp MachineDominators.cpp diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp index 489746cf3c7..424535ba2a1 100644 --- a/llvm/lib/CodeGen/CodeGen.cpp +++ b/llvm/lib/CodeGen/CodeGen.cpp @@ -27,6 +27,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) { initializeLiveIntervalsPass(Registry); initializeLiveStacksPass(Registry); initializeLiveVariablesPass(Registry); + initializeMachineBlockFrequencyInfoPass(Registry); initializeMachineCSEPass(Registry); initializeMachineDominatorTreePass(Registry); initializeMachineLICMPass(Registry); diff --git a/llvm/lib/CodeGen/MachineBlockFrequency.cpp b/llvm/lib/CodeGen/MachineBlockFrequency.cpp deleted file mode 100644 index f3ee5388e59..00000000000 --- a/llvm/lib/CodeGen/MachineBlockFrequency.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//====----- MachineBlockFrequency.cpp - Machine Block Frequency Analysis ----====// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Loops should be simplified before this analysis. -// -//===----------------------------------------------------------------------===// - -#include "llvm/InitializePasses.h" -#include "llvm/Analysis/BlockFrequencyImpl.h" -#include "llvm/CodeGen/MachineBlockFrequency.h" -#include "llvm/CodeGen/Passes.h" -#include "llvm/CodeGen/MachineBranchProbabilityInfo.h" - -using namespace llvm; - -INITIALIZE_PASS_BEGIN(MachineBlockFrequency, "machine-block-freq", - "Machine Block Frequency Analysis", true, true) -INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo) -INITIALIZE_PASS_END(MachineBlockFrequency, "machine-block-freq", - "Machine Block Frequency Analysis", true, true) - -char MachineBlockFrequency::ID = 0; - - -MachineBlockFrequency::MachineBlockFrequency() : MachineFunctionPass(ID) { - initializeMachineBlockFrequencyPass(*PassRegistry::getPassRegistry()); - MBFI = new BlockFrequencyImpl(); -} - -MachineBlockFrequency::~MachineBlockFrequency() { - delete MBFI; -} - -void MachineBlockFrequency::getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); - AU.setPreservesAll(); - MachineFunctionPass::getAnalysisUsage(AU); -} - -bool MachineBlockFrequency::runOnMachineFunction(MachineFunction &F) { - MachineBranchProbabilityInfo &MBPI = getAnalysis(); - MBFI->doFunction(&F, &MBPI); - return false; -} - -/// getblockFreq - Return block frequency. Return 0 if we don't have the -/// information. Please note that initial frequency is equal to 1024. It means -/// that we should not rely on the value itself, but only on the comparison to -/// the other block frequencies. We do this to avoid using of floating points. -/// -uint32_t MachineBlockFrequency::getBlockFreq(MachineBasicBlock *MBB) { - return MBFI->getBlockFreq(MBB); -} diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp new file mode 100644 index 00000000000..583e9c4efd4 --- /dev/null +++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp @@ -0,0 +1,60 @@ +//====----- MachineBlockFrequencyInfo.cpp - Machine Block Frequency Analysis ----====// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Loops should be simplified before this analysis. +// +//===----------------------------------------------------------------------===// + +#include "llvm/InitializePasses.h" +#include "llvm/Analysis/BlockFrequencyImpl.h" +#include "llvm/CodeGen/MachineBlockFrequencyInfo.h" +#include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/MachineBranchProbabilityInfo.h" + +using namespace llvm; + +INITIALIZE_PASS_BEGIN(MachineBlockFrequencyInfo, "machine-block-freq", + "Machine Block Frequency Analysis", true, true) +INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo) +INITIALIZE_PASS_END(MachineBlockFrequencyInfo, "machine-block-freq", + "Machine Block Frequency Analysis", true, true) + +char MachineBlockFrequencyInfo::ID = 0; + + +MachineBlockFrequencyInfo::MachineBlockFrequencyInfo() : MachineFunctionPass(ID) { + initializeMachineBlockFrequencyInfoPass(*PassRegistry::getPassRegistry()); + MBFI = new BlockFrequencyImpl(); +} + +MachineBlockFrequencyInfo::~MachineBlockFrequencyInfo() { + delete MBFI; +} + +void MachineBlockFrequencyInfo::getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + AU.setPreservesAll(); + MachineFunctionPass::getAnalysisUsage(AU); +} + +bool MachineBlockFrequencyInfo::runOnMachineFunction(MachineFunction &F) { + MachineBranchProbabilityInfo &MBPI = getAnalysis(); + MBFI->doFunction(&F, &MBPI); + return false; +} + +/// getblockFreq - Return block frequency. Return 0 if we don't have the +/// information. Please note that initial frequency is equal to 1024. It means +/// that we should not rely on the value itself, but only on the comparison to +/// the other block frequencies. We do this to avoid using of floating points. +/// +uint32_t MachineBlockFrequencyInfo::getBlockFreq(MachineBasicBlock *MBB) { + return MBFI->getBlockFreq(MBB); +} -- cgit v1.2.3