QUERY

Hi All,
I have a query regarding LLVM,Can LLVM IR can restore high level
information of base language.
Thanks and Regards,
Manish

Hello,

I have a query regarding LLVM,Can LLVM IR can restore high level
information of base language.

It depends, what you're calling "high level information"... But answer
is, in general, "no".

Hi Manish,

Hi All,
I have a query regarding LLVM,Can LLVM IR can restore high level
information of base language.

As Anton mentioned, the general answer is "no". Once the translation
from the source language to the LLVM IR has been completed, the high
level information is lost. In some cases, given knowledge of the front
end compiler, it might be possible to reconstruct the high level
information from the LLVM IR. Additionally, a front end compiler could
choose to emit additional information about the high level structure of
the program to aid in the reconstitution of the source code. However, no
compilers are known to do this currently. A case in point is the current
debug support. The information necessary for debugging is provided by
calls to intrinsic functions and global variables emitted directly into
the LLVM IR stream. These are then recognized by the code generators and
turned into the corresponding DWARF data.

On another front, the HLVM project (http://hlvm.org/) will soon be
integrated with LLVM. Although HLVM is incomplete at this point, it will
in the future support doing what you want. HLVM supports an Abstract
Syntax Tree (AST) which is very close to the syntax of the source
language. HLVM will (optionally) allow you to embed the AST into the
bitcode file so that both the LLVM IR and HLVM AST are in the same
bitcode file. HLVM will provide a library that can call back to an
application to reconstitute the AST and associate it with the LLVM IR
constructs. None of this exists yet, I'm just letting you know future
plans.

Reid.