2012-02-10 28 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