从LLVM callInst中提取临时

从LLVM callInst中提取临时,llvm,Llvm,从以下示例调用: call void %4(%class.EtherAppReq* %2, i64 %5) 我想提取临时%4,将其作为另一个函数的参数传递。为此,我需要它作为值类对象。我怎么做呢 Value *target = call->getCalledValue(); Value *args[] = {point, target}; Builder.CreateCall(func, args); 由于目标,它导致了分段错误。CallInst::getCalledValue(

从以下示例调用:

call void %4(%class.EtherAppReq* %2, i64 %5)
我想提取临时%4,将其作为另一个函数的参数传递。为此,我需要它作为值类对象。我怎么做呢

 Value *target = call->getCalledValue();
 Value *args[] = {point, target};
 Builder.CreateCall(func, args);

由于目标,它导致了分段错误。

CallInst::getCalledValue()
要获取指向
%4
的指针,我首先尝试
getCalledFunction
,如果为空,则
getCalledValue
stripPointerCasts
,如果仍然失败,则退出或跳过此函数

getCalledFunction
将为间接调用返回null,需要使用
getCalledValue
来代替。编辑后答案的后半部分不再适用:
getCalledValue
的返回类型为
Value
,因此,
函数
类根本不涉及。因此,我使用getCalledValue,并使用该返回值作为Builder.createCall N.B.中的参数。我编辑了主帖子