[llvm-dev] Finding the entry point function in a LLVM IR

mohie pokhriyal via llvm-dev llvm-dev at lists.llvm.org
Sat Oct 21 04:51:08 PDT 2017


Hi ,

Given the following LLVM IR :

define i32 @foo(i32 %l) #0 {
entry:
 %add = add nsw i32 %l, 3
 ret i32 %add
}

; Function Attrs: nounwind ssp uwtable
define i32 @boo(i32 %k) #0 {
entry:
 %call = call i32 @foo(i32 %k)
 ret i32 %call
}

; Function Attrs: nounwind ssp uwtable
define i32 @main() #0 {
entry:
 %add = add nsw i32 1, 2
 %add2 = add nsw i32 2, %add
 ret i32 %add2
}


I want to be able to find out that main is the entry point function of the
program.
main and boo both do not have any predecessors or successors , such that I
can make a cfg to figure out who’s calling whom ?

Is there a way I can achieve this ?

Thanks a ton for the help!!

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171021/7ef0c592/attachment.html>


More information about the llvm-dev mailing list