2012-02-10 31 views

回答

2

如果Simplescalar支持ARM和x86 ELF二進制文件,則它可以與LLVM編譯的程序一起使用。

但是,如果你想要做簡單的分析(什麼時間上真正的CPU運行時,需要程序的每個部分),您可以查看更被譽爲剖析,如:

  • 谷歌,perftools或
  • callgrind/cachegrind或
  • oprofile。

您不能只運行LLVM IR,因爲LLVM的IR在SimpleScalar或通常的分析器中不受支持。 IR由lli和其他llvm工具支持。

如果您想分析哪些分支機構的使用情況和頻率,有PGO(簡檔指導的優化)的LLVM分析。有llvm-prof utilityutils/profile.pl腳本來分析LLVM IR程序。從utils/profile.pl source:

# Program: profile.pl 
# 
# Synopsis: Insert instrumentation code into a program, run it with the JIT, 
#   then print out a profile report. 
# 
# Syntax: profile.pl [OPTIONS] bytecodefile <arguments> 
# 
# OPTIONS may include one or more of the following: 
#  -block - Enable basicblock profiling 
#  -edge  - Enable edge profiling 
#  -function - Enable function profiling 
#  -o <filename> - Emit profiling information to the specified file, instead 
#      of llvmprof.out 
# 
# Any unrecognized options are passed into the invocation of llvm-prof 

HOWTO內部,它是

  1. 一些-insert-*-profiling通行證運行選擇的。輸出儀表IR
  2. 運行具有LLI的intrumented IR(使用JIT的希望)
  3. 開始LLVM,教授到llvmprof.out轉換爲可讀文本

PS有大約LLLVM分析一些研究論文:llvm.org/pubs/2010-04-NeustifterProfiling.pdf