<div dir="ltr"><div><br></div><div>I want to write an LLVM pass that'll extract the arguments of function calls. If the argument is a constant one, my objective is to recover what that constant is. </div><div><br></div><div>The IR looks like</div><div><br></div><div>    %2 = call noalias i8* @malloc(i64 512) #3</div><div><br></div><div>The LLVM pass looks like</div><div><br></div><div>    bool runOnFunction(Function &F) override {</div><div>        for (auto& B : F) {</div><div>            for (auto& I : B) {</div><div>                if(CallInst* call_inst = dyn_cast<CallInst>(&I)) {</div><div>                    Function* fn = call_inst->getCalledFunction();</div><div>                    StringRef fn_name = fn->getName();</div><div>                    errs() << fn_name << " : " << call_inst->getArgOperand(0) << "\n";</div><div>                    for(auto arg = fn->arg_begin(); arg != fn->arg_end(); ++arg) {</div><div>                        errs() << *arg << "\n";</div><div>                    }</div><div>                }</div><div>            }</div><div>        }</div><div>    </div><div>        return false;</div><div>    } </div><div><br></div><div>If I run the pass through `opt`, it produces the following</div><div><br></div><div>    malloc : 0x3df3f40</div><div>    i64 %0</div><div><br></div><div>What does `0x3df3f40` represent? Instead of `164` and `512`, why does it produce `i64` and `%0`?</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</div>