mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
Don't use a red zone for code coverage if the user specified `-mno-red-zone'.
The `-mno-red-zone' flag wasn't being propagated to the functions that code coverage generates. This allowed some of them to use the red zone when that wasn't allowed. <rdar://problem/12843084> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169754 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -33,7 +33,8 @@ ModulePass *createPathProfilerPass();
|
|||||||
// Insert GCOV profiling instrumentation
|
// Insert GCOV profiling instrumentation
|
||||||
ModulePass *createGCOVProfilerPass(bool EmitNotes = true, bool EmitData = true,
|
ModulePass *createGCOVProfilerPass(bool EmitNotes = true, bool EmitData = true,
|
||||||
bool Use402Format = false,
|
bool Use402Format = false,
|
||||||
bool UseExtraChecksum = false);
|
bool UseExtraChecksum = false,
|
||||||
|
bool NoRedZone = false);
|
||||||
|
|
||||||
// Insert AddressSanitizer (address sanity checking) instrumentation
|
// Insert AddressSanitizer (address sanity checking) instrumentation
|
||||||
FunctionPass *createAddressSanitizerFunctionPass(
|
FunctionPass *createAddressSanitizerFunctionPass(
|
||||||
@ -41,8 +42,10 @@ FunctionPass *createAddressSanitizerFunctionPass(
|
|||||||
bool CheckLifetime = false, StringRef BlacklistFile = StringRef());
|
bool CheckLifetime = false, StringRef BlacklistFile = StringRef());
|
||||||
ModulePass *createAddressSanitizerModulePass(
|
ModulePass *createAddressSanitizerModulePass(
|
||||||
bool CheckInitOrder = false, StringRef BlacklistFile = StringRef());
|
bool CheckInitOrder = false, StringRef BlacklistFile = StringRef());
|
||||||
|
|
||||||
// Insert MemorySanitizer instrumentation (detection of uninitialized reads)
|
// Insert MemorySanitizer instrumentation (detection of uninitialized reads)
|
||||||
FunctionPass *createMemorySanitizerPass();
|
FunctionPass *createMemorySanitizerPass();
|
||||||
|
|
||||||
// Insert ThreadSanitizer (race detection) instrumentation
|
// Insert ThreadSanitizer (race detection) instrumentation
|
||||||
FunctionPass *createThreadSanitizerPass();
|
FunctionPass *createThreadSanitizerPass();
|
||||||
|
|
||||||
|
@ -45,11 +45,11 @@ namespace {
|
|||||||
static char ID;
|
static char ID;
|
||||||
GCOVProfiler()
|
GCOVProfiler()
|
||||||
: ModulePass(ID), EmitNotes(true), EmitData(true), Use402Format(false),
|
: ModulePass(ID), EmitNotes(true), EmitData(true), Use402Format(false),
|
||||||
UseExtraChecksum(false) {
|
UseExtraChecksum(false), NoRedZone(false) {
|
||||||
initializeGCOVProfilerPass(*PassRegistry::getPassRegistry());
|
initializeGCOVProfilerPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
GCOVProfiler(bool EmitNotes, bool EmitData, bool use402Format = false,
|
GCOVProfiler(bool EmitNotes, bool EmitData, bool use402Format = false,
|
||||||
bool useExtraChecksum = false)
|
bool useExtraChecksum = false, bool NoRedZone = false)
|
||||||
: ModulePass(ID), EmitNotes(EmitNotes), EmitData(EmitData),
|
: ModulePass(ID), EmitNotes(EmitNotes), EmitData(EmitData),
|
||||||
Use402Format(use402Format), UseExtraChecksum(useExtraChecksum) {
|
Use402Format(use402Format), UseExtraChecksum(useExtraChecksum) {
|
||||||
assert((EmitNotes || EmitData) && "GCOVProfiler asked to do nothing?");
|
assert((EmitNotes || EmitData) && "GCOVProfiler asked to do nothing?");
|
||||||
@ -98,6 +98,7 @@ namespace {
|
|||||||
bool EmitData;
|
bool EmitData;
|
||||||
bool Use402Format;
|
bool Use402Format;
|
||||||
bool UseExtraChecksum;
|
bool UseExtraChecksum;
|
||||||
|
bool NoRedZone;
|
||||||
|
|
||||||
Module *M;
|
Module *M;
|
||||||
LLVMContext *Ctx;
|
LLVMContext *Ctx;
|
||||||
@ -110,8 +111,10 @@ INITIALIZE_PASS(GCOVProfiler, "insert-gcov-profiling",
|
|||||||
|
|
||||||
ModulePass *llvm::createGCOVProfilerPass(bool EmitNotes, bool EmitData,
|
ModulePass *llvm::createGCOVProfilerPass(bool EmitNotes, bool EmitData,
|
||||||
bool Use402Format,
|
bool Use402Format,
|
||||||
bool UseExtraChecksum) {
|
bool UseExtraChecksum,
|
||||||
return new GCOVProfiler(EmitNotes, EmitData, Use402Format, UseExtraChecksum);
|
bool NoRedZone) {
|
||||||
|
return new GCOVProfiler(EmitNotes, EmitData, Use402Format, UseExtraChecksum,
|
||||||
|
NoRedZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -638,6 +641,9 @@ void GCOVProfiler::insertCounterWriteout(
|
|||||||
WriteoutF = Function::Create(WriteoutFTy, GlobalValue::InternalLinkage,
|
WriteoutF = Function::Create(WriteoutFTy, GlobalValue::InternalLinkage,
|
||||||
"__llvm_gcov_writeout", M);
|
"__llvm_gcov_writeout", M);
|
||||||
WriteoutF->setUnnamedAddr(true);
|
WriteoutF->setUnnamedAddr(true);
|
||||||
|
WriteoutF->addFnAttr(Attributes::NoInline);
|
||||||
|
if (NoRedZone)
|
||||||
|
WriteoutF->addFnAttr(Attributes::NoRedZone);
|
||||||
|
|
||||||
BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", WriteoutF);
|
BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", WriteoutF);
|
||||||
IRBuilder<> Builder(BB);
|
IRBuilder<> Builder(BB);
|
||||||
@ -683,6 +689,8 @@ void GCOVProfiler::insertCounterWriteout(
|
|||||||
F->setUnnamedAddr(true);
|
F->setUnnamedAddr(true);
|
||||||
F->setLinkage(GlobalValue::InternalLinkage);
|
F->setLinkage(GlobalValue::InternalLinkage);
|
||||||
F->addFnAttr(Attributes::NoInline);
|
F->addFnAttr(Attributes::NoInline);
|
||||||
|
if (NoRedZone)
|
||||||
|
F->addFnAttr(Attributes::NoRedZone);
|
||||||
|
|
||||||
BB = BasicBlock::Create(*Ctx, "entry", F);
|
BB = BasicBlock::Create(*Ctx, "entry", F);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
@ -702,6 +710,8 @@ void GCOVProfiler::insertIndirectCounterIncrement() {
|
|||||||
Fn->setUnnamedAddr(true);
|
Fn->setUnnamedAddr(true);
|
||||||
Fn->setLinkage(GlobalValue::InternalLinkage);
|
Fn->setLinkage(GlobalValue::InternalLinkage);
|
||||||
Fn->addFnAttr(Attributes::NoInline);
|
Fn->addFnAttr(Attributes::NoInline);
|
||||||
|
if (NoRedZone)
|
||||||
|
Fn->addFnAttr(Attributes::NoRedZone);
|
||||||
|
|
||||||
Type *Int32Ty = Type::getInt32Ty(*Ctx);
|
Type *Int32Ty = Type::getInt32Ty(*Ctx);
|
||||||
Type *Int64Ty = Type::getInt64Ty(*Ctx);
|
Type *Int64Ty = Type::getInt64Ty(*Ctx);
|
||||||
@ -758,6 +768,9 @@ insertFlush(ArrayRef<std::pair<GlobalVariable*, MDNode*> > CountersBySP) {
|
|||||||
else
|
else
|
||||||
FlushF->setLinkage(GlobalValue::InternalLinkage);
|
FlushF->setLinkage(GlobalValue::InternalLinkage);
|
||||||
FlushF->setUnnamedAddr(true);
|
FlushF->setUnnamedAddr(true);
|
||||||
|
FlushF->addFnAttr(Attributes::NoInline);
|
||||||
|
if (NoRedZone)
|
||||||
|
FlushF->addFnAttr(Attributes::NoRedZone);
|
||||||
|
|
||||||
BasicBlock *Entry = BasicBlock::Create(*Ctx, "entry", FlushF);
|
BasicBlock *Entry = BasicBlock::Create(*Ctx, "entry", FlushF);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user