LLVM: lib/CodeGen/LazyMachineBlockFrequencyInfo.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

19

20using namespace llvm;

21

22#define DEBUG_TYPE "lazy-machine-block-freq"

23

25 "Lazy Machine Block Frequency Analysis", true, true)

29 "Lazy Machine Block Frequency Analysis", true, true)

30

32

38

45

47 OwnedMBFI.reset();

48 OwnedMLI.reset();

49 OwnedMDT.reset();

50}

51

53LazyMachineBlockFrequencyInfoPass::calculateIfNotAvailable() const {

57 LLVM_DEBUG(dbgs() << "MachineBlockFrequencyInfo is available\n");

59 }

60

63 auto *MLI = MLIWrapper ? &MLIWrapper->getLI() : nullptr;

65 auto *MDT = MDTWrapper ? &MDTWrapper->getDomTree() : nullptr;

66 LLVM_DEBUG(dbgs() << "Building MachineBlockFrequencyInfo on the fly\n");

67 LLVM_DEBUG(if (MLI) dbgs() << "LoopInfo is available\n");

68

69 if (!MLI) {

70 LLVM_DEBUG(dbgs() << "Building LoopInfo on the fly\n");

71

72 LLVM_DEBUG(if (MDT) dbgs() << "DominatorTree is available\n");

73

74 if (!MDT) {

75 LLVM_DEBUG(dbgs() << "Building DominatorTree on the fly\n");

76 OwnedMDT = std::make_unique();

77 OwnedMDT->recalculate(*MF);

78 MDT = OwnedMDT.get();

79 }

80

81

82 OwnedMLI = std::make_unique();

83 OwnedMLI->analyze(*MDT);

84 MLI = OwnedMLI.get();

85 }

86

87 OwnedMBFI = std::make_unique();

88 OwnedMBFI->calculate(*MF, MBPI, *MLI);

89 return *OwnedMBFI;

90}

91

94 MF = &F;

95 return false;

96}

===- LazyMachineBlockFrequencyInfo.h - Lazy Block Frequency -*- C++ -*–===//

#define INITIALIZE_PASS_DEPENDENCY(depName)

#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)

#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)

Represent the analysis usage information of a pass.

AnalysisUsage & addRequired()

void setPreservesAll()

Set by analyses that do not transform their input at all.

This is an alternative analysis pass to MachineBlockFrequencyInfo.

void getAnalysisUsage(AnalysisUsage &AU) const override

getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...

Definition LazyMachineBlockFrequencyInfo.cpp:39

LazyMachineBlockFrequencyInfoPass()

Definition LazyMachineBlockFrequencyInfo.cpp:33

void releaseMemory() override

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...

Definition LazyMachineBlockFrequencyInfo.cpp:46

bool runOnMachineFunction(MachineFunction &F) override

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...

Definition LazyMachineBlockFrequencyInfo.cpp:92

const MachineBlockFrequencyInfo & getMBFI() const

MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...

MachineFunctionPass(char &ID)

void getAnalysisUsage(AnalysisUsage &AU) const override

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.

static LLVM_ABI PassRegistry * getPassRegistry()

getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...

AnalysisType & getAnalysis() const

getAnalysis() - This function is used by subclasses to get to the analysis information ...

AnalysisType * getAnalysisIfAvailable() const

getAnalysisIfAvailable() - Subclasses use this function to get analysis information tha...

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

LLVM_ABI void initializeLazyMachineBlockFrequencyInfoPassPass(PassRegistry &)