[LLVMdev] Hi Cache Miss and Branch Misprediction
Nick Lewycky
nicholas at mxc.ca
Mon Sep 29 00:21:31 PDT 2008
Ketan Pundlik Umare wrote:
> Hi Guys,
> I am an absolute newbie to the compiler community. I am experimenting a little bit with llvm.
> I have a few small questions, i would be really great if someone could help me.
It sounds like what you want is valgrind --tool=cachegrind (or
--tool=callgrind). See http://valgrind.org/
> 1. Can i find out (is there something already built), if the previous instruction / or some instruction was a cache miss. Basically i want to detect cache misses and instructions that are causing this
>
> 2. Can i find if there was a branch misprediction?
>
> 3. Can i find if a branch was taken or not taken?
>
> It would be really great if someone could answer this for me.
I suppose you could instrument the existing LLVM JIT to collect this
sort of information.
Realize that much of LLVM works in the LLVM IR language, and we just
'lower' to assembly. LLVM 'passes' which modify code work by editing the
IR, not the assembly, so things like 'branch prediction' and whatnot
don't exist at that level. If you want to do it with LLVM, you'll likely
need to build most of the infrastructure yourself.
If you're interested in what we do have, see llvm/tools/llvm-prof.cpp,
llvm/runtime/libprofile and llvm/utils/profile.pl . I have no idea what
state this stuff is in, quite possibly bitrotted.
Nick Lewycky
More information about the llvm-dev
mailing list