<div dir="ltr"><div class="gmail_default" style="color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif">Hello, </font></div><div class="gmail_default" style="color:rgb(0,0,0)"> When I process a LLBM IR(hello.bc), how can I distinguish the "define" function from "declare" function in the IR likes blow:</div><div class="gmail_default" style="color:rgb(0,0,0)"><pre class="" style="margin-top:0px;border:1px solid rgb(204,204,204);outline:0px;font-size:11px;vertical-align:baseline;width:780px;font-family:'Andale Mono','Lucida Console',Monaco,Liberation,fixed,monospace;overflow:auto;clear:right;margin-bottom:6px!important;padding:5px 10px 5px 3px!important;background:rgb(247,247,247)!important">define i32 @main() ssp {
entry:
%retval = alloca i32
%0 = alloca i32
%"alloca point" = bitcast i32 0 to i32
%1 = call i32 @puts(i8* getelementptr inbounds ([13 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %0, align 4
%2 = load i32* %0, align 4
store i32 %2, i32* %retval, align 4
br label %return
return:
%retval1 = load i32* %retval
ret i32 %retval1
}
declare i32 @puts(i8*)</pre></div><div class="gmail_default" style="color:rgb(0,0,0)">when i write a pass as blow, it print both "main" and "puts", now I only want to get the "define" function(main) but not "declare" function(puts), what can I do to complish my work?</div><div class="gmail_default" style="color:rgb(0,0,0)"><pre class="" style="margin-top:0px;border:1px solid rgb(204,204,204);outline:0px;font-size:11px;vertical-align:baseline;width:780px;font-family:'Andale Mono','Lucida Console',Monaco,Liberation,fixed,monospace;overflow:auto;clear:right;margin-bottom:6px!important;padding:5px 10px 5px 3px!important;background:rgb(247,247,247)!important">Module::iterator It = _Module->begin(), Ite = _Module->end();
for(; It != Ite; ++It)
{
errs()<<It->getName()<<"\n";
}</pre></div><div class="gmail_default" style="color:rgb(0,0,0)"><br></div><div class="gmail_default" style="color:rgb(0,0,0)">Thx.</div><div class="gmail_default" style="color:rgb(0,0,0)"><br></div><div class="gmail_default" style="color:rgb(0,0,0)">--WangLei (BUPT)</div><div class="gmail_default" style="color:rgb(0,0,0)"><br></div><div class="gmail_default" style="color:rgb(0,0,0)"><br></div></div>