coverage: Emit llvm.instrprof.increment
using the normal helper method
This commit is contained in:
parent
a93c1718c8
commit
4923e856be
@ -1165,6 +1165,7 @@ fn lifetime_end(&mut self, ptr: &'ll Value, size: Size) {
|
|||||||
self.call_lifetime_intrinsic("llvm.lifetime.end.p0i8", ptr, size);
|
self.call_lifetime_intrinsic("llvm.lifetime.end.p0i8", ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "debug", skip(self))]
|
||||||
fn instrprof_increment(
|
fn instrprof_increment(
|
||||||
&mut self,
|
&mut self,
|
||||||
fn_name: &'ll Value,
|
fn_name: &'ll Value,
|
||||||
@ -1172,30 +1173,7 @@ fn instrprof_increment(
|
|||||||
num_counters: &'ll Value,
|
num_counters: &'ll Value,
|
||||||
index: &'ll Value,
|
index: &'ll Value,
|
||||||
) {
|
) {
|
||||||
debug!(
|
self.call_intrinsic("llvm.instrprof.increment", &[fn_name, hash, num_counters, index]);
|
||||||
"instrprof_increment() with args ({:?}, {:?}, {:?}, {:?})",
|
|
||||||
fn_name, hash, num_counters, index
|
|
||||||
);
|
|
||||||
|
|
||||||
let llfn = unsafe { llvm::LLVMRustGetInstrProfIncrementIntrinsic(self.cx().llmod) };
|
|
||||||
let llty = self.cx.type_func(
|
|
||||||
&[self.cx.type_ptr(), self.cx.type_i64(), self.cx.type_i32(), self.cx.type_i32()],
|
|
||||||
self.cx.type_void(),
|
|
||||||
);
|
|
||||||
let args = &[fn_name, hash, num_counters, index];
|
|
||||||
let args = self.check_call("call", llty, llfn, args);
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let _ = llvm::LLVMRustBuildCall(
|
|
||||||
self.llbuilder,
|
|
||||||
llty,
|
|
||||||
llfn,
|
|
||||||
args.as_ptr() as *const &llvm::Value,
|
|
||||||
args.len() as c_uint,
|
|
||||||
[].as_ptr(),
|
|
||||||
0 as c_uint,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(
|
fn call(
|
||||||
|
@ -1615,7 +1615,6 @@ pub fn LLVMRustBuildCallBr<'a>(
|
|||||||
pub fn LLVMRustSetAllowReassoc(Instr: &Value);
|
pub fn LLVMRustSetAllowReassoc(Instr: &Value);
|
||||||
|
|
||||||
// Miscellaneous instructions
|
// Miscellaneous instructions
|
||||||
pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value;
|
|
||||||
pub fn LLVMRustGetInstrProfMCDCParametersIntrinsic(M: &Module) -> &Value;
|
pub fn LLVMRustGetInstrProfMCDCParametersIntrinsic(M: &Module) -> &Value;
|
||||||
pub fn LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(M: &Module) -> &Value;
|
pub fn LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(M: &Module) -> &Value;
|
||||||
|
|
||||||
|
@ -1531,17 +1531,6 @@ extern "C" LLVMValueRef LLVMRustBuildCall(LLVMBuilderRef B, LLVMTypeRef Ty,
|
|||||||
ArrayRef<OperandBundleDef>(OpBundles)));
|
ArrayRef<OperandBundleDef>(OpBundles)));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" LLVMValueRef
|
|
||||||
LLVMRustGetInstrProfIncrementIntrinsic(LLVMModuleRef M) {
|
|
||||||
#if LLVM_VERSION_GE(20, 0)
|
|
||||||
return wrap(llvm::Intrinsic::getOrInsertDeclaration(
|
|
||||||
unwrap(M), llvm::Intrinsic::instrprof_increment));
|
|
||||||
#else
|
|
||||||
return wrap(llvm::Intrinsic::getDeclaration(
|
|
||||||
unwrap(M), llvm::Intrinsic::instrprof_increment));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" LLVMValueRef
|
extern "C" LLVMValueRef
|
||||||
LLVMRustGetInstrProfMCDCParametersIntrinsic(LLVMModuleRef M) {
|
LLVMRustGetInstrProfMCDCParametersIntrinsic(LLVMModuleRef M) {
|
||||||
#if LLVM_VERSION_LT(19, 0)
|
#if LLVM_VERSION_LT(19, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user