1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Simple refactoring /NFC

llvm-svn: 269829
This commit is contained in:
Xinliang David Li 2016-05-17 20:19:03 +00:00
parent 09bf3bedad
commit 6891db977b

View File

@ -367,6 +367,20 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) {
return CounterPtr; return CounterPtr;
} }
static bool needsRuntimeRegistrationOfSectionRange(const Module &M) {
// Don't do this for Darwin. compiler-rt uses linker magic.
if (Triple(M.getTargetTriple()).isOSDarwin())
return false;
// Use linker script magic to get data/cnts/name start/end.
if (Triple(M.getTargetTriple()).isOSLinux() ||
Triple(M.getTargetTriple()).isOSFreeBSD() ||
Triple(M.getTargetTriple()).isPS4CPU())
return false;
return true;
}
void InstrProfiling::emitNameData() { void InstrProfiling::emitNameData() {
std::string UncompressedData; std::string UncompressedData;
@ -391,14 +405,7 @@ void InstrProfiling::emitNameData() {
} }
void InstrProfiling::emitRegistration() { void InstrProfiling::emitRegistration() {
// Don't do this for Darwin. compiler-rt uses linker magic. if (!needsRuntimeRegistrationOfSectionRange(*M))
if (Triple(M->getTargetTriple()).isOSDarwin())
return;
// Use linker script magic to get data/cnts/name start/end.
if (Triple(M->getTargetTriple()).isOSLinux() ||
Triple(M->getTargetTriple()).isOSFreeBSD() ||
Triple(M->getTargetTriple()).isPS4CPU())
return; return;
// Construct the function. // Construct the function.