LLVM  14.0.0git
MIRFSDiscriminator.h
Go to the documentation of this file.
1 //===----- MIRFSDiscriminator.h: MIR FS Discriminator Support --0-- c++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the supporting functions for adding Machine level IR
10 // Flow Sensitive discriminators to the instruction debug information. With
11 // this, a cloned machine instruction in a different MachineBasicBlock will
12 // have its own discriminator value. This is done in a MIRAddFSDiscriminators
13 // pass.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_CODEGEN_MIRFSDISCRIMINATOR_H
18 #define LLVM_CODEGEN_MIRFSDISCRIMINATOR_H
19 
31 #include "llvm/CodeGen/Passes.h"
33 #include "llvm/IR/Function.h"
34 #include "llvm/IR/Module.h"
35 #include "llvm/InitializePasses.h"
39 
40 #include <cassert>
41 
42 namespace llvm {
43 
44 using namespace sampleprof;
46  MachineFunction *MF;
47  unsigned LowBit;
48  unsigned HighBit;
49 
50 public:
51  static char ID;
52  /// PassNum is the sequence number this pass is called, start from 1.
55  LowBit = getFSPassBitBegin(P);
56  HighBit = getFSPassBitEnd(P);
57  assert(LowBit < HighBit && "HighBit needs to be greater than Lowbit");
58  }
59 
60  /// getNumFSBBs() - Return the number of machine BBs that have FS samples.
61  unsigned getNumFSBBs();
62 
63  /// getNumFSSamples() - Return the number of samples that have flow sensitive
64  /// values.
65  uint64_t getNumFSSamples();
66 
67  /// getMachineFunction - Return the current machine function.
68  const MachineFunction *getMachineFunction() const { return MF; }
69 
70 private:
71  bool runOnMachineFunction(MachineFunction &) override;
72 };
73 
74 } // namespace llvm
75 
76 #endif // LLVM_CODEGEN_MIRFSDISCRIMINATOR_H
llvm::MIRAddFSDiscriminators::MIRAddFSDiscriminators
MIRAddFSDiscriminators(FSDiscriminatorPass P=FSDiscriminatorPass::Pass1)
PassNum is the sequence number this pass is called, start from 1.
Definition: MIRFSDiscriminator.h:53
llvm::getFSPassBitBegin
static unsigned getFSPassBitBegin(FSDiscriminatorPass P)
Definition: Discriminator.h:96
MachineInstr.h
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MIRAddFSDiscriminators::ID
static char ID
Definition: MIRFSDiscriminator.h:51
DebugInfoMetadata.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::MachineFunctionPass
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Definition: MachineFunctionPass.h:30
MachineBasicBlock.h
Module.h
llvm::sampleprof::FSDiscriminatorPass
FSDiscriminatorPass
Definition: Discriminator.h:57
MachineLoopInfo.h
SampleProf.h
InstrProf.h
MachineOptimizationRemarkEmitter.h
===- MachineOptimizationRemarkEmitter.h - Opt Diagnostics -*- C++ -*-—===//
Passes.h
uint64_t
ProfileSummaryInfo.h
SampleProfReader.h
MachineFunctionPass.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineBranchProbabilityInfo.h
MachinePostDominators.h
llvm::MachineFunction
Definition: MachineFunction.h:230
Function.h
llvm::sampleprof::Pass1
@ Pass1
Definition: Discriminator.h:60
llvm::MIRAddFSDiscriminators::getMachineFunction
const MachineFunction * getMachineFunction() const
getMachineFunction - Return the current machine function.
Definition: MIRFSDiscriminator.h:68
llvm::getFSPassBitEnd
static unsigned getFSPassBitEnd(FSDiscriminatorPass P)
Definition: Discriminator.h:89
MachineFunction.h
llvm::MIRAddFSDiscriminators
Definition: MIRFSDiscriminator.h:45
InitializePasses.h
MachineBlockFrequencyInfo.h
MachineDominators.h
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37