CloneFunctioninto()LLVM中出错
我试图将CFG-in函数复制到一个新函数中,以便对旧函数执行一些操作。 我通过以下代码使用了CloneFunctionIntoCloneFunctioninto()LLVM中出错,llvm,llvm-3.0,Llvm,Llvm 3.0,我试图将CFG-in函数复制到一个新函数中,以便对旧函数执行一些操作。 我通过以下代码使用了CloneFunctionInto std::vector<Type*> ArgTypes; ValueToValueMapTy VMap; FunctionType *FTy = FunctionType::get(F.getFunctionType()->getReturnType(), ArgTypes, F.getFunctionType()-
std::vector<Type*> ArgTypes;
ValueToValueMapTy VMap;
FunctionType *FTy = FunctionType::get(F.getFunctionType()->getReturnType(), ArgTypes, F.getFunctionType()->isVarArg());
Function *NewF = Function::Create(FTy, F.getLinkage(), F.getName());
SmallVector<ReturnInst*, 8> Returns;
CloneFunctionInto(NewF, (Function*) &F, VMap, false, Returns, "_", 0, 0);
堆栈转储:
0. Program arguments: opt -load ../../../Release+Asserts/lib/Blocks.so -blocks
中止(堆芯转储)
进一步说明:它为我提供了正确的基本块和正确的后继块,但由于此错误,它也不能正常工作,看起来您没有正确地复制参数。查看
llvm::CloneModule
函数(在lib/Transforms/Utils/CloneModule.cpp
中),了解如何正确使用CloneFunction
。它看起来不像是在适当地复制参数。查看llvm::CloneModule
函数(在lib/Transforms/Utils/CloneModule.cpp
中),了解如何正确使用CloneFunction
0. Program arguments: opt -load ../../../Release+Asserts/lib/Blocks.so -blocks