[K/N] Add LLVM C wrappers for -time-passes API.
This commit is contained in:
committed by
Space Cloud
parent
32c3b0cd58
commit
637258e175
@@ -11,6 +11,7 @@
|
|||||||
#include <llvm/Transforms/ObjCARC.h>
|
#include <llvm/Transforms/ObjCARC.h>
|
||||||
#include <llvm/Transforms/Utils/Cloning.h>
|
#include <llvm/Transforms/Utils/Cloning.h>
|
||||||
#include <llvm/Transforms/Instrumentation/ThreadSanitizer.h>
|
#include <llvm/Transforms/Instrumentation/ThreadSanitizer.h>
|
||||||
|
#include <llvm/Support/Timer.h>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@@ -58,3 +59,15 @@ int LLVMInlineCall(LLVMValueRef call) {
|
|||||||
void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM) {
|
void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM) {
|
||||||
unwrap(PM)->add(createThreadSanitizerLegacyPassPass());
|
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);
|
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
|
# ifdef __cplusplus
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
Reference in New Issue
Block a user