mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-06 03:08:43 +00:00
[sanitizer-coverage] rename sanitizer-coverage-create-pc-table into sanitizer-coverage-pc-table and add plumbing for a clang flag
llvm-svn: 309337
This commit is contained in:
parent
c38c834cb8
commit
62523c8dcf
@ -183,6 +183,7 @@ struct SanitizerCoverageOptions {
|
||||
bool TracePC = false;
|
||||
bool TracePCGuard = false;
|
||||
bool Inline8bitCounters = false;
|
||||
bool PCTable = false;
|
||||
bool NoPrune = false;
|
||||
|
||||
SanitizerCoverageOptions() = default;
|
||||
|
@ -84,7 +84,7 @@ static cl::opt<bool> ClTracePCGuard("sanitizer-coverage-trace-pc-guard",
|
||||
// to __sanitizer_cov_pcs_init.
|
||||
// This way the coverage instrumentation does not need to acquire the PCs
|
||||
// at run-time. Works with trace-pc-guard and inline-8bit-counters.
|
||||
static cl::opt<bool> ClCreatePCTable("sanitizer-coverage-create-pc-table",
|
||||
static cl::opt<bool> ClCreatePCTable("sanitizer-coverage-pc-table",
|
||||
cl::desc("create a static PC table"),
|
||||
cl::Hidden, cl::init(false));
|
||||
|
||||
@ -147,6 +147,7 @@ SanitizerCoverageOptions OverrideFromCL(SanitizerCoverageOptions Options) {
|
||||
Options.TracePC |= ClTracePC;
|
||||
Options.TracePCGuard |= ClTracePCGuard;
|
||||
Options.Inline8bitCounters |= ClInline8bitCounters;
|
||||
Options.PCTable |= ClCreatePCTable;
|
||||
if (!Options.TracePCGuard && !Options.TracePC && !Options.Inline8bitCounters)
|
||||
Options.TracePCGuard = true; // TracePCGuard is default.
|
||||
Options.NoPrune |= !ClPruneBlocks;
|
||||
@ -216,7 +217,7 @@ private:
|
||||
|
||||
GlobalVariable *FunctionGuardArray; // for trace-pc-guard.
|
||||
GlobalVariable *Function8bitCounterArray; // for inline-8bit-counters.
|
||||
GlobalVariable *FunctionPCsArray; // for create-pc-table.
|
||||
GlobalVariable *FunctionPCsArray; // for pc-table.
|
||||
|
||||
SanitizerCoverageOptions Options;
|
||||
};
|
||||
@ -341,7 +342,7 @@ bool SanitizerCoverageModule::runOnModule(Module &M) {
|
||||
if (Function8bitCounterArray)
|
||||
Ctor = CreateInitCallsForSections(M, SanCov8bitCountersInitName, Int8PtrTy,
|
||||
SanCovCountersSectionName);
|
||||
if (Ctor && ClCreatePCTable) {
|
||||
if (Ctor && Options.PCTable) {
|
||||
auto SecStartEnd = CreateSecStartEnd(M, SanCovPCsSectionName, Int8PtrTy);
|
||||
Function *InitFunction = declareSanitizerInitFunction(
|
||||
M, SanCovPCsInitName, {Int8PtrTy, Int8PtrTy});
|
||||
@ -515,7 +516,7 @@ void SanitizerCoverageModule::CreateFunctionLocalArrays(
|
||||
if (Options.Inline8bitCounters)
|
||||
Function8bitCounterArray = CreateFunctionLocalArrayInSection(
|
||||
AllBlocks.size(), F, Int8Ty, SanCovCountersSectionName);
|
||||
if (ClCreatePCTable)
|
||||
if (Options.PCTable)
|
||||
CreatePCArray(F, AllBlocks);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
; Test -sanitizer-coverage-create-pc-table=1
|
||||
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -sanitizer-coverage-create-pc-table=1 -S | FileCheck %s
|
||||
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-inline-8bit-counters -sanitizer-coverage-create-pc-table=1 -S | FileCheck %s
|
||||
; Test -sanitizer-coverage-pc-table=1
|
||||
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -sanitizer-coverage-pc-table=1 -S | FileCheck %s
|
||||
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-inline-8bit-counters -sanitizer-coverage-pc-table=1 -S | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
Loading…
Reference in New Issue
Block a user