[K/N] Add LLVM C wrappers for -time-passes API.

This commit is contained in:
Sergey Bogolepov
2023-02-09 16:54:46 +02:00
committed by Space Cloud
parent 32c3b0cd58
commit 637258e175
2 changed files with 22 additions and 0 deletions
@@ -11,6 +11,7 @@
#include <llvm/Transforms/ObjCARC.h>
#include <llvm/Transforms/Utils/Cloning.h>
#include <llvm/Transforms/Instrumentation/ThreadSanitizer.h>
#include <llvm/Support/Timer.h>
using namespace llvm;
@@ -58,3 +59,15 @@ int LLVMInlineCall(LLVMValueRef call) {
void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createThreadSanitizerLegacyPassPass());
}
void LLVMSetTimePasses(int enabled) {
llvm::TimePassesIsEnabled = static_cast<bool>(enabled);
}
void LLVMPrintAllTimersToStdOut() {
llvm::TimerGroup::printAll(llvm::outs());
}
void LLVMClearAllTimers() {
llvm::TimerGroup::clearAll();
}
@@ -27,6 +27,15 @@ int LLVMInlineCall(LLVMValueRef call);
void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM);
/// Control LLVM -time-passes flag.
void LLVMSetTimePasses(int enabled);
/// Print timing results. Useful in combination with LLVMSetTimePasses.
void LLVMPrintAllTimersToStdOut();
/// Clear all LLVM timers. Allows avoiding automatic printing on shutdown
void LLVMClearAllTimers();
# ifdef __cplusplus
}
# endif