clang API Documentation
#include "CodeGenPGO.h"
#include "CodeGenFunction.h"
#include "CoverageMappingGen.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/StmtVisitor.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MD5.h"
Go to the source code of this file.
Functions | |
static llvm::Function * | getRegisterFunc (CodeGenModule &CGM) |
static llvm::BasicBlock * | getOrInsertRegisterBB (CodeGenModule &CGM) |
static llvm::Constant * | getOrInsertRuntimeRegister (CodeGenModule &CGM) |
static bool | isMachO (const CodeGenModule &CGM) |
static StringRef | getCountersSection (const CodeGenModule &CGM) |
static StringRef | getNameSection (const CodeGenModule &CGM) |
static StringRef | getDataSection (const CodeGenModule &CGM) |
static void | emitRuntimeHook (CodeGenModule &CGM) |
static uint64_t | calculateWeightScale (uint64_t MaxWeight) |
Calculate what to divide by to scale weights. | |
static uint32_t | scaleBranchWeight (uint64_t Weight, uint64_t Scale) |
Scale an individual branch weight (and add 1). |
static uint64_t calculateWeightScale | ( | uint64_t | MaxWeight | ) | [static] |
Calculate what to divide by to scale weights.
Given the maximum weight, calculate a divisor that will scale all the weights to strictly less than UINT32_MAX.
Definition at line 1019 of file CodeGenPGO.cpp.
Referenced by clang::CodeGen::CodeGenPGO::createBranchWeights().
static void emitRuntimeHook | ( | CodeGenModule & | CGM | ) | [static] |
Definition at line 815 of file CodeGenPGO.cpp.
References clang::CodeGen::CodeGenModule::addUsedGlobal(), Builder, clang::ExternalLinkage, clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getLLVMContext(), and clang::CodeGen::CodeGenModule::getModule().
Referenced by clang::CodeGen::CodeGenPGO::assignRegionCounters().
static StringRef getCountersSection | ( | const CodeGenModule & | CGM | ) | [static] |
Definition at line 118 of file CodeGenPGO.cpp.
References isMachO().
static StringRef getDataSection | ( | const CodeGenModule & | CGM | ) | [static] |
Definition at line 126 of file CodeGenPGO.cpp.
References isMachO().
static StringRef getNameSection | ( | const CodeGenModule & | CGM | ) | [static] |
Definition at line 122 of file CodeGenPGO.cpp.
References isMachO().
static llvm::BasicBlock* getOrInsertRegisterBB | ( | CodeGenModule & | CGM | ) | [static] |
Definition at line 79 of file CodeGenPGO.cpp.
References Builder, clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::CodeGenModule::getModule(), getRegisterFunc(), clang::CodeGen::CodeGenModule::getTarget(), clang::TargetInfo::getTriple(), and clang::InternalLinkage.
Referenced by clang::CodeGen::CodeGenPGO::emitInstrumentationData().
static llvm::Constant* getOrInsertRuntimeRegister | ( | CodeGenModule & | CGM | ) | [static] |
Definition at line 106 of file CodeGenPGO.cpp.
References clang::CodeGen::CodeGenModule::getLLVMContext(), and clang::CodeGen::CodeGenModule::getModule().
Referenced by clang::CodeGen::CodeGenPGO::emitInstrumentationData().
static llvm::Function* getRegisterFunc | ( | CodeGenModule & | CGM | ) | [static] |
Definition at line 75 of file CodeGenPGO.cpp.
References clang::CodeGen::CodeGenModule::getModule().
Referenced by clang::CodeGen::CodeGenPGO::emitInitialization(), and getOrInsertRegisterBB().
static bool isMachO | ( | const CodeGenModule & | CGM | ) | [static] |
Definition at line 114 of file CodeGenPGO.cpp.
References clang::CodeGen::CodeGenModule::getTarget(), and clang::TargetInfo::getTriple().
Referenced by getCountersSection(), getDataSection(), and getNameSection().
static uint32_t scaleBranchWeight | ( | uint64_t | Weight, |
uint64_t | Scale | ||
) | [static] |
Scale an individual branch weight (and add 1).
Scale a 64-bit weight down to 32-bits using Scale
.
According to Laplace's Rule of Succession, it is better to compute the weight based on the count plus 1, so universally add 1 to the value.
Scale
was calculated by calculateWeightScale() with a weight no greater than Weight
. Definition at line 1032 of file CodeGenPGO.cpp.
Referenced by clang::CodeGen::CodeGenPGO::createBranchWeights().