[LLVMdev] Automating Diagnostic Instrumentation
Chris Lattner
sabre at nondot.org
Wed Apr 7 11:42:01 PDT 2004
On Wed, 7 Apr 2004, Reid Spencer wrote:
> (2) Would it be useful to turn the call graph data ino a pretty picture
> via graphviz (both statically and dynamically) ?
Sure: analyze -print-callgraph foo.bc
> (3) How much of this auto-instrumentation pass is already written in
> existing passes?
There are various instrumentation passes already in LLVM, for example, to
trace instructions as they execute, to insert profiling instrumentation,
etc. These live in lib/Transforms/Instrumentation/
> (4) Are there other ways to achieve the same ends?
I dunno. It sounds like a good approach. :)
> (5) Can someone give me some tips on how to implement this? It would be
> my first LLVM pass.
I would take a look at other passes that do similar things. For example,
look at clients of the CallGraph class and look at a couple of the
instrumentation classes. If you know what code you want to insert, it
should be fairly straight-forward.
> (1) Is there be a general mechanism to communicate information between
> source language compiler and LLVM pass?
No, not at present.
> If there isn't, should there be? In the case I describe above it would
> be *highly* useful (IMO) to have the source language compiler provide
> source level information for a language independent pass to use later.
Sure, again, it's a matter of designing the feature so that it is broadly
applicable and fits in with the LLVM "style". If the feature made sense
in the context of LLVM, extending LLVM isn't a problem. How to get more
source-level information into LLVM is an open question.
> (2) Is there any existing mechanism in LLVM for providing (1) directly?
> What I'm thinking of is some kind of API that the source language
> compiler can use to add addtional information that any subsequent pass
> might need to use.
Not yet. If you're interested, you check out the debugger documentation.
In the case of the debugger, the source language front-end packages up
language-specific information and passes it through LLVM. LLVM doesn't
understand or interpret this information though, the debugger process does
in the end.
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/
More information about the llvm-dev
mailing list