更新时间:2023-11-10 23:47:34
假设您正在使用C ++ API,则只需固定引用.类似于以下内容:
Assuming you are using C++ API, you will just have to clone each instruction separately while fixing references between them. Something like the following:
llvm::ValueToValueMapTy vmap;
for (auto *inst: instructions_to_clone) {
auto *new_inst = inst->clone();
new_inst->insertBefore(insertion_pos);
vmap[inst] = new_inst;
llvm::RemapInstruction(new_inst, vmap,
RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
}