diff options
| author | Rich Kadel <richkadel@google.com> | 2020-06-03 21:19:34 -0700 |
|---|---|---|
| committer | Rich Kadel <richkadel@google.com> | 2020-06-15 16:50:10 -0700 |
| commit | 5068ae1ca05b2be0c2a98206a58d894aa620b312 (patch) | |
| tree | 258a6eafab4eeab5d40cf776cc09d9799276787d /src/rustllvm/RustWrapper.cpp | |
| parent | 395256a5dd74ccef046083d6e025a6d046379040 (diff) | |
| download | rust-5068ae1ca05b2be0c2a98206a58d894aa620b312.tar.gz rust-5068ae1ca05b2be0c2a98206a58d894aa620b312.zip | |
[WIP] injects llvm intrinsic instrprof.increment for coverage reports
This initial version only injects counters at the top of each function. Rust Coverage will require injecting additional counters at each conditional code branch.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 4704622922a..cdb3a157eab 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -5,6 +5,7 @@ #include "llvm/IR/DiagnosticPrinter.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/Intrinsics.h" #include "llvm/Object/Archive.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Bitcode/BitcodeWriterPass.h" @@ -1364,6 +1365,11 @@ extern "C" LLVMValueRef LLVMRustBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, unwrap(Fn), makeArrayRef(unwrap(Args), NumArgs), Bundles)); } +extern "C" LLVMValueRef LLVMRustGetInstrprofIncrementIntrinsic(LLVMModuleRef M) { + return wrap(llvm::Intrinsic::getDeclaration(unwrap(M), + (llvm::Intrinsic::ID)llvm::Intrinsic::instrprof_increment)); +} + extern "C" LLVMValueRef LLVMRustBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, |
