Access to the value of an argument to a function invocation in LLVM

220 Views Asked by At

In my LLVM IR, I have a number of function invocations that look like this:

%2 = invoke i16 @"_ZN41_$LT$std..sync..mpsc..Sender$LT$T$GT$$GT$4send17h3c94bf47bc6c3500E"(%"std::sync::mpsc::Sender<weather::Weather>"* dereferenceable(16) %weather_sender, i8 %1)
      to label %bb4 unwind label %cleanup, !dbg !717

I want to statically analyze them in order to find the value for the last argument, %_6. Is there a way to get its value? I tried to access the argument directly but this just gives me the instruction where the argument is loaded/allocated. So this:

if (InvokeInst* ii = dyn_cast<InvokeInst>(&instr)) {
    Value* v = ii->getArgOperand(ii->getNumArgOperands() - 1);
    v->dump();
}

just gives me %1 = load i8, i8* %_5, !dbg !717, the load instruction that gives me

0

There are 0 best solutions below