Simplify FFI calls for -Ztime-llvm-passes
and -Zprint-codegen-stats
This commit is contained in:
parent
43c78051ea
commit
5bfa0b106e
3 changed files with 16 additions and 45 deletions
|
@ -140,26 +140,14 @@ extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
|
|||
unwrap(M)->setTargetTriple(Triple::normalize(Triple));
|
||||
}
|
||||
|
||||
extern "C" const char *LLVMRustPrintPassTimings(size_t *Len) {
|
||||
std::string buf;
|
||||
auto SS = raw_string_ostream(buf);
|
||||
TimerGroup::printAll(SS);
|
||||
SS.flush();
|
||||
*Len = buf.length();
|
||||
char *CStr = (char *)malloc(*Len);
|
||||
memcpy(CStr, buf.c_str(), *Len);
|
||||
return CStr;
|
||||
extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) {
|
||||
auto OS = RawRustStringOstream(OutBuf);
|
||||
TimerGroup::printAll(OS);
|
||||
}
|
||||
|
||||
extern "C" const char *LLVMRustPrintStatistics(size_t *Len) {
|
||||
std::string buf;
|
||||
auto SS = raw_string_ostream(buf);
|
||||
llvm::PrintStatistics(SS);
|
||||
SS.flush();
|
||||
*Len = buf.length();
|
||||
char *CStr = (char *)malloc(*Len);
|
||||
memcpy(CStr, buf.c_str(), *Len);
|
||||
return CStr;
|
||||
extern "C" void LLVMRustPrintStatistics(RustStringRef OutBuf) {
|
||||
auto OS = RawRustStringOstream(OutBuf);
|
||||
llvm::PrintStatistics(OS);
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef LLVMRustGetNamedValue(LLVMModuleRef M, const char *Name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue