Skip to content

Commit

Permalink
[NFC] Rename BBSectionsPrepare -> BasicBlockSections.
Browse files Browse the repository at this point in the history
Rename the BBSectionsPrepare pass as suggested by the review comment in
https://reviews.llvm.org/D85368.

Differential Revision: https://reviews.llvm.org/D85380
  • Loading branch information
snehasish committed Aug 6, 2020
1 parent f406a90 commit 8d943a9
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
10 changes: 5 additions & 5 deletions llvm/include/llvm/CodeGen/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ namespace llvm {
/// the entry block.
FunctionPass *createUnreachableBlockEliminationPass();

/// createBBSectionsPrepare Pass - This pass assigns sections to machine basic
/// blocks and is enabled with -fbasic-block-sections.
/// Buf is a memory buffer that contains the list of functions and basic
/// block ids to selectively enable basic block sections.
MachineFunctionPass *createBBSectionsPreparePass(const MemoryBuffer *Buf);
/// createBasicBlockSections Pass - This pass assigns sections to machine
/// basic blocks and is enabled with -fbasic-block-sections. Buf is a memory
/// buffer that contains the list of functions and basic block ids to
/// selectively enable basic block sections.
MachineFunctionPass *createBasicBlockSectionsPass(const MemoryBuffer *Buf);

/// MachineFunctionPrinter pass - This pass prints out the machine function to
/// the given stream as a debugging tool.
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/InitializePasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void initializeAssumptionCacheTrackerPass(PassRegistry&);
void initializeAtomicExpandPass(PassRegistry&);
void initializeAttributorLegacyPassPass(PassRegistry&);
void initializeAttributorCGSCCLegacyPassPass(PassRegistry &);
void initializeBBSectionsPreparePass(PassRegistry &);
void initializeBasicBlockSectionsPass(PassRegistry &);
void initializeBDCELegacyPassPass(PassRegistry&);
void initializeBarrierNoopPass(PassRegistry&);
void initializeBasicAAWrapperPassPass(PassRegistry&);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//===-- BBSectionsPrepare.cpp ---=========---------------------------------===//
//===-- BasicBlockSections.cpp ---=========--------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// BBSectionsPrepare implementation.
// BasicBlockSections implementation.
//
// The purpose of this pass is to assign sections to basic blocks when
// -fbasic-block-sections= option is used. Further, with profile information
Expand Down Expand Up @@ -100,7 +100,7 @@ struct BBClusterInfo {

using ProgramBBClusterInfoMapTy = StringMap<SmallVector<BBClusterInfo, 4>>;

class BBSectionsPrepare : public MachineFunctionPass {
class BasicBlockSections : public MachineFunctionPass {
public:
static char ID;

Expand All @@ -119,13 +119,13 @@ class BBSectionsPrepare : public MachineFunctionPass {
// name for which we have mapping in ProgramBBClusterInfo.
StringMap<StringRef> FuncAliasMap;

BBSectionsPrepare(const MemoryBuffer *Buf)
BasicBlockSections(const MemoryBuffer *Buf)
: MachineFunctionPass(ID), MBuf(Buf) {
initializeBBSectionsPreparePass(*PassRegistry::getPassRegistry());
initializeBasicBlockSectionsPass(*PassRegistry::getPassRegistry());
};

BBSectionsPrepare() : MachineFunctionPass(ID) {
initializeBBSectionsPreparePass(*PassRegistry::getPassRegistry());
BasicBlockSections() : MachineFunctionPass(ID) {
initializeBasicBlockSectionsPass(*PassRegistry::getPassRegistry());
}

StringRef getPassName() const override {
Expand All @@ -144,8 +144,8 @@ class BBSectionsPrepare : public MachineFunctionPass {

} // end anonymous namespace

char BBSectionsPrepare::ID = 0;
INITIALIZE_PASS(BBSectionsPrepare, "bbsections-prepare",
char BasicBlockSections::ID = 0;
INITIALIZE_PASS(BasicBlockSections, "bbsections-prepare",
"Prepares for basic block sections, by splitting functions "
"into clusters of basic blocks.",
false, false)
Expand Down Expand Up @@ -324,7 +324,7 @@ static bool assignSectionsAndSortBasicBlocks(
return true;
}

bool BBSectionsPrepare::runOnMachineFunction(MachineFunction &MF) {
bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) {
auto BBSectionsType = MF.getTarget().getBBSectionsType();
assert(BBSectionsType != BasicBlockSection::None &&
"BB Sections not enabled!");
Expand Down Expand Up @@ -438,20 +438,20 @@ static Error getBBClusterInfo(const MemoryBuffer *MBuf,
return Error::success();
}

bool BBSectionsPrepare::doInitialization(Module &M) {
bool BasicBlockSections::doInitialization(Module &M) {
if (!MBuf)
return false;
if (auto Err = getBBClusterInfo(MBuf, ProgramBBClusterInfo, FuncAliasMap))
report_fatal_error(std::move(Err));
return false;
}

void BBSectionsPrepare::getAnalysisUsage(AnalysisUsage &AU) const {
void BasicBlockSections::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
MachineFunctionPass::getAnalysisUsage(AU);
}

MachineFunctionPass *
llvm::createBBSectionsPreparePass(const MemoryBuffer *Buf) {
return new BBSectionsPrepare(Buf);
llvm::createBasicBlockSectionsPass(const MemoryBuffer *Buf) {
return new BasicBlockSections(Buf);
}
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ add_llvm_component_library(LLVMCodeGen
BranchRelaxation.cpp
BreakFalseDeps.cpp
BuiltinGCs.cpp
BBSectionsPrepare.cpp
BasicBlockSections.cpp
CalcSpillWeights.cpp
CallingConvLower.cpp
CFGuardLongjmp.cpp
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using namespace llvm;
/// initializeCodeGen - Initialize all passes linked into the CodeGen library.
void llvm::initializeCodeGen(PassRegistry &Registry) {
initializeAtomicExpandPass(Registry);
initializeBBSectionsPreparePass(Registry);
initializeBasicBlockSectionsPass(Registry);
initializeBranchFolderPassPass(Registry);
initializeBranchRelaxationPass(Registry);
initializeCFGuardLongjmpPass(Registry);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/TargetPassConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ void TargetPassConfig::addMachinePasses() {
}

if (TM->getBBSectionsType() != llvm::BasicBlockSection::None)
addPass(llvm::createBBSectionsPreparePass(TM->getBBSectionsFuncListBuf()));
addPass(llvm::createBasicBlockSectionsPass(TM->getBBSectionsFuncListBuf()));

// Add passes that directly emit MI after all other MI passes.
addPreEmitPass2();
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static_library("CodeGen") {
"AllocationOrder.cpp",
"Analysis.cpp",
"AtomicExpandPass.cpp",
"BBSectionsPrepare.cpp",
"BasicBlockSections.cpp",
"BasicTargetTransformInfo.cpp",
"BranchFolding.cpp",
"BranchRelaxation.cpp",
Expand Down

0 comments on commit 8d943a9

Please sign in to comment.