SIL: Add SIL builtin for Thread Sanitizer inout accesses

...and IRGen it into a call to __tsan_write1 in compiler-rt. This is
preparatory work for a later patch that will add an experimental
option to treat Swift inout accesses as TSan writes.
This commit is contained in:
Devin Coughlin
2017-03-05 19:42:56 -08:00
parent 7af65d9e09
commit 6ac36df1e7
10 changed files with 90 additions and 2 deletions

View File

@@ -214,6 +214,14 @@ void IRGenFunction::emitDeallocRawCall(llvm::Value *pointer,
{pointer, size, alignMask});
}
void IRGenFunction::emitTSanInoutAccessCall(llvm::Value *address) {
llvm::Function *fn = cast<llvm::Function>(IGM.getTSanInoutAccessFn());
llvm::Value *castAddress = Builder.CreateBitCast(address, IGM.Int8PtrTy);
Builder.CreateCall(fn, {castAddress});
}
/// Initialize a relative indirectable pointer to the given value.
/// This always leaves the value in the direct state; if it's not a
/// far reference, it's the caller's responsibility to ensure that the