Hi, In LLVM, llc can be used to generate native assembly code for a selected target processor (-march=target). I would like to extract/build CFG from the generated assembly code. Is this possible in LLVM? Anyone knows how to extract CFG from the assembly code? Thanks. With regards Yan Lin
> In LLVM, llc can be used to generate native assembly code for a selected target processor (-march=target). I would like to extract/build CFG from the generated assembly code. > Is this possible in LLVM? Anyone knows how to extract CFG from the assembly code?In general, it's not possible to build CFG precisely from assembly code. Think about indirect calls / branches, for example. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
On Jan 28, 2011, at 5:54 AM, Yan Lin Aung wrote:> In LLVM, llc can be used to generate native assembly code for a selected target processor (-march=target). I would like to extract/build CFG from the generated assembly code. > Is this possible in LLVM? Anyone knows how to extract CFG from the assembly code?Do you want to take as input an arbitrary .s file and try to analyze that to construct a CFG? Or are you asking if LLVM has a CFG available for the machine code that it's about to emit as an assembly file? If the latter, which I suspect is the case, then yes, the back end keeps things organized by basic blocks until very near the end. Have a look at any of the MachineFunction passes for examples of walking the data structures involved. For the former, LLVM may not be much help to you. As Anton points out, this is a tricky problem. Regards, Jim> Thanks. > > With regards > Yan Lin > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Possibly Parallel Threads
- [LLVMdev] Extracting the global variables accessed by individual function with function pass
- [LLVMdev] Extracting the global variables accessed by individual function with function pass
- [LLVMdev] Instruction Latencies After Scheduling
- [LLVMdev] Getting trace output from LLVM
- [LLVMdev] CFG extraction