[llvm-dev] Getting the original high-level code

John Criswell via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 17 06:26:54 PDT 2016


On 3/17/16 9:04 AM, marwayusuf at feng.bu.edu.eg wrote:
>
> I've compiled high level to IR and I want to get the original source 
> code (Not to generate high level code) of a given IR function or part 
> of function like a loop for example.
>

 From what I understand, this is probably pretty difficult.  I have a 
student (Ethan) who needs to use LLVM IR analysis information from a 
MachineFunctionPass, and that is proving to be problematic as the code 
generator will insert new instructions not visible at the LLVM IR 
level.  I suspect that, at best, you can locate the basic block that 
corresponds to the code you are analyzing, but you will probably need to 
use debug information after that to get anything more accurate.

As an FYI, I've suggested a GSoC project to encode high-level analysis 
information (e.g, call graph, points-to results) into the MachineInstr 
IR during code generation.  If that would be useful to others, I'd like 
to know.

Regards,

John Criswell

>
> Regards,
> Marwa Yusuf
> Teaching Assistant - Computer Engineering Department
> Faculty of Engineering - Benha University
> E-JUST PhD Student
> Computer Science & Engineering Dept.
>
>
> ------------------------------------------------------------------------
> *From:* John Criswell <jtcriswel at gmail.com>
> *Sent:* Wednesday, March 16, 2016 4:00 PM
> *To:* marwayusuf at feng.bu.edu.eg; llvm-dev at lists.llvm.org
> *Subject:* Re: [llvm-dev] Getting the original high-level code
> On 3/15/16 9:22 AM, marwayusuf at feng.bu.edu.eg via llvm-dev wrote:
>>
>> Dear All
>>
>> Is there is a way I can get the original hogh level code (e.g c++ 
>> code) of an IR function within MCJIT?
>>
>
> You might want to specify the context.  Are you compiling high level 
> code to LLVM IR to MachineInstr to MC and then wanting to map an MC 
> instruction back to a source level instruction?  Or are you 
> disassembling a binary program to the MC IR and then wanting to 
> reconstruct the source code?
>
> The answer to your question depends on which of these you are trying 
> to do.
>
> Regards,
>
> John Criswell
>
>>
>> Regards,
>> Marwa Yusuf
>> Teaching Assistant - Computer Engineering Department
>> Faculty of Engineering - Benha University
>> E-JUST PhD Student
>> Computer Science & Engineering Dept.
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
> -- 
> John Criswell
> Assistant Professor
> Department of Computer Science, University of Rochester
> http://www.cs.rochester.edu/u/criswell


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160317/78af57c5/attachment.html>


More information about the llvm-dev mailing list