[cfe-dev] Can I establish a relation between a SCoP in LLVM-IR and the corresponding line number in C-code?

Tobias Grosser tobias at grosser.es
Tue Jan 17 05:57:17 PST 2012

On 01/17/2012 11:49 AM, Pieter Custers wrote:
> Hi all,
> I am using LLVM w/ Clang as front end. I use Clang to transform a C-file into LLVM-IR. Now I'm wondering if I can establish a relation between the SCoPs in this IR and the C-code. In other words, I want the line-number in the C-code of this SCoP (e.g. a loop nest) in LLVM-IR.
> Is this possible, and if so, how do I obtain this?

Hi Pieter,

it is not supported out of the box, but you may try to use the debugging 
information to get this information. However, keep in mind,
that debugging information is best afford and may not be available in 
all cases. If you really need accurate feedback based on C-code a source 
analysis tool like pet[1] may better fit your needs. pet uses clang and 
isl to extract a polyhedral model directly from the source code.


[1] http://repo.or.cz/w/pet.git

More information about the cfe-dev mailing list