diff options
author | Xinliang David Li <davidxl@google.com> | 2016-05-17 20:19:03 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2016-05-17 20:19:03 +0000 |
commit | 8da773bf74f29c10f81b382f39a06f2486e4216c (patch) | |
tree | 522589e1d1bec4772a523d9e945e7f310d01b159 /llvm | |
parent | c3fb51171e90b47d714c569e0548552d4ea46a93 (diff) | |
download | bcm5719-llvm-8da773bf74f29c10f81b382f39a06f2486e4216c.tar.gz bcm5719-llvm-8da773bf74f29c10f81b382f39a06f2486e4216c.zip |
Simple refactoring /NFC
llvm-svn: 269829
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index 930001fd684..60f77d47fb4 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -367,6 +367,20 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) { 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() { std::string UncompressedData; @@ -391,14 +405,7 @@ void InstrProfiling::emitNameData() { } void InstrProfiling::emitRegistration() { - // Don't do this for Darwin. compiler-rt uses linker magic. - 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()) + if (!needsRuntimeRegistrationOfSectionRange(*M)) return; // Construct the function. |