Skip to content

Commit 54c1680

Browse files
committed
add instruction count helper function
1 parent 07c993e commit 54c1680

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,17 @@ LLVMRustModuleCost(LLVMModuleRef M) {
17511751
return std::distance(std::begin(f), std::end(f));
17521752
}
17531753

1754+
extern "C" uint64_t
1755+
LLVMRustModuleInstructionStats(LLVMModuleRef M) {
1756+
auto f = unwrap(M)->functions();
1757+
for (auto &func : f)
1758+
{
1759+
auto name = func.getName();
1760+
auto count = func.getInstructionCount();
1761+
}
1762+
return unwrap(M)->getInstructionCount();
1763+
}
1764+
17541765
// Vector reductions:
17551766
extern "C" LLVMValueRef
17561767
LLVMRustBuildVectorReduceFAdd(LLVMBuilderRef B, LLVMValueRef Acc, LLVMValueRef Src) {

0 commit comments

Comments
 (0)