MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / syncDataWithSrc

Method syncDataWithSrc

ir/function.cpp:305–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void Function::syncDataWithSrc(Function &src) {
306 auto IS = src.inputs.begin(), ES = src.inputs.end();
307 auto IT = inputs.begin(), ET = inputs.end();
308
309 for (; IS != ES && IT != ET; ++IS, ++IT) {
310 if (auto in_tgt = dynamic_cast<Input*>(IT->get()))
311 in_tgt->copySMTName(*dynamic_cast<Input*>(IS->get()));
312
313 if (!(IS->get()->getType() == IT->get()->getType()).isTrue())
314 throw AliveException("Source and target args have different type", false);
315 }
316
317 if (IS != ES || IT != ET)
318 throw AliveException("Source and target have different number of args",
319 false);
320
321 // copy function decls that are called indirectly
322 auto copy_fns = [](const auto &src, auto &dst) {
323 for (auto &c : src.getConstants()) {
324 auto *gv = dynamic_cast<const GlobalVariable*>(&c);
325 if (gv && gv->isArbitrarySize() && !dst.getGlobalVar(gv->getName()))
326 dst.addConstant(make_unique<GlobalVariable>(*gv));
327 }
328 };
329 copy_fns(src, *this);
330 copy_fns(*this, src);
331
332 for (auto &decl : fn_decls) {
333 src.addFnDecl(FnDecl(decl));
334 }
335}
336
337Function::instr_iterator::
338instr_iterator(vector<BasicBlock*>::const_iterator &&BBI,

Callers 1

execMethod · 0.80

Calls 12

AliveExceptionClass · 0.85
FnDeclClass · 0.85
copySMTNameMethod · 0.80
getConstantsMethod · 0.80
isArbitrarySizeMethod · 0.80
getGlobalVarMethod · 0.80
addConstantMethod · 0.80
addFnDeclMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
isTrueMethod · 0.45

Tested by

no test coverage detected