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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

21#include

22

23using namespace llvm;

24

27 Key = std::string(MKey);

28

30 MI.print(OS, true, false,

31 true);

32}

33

36 MachineFunctionAnalysisManager::Invalidator &Inv) {

37

38

40}

41

42std::optional<uint64_t>

43MachineOptimizationRemarkEmitter::computeHotness(const MachineBasicBlock &MBB) {

44 if (!MBFI)

45 return std::nullopt;

46

47 return MBFI->getBlockProfileCount(&MBB);

48}

49

50void MachineOptimizationRemarkEmitter::computeHotness(

54 Remark.setHotness(computeHotness(*MBB));

55}

56

60 computeHotness(OptDiag);

61

62 LLVMContext &Ctx = MF.getFunction().getContext();

63

64

65 if (OptDiag.getHotness().value_or(0) < Ctx.getDiagnosticsHotnessThreshold())

66 return;

67

69}

70

76

80

83 else

84 MBFI = nullptr;

85

86 ORE = std::make_unique(MF, MBFI);

87 return false;

88}

89

96

97AnalysisKey MachineOptimizationRemarkEmitterAnalysis::Key;

98

105 : nullptr;

106 return Result(MF, MBFI);

107}

108

110static const char ore_name[] = "Machine Optimization Remark Emitter";

111#define ORE_NAME "machine-opt-remark-emitter"

112

114 true, true)

===- 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)

PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)

Get the result of an analysis pass for a given IR unit.

Represent the analysis usage information of a pass.

AnalysisUsage & addRequired()

void setPreservesAll()

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

Common features for diagnostics dealing with optimization remarks that are used by machine passes.

Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...

LLVMContext & getContext() const

getContext - Return a reference to the LLVMContext associated with this function.

This is an important class for using LLVM in a threaded context.

LLVM_ABI bool getDiagnosticsHotnessRequested() const

Return if a code hotness metric should be included in optimization diagnostics.

LLVM_ABI void diagnose(const DiagnosticInfo &DI)

Report a message to the currently installed diagnostic handler.

This is an alternative analysis pass to MachineBlockFrequencyInfo.

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.

Function & getFunction()

Return the LLVM function that this machine code represents.

Representation of each machine instruction.

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 ...

A set of analyses that are preserved following a run of a transformation pass.

StringRef - Represent a constant reference to a string, i.e.

A raw_ostream that writes to an std::string.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI void initializeMachineOptimizationRemarkEmitterPassPass(PassRegistry &)

AnalysisManager< MachineFunction > MachineFunctionAnalysisManager

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

A special type used by analysis passes to provide an address that identifies that particular analysis...

LLVM_ABI MachineArgument(StringRef Key, const MachineInstr &MI)

Print an entire MachineInstr.

Definition MachineOptimizationRemarkEmitter.cpp:25