public BasicBlock clone(CloneInfo info, CFG newCFG) { BasicBlock newBB = new BasicBlock(newCFG, info.getRenamedLabel(label)); boolean isClosureClone = info instanceof InlineCloneInfo && ((InlineCloneInfo) info).isClosure(); for (Instr instr: instrs) { Instr newInstr = instr.clone(info); // Inlining clones the original CFG/BBs and we want to maintain ipc since it is how // we find which instr we want (we clone original instr and ipc is our identity). //if (info instanceof SimpleCloneInfo && ((SimpleCloneInfo) info).shouldCloneIPC()) { // newInstr.setIPC(instr.getIPC()); // newInstr.setRPC(instr.getRPC()); //} // All call-derived types do not clone this field. Inliner clones original instrs // and we need this preserved to make sure we do not endless inline the same call. if (instr instanceof CallBase && ((CallBase) instr).inliningBlocked()) { ((CallBase) newInstr).blockInlining(); } if (newInstr != null) { // inliner may kill off unneeded instr newBB.addInstr(newInstr); if (isClosureClone && newInstr instanceof YieldInstr) { ((InlineCloneInfo) info).recordYieldSite(newBB, (YieldInstr) newInstr); } } } return newBB; }
public BasicBlock clone(CloneInfo info, CFG newCFG) { BasicBlock newBB = new BasicBlock(newCFG, info.getRenamedLabel(label)); boolean isClosureClone = info instanceof InlineCloneInfo && ((InlineCloneInfo) info).isClosure(); for (Instr instr: instrs) { Instr newInstr = instr.clone(info); // Inlining clones the original CFG/BBs and we want to maintain ipc since it is how // we find which instr we want (we clone original instr and ipc is our identity). //if (info instanceof SimpleCloneInfo && ((SimpleCloneInfo) info).shouldCloneIPC()) { // newInstr.setIPC(instr.getIPC()); // newInstr.setRPC(instr.getRPC()); //} // All call-derived types do not clone this field. Inliner clones original instrs // and we need this preserved to make sure we do not endless inline the same call. if (instr instanceof CallBase && ((CallBase) instr).inliningBlocked()) { ((CallBase) newInstr).blockInlining(); } if (newInstr != null) { // inliner may kill off unneeded instr newBB.addInstr(newInstr); if (isClosureClone && newInstr instanceof YieldInstr) { ((InlineCloneInfo) info).recordYieldSite(newBB, (YieldInstr) newInstr); } } } return newBB; }
public BasicBlock cloneForInlining(InlineCloneInfo ii) { BasicBlock clonedBB = ii.getOrCreateRenamedBB(this); for (Instr i: getInstrs()) { Instr clonedInstr = i.clone(ii); if (clonedInstr != null) { clonedBB.addInstr(clonedInstr); if (clonedInstr instanceof YieldInstr) { ii.recordYieldSite(clonedBB, (YieldInstr)clonedInstr); } else if (i instanceof NonlocalReturnInstr && clonedInstr instanceof CopyInstr) { // non-local returns assign to method return variable but must jump to proper exit point clonedBB.addInstr(new JumpInstr(ii.getHostScope().getCFG().getExitBB().getLabel())); // FIXME: enebo...I see no guarantee that this copy will be part of a return? This behavior is // masked in any case I can see with optimization to not use a copy but convert non-local to local return. } } } return clonedBB; }
public BasicBlock cloneForInlining(InlineCloneInfo ii) { BasicBlock clonedBB = ii.getOrCreateRenamedBB(this); for (Instr i: getInstrs()) { Instr clonedInstr = i.clone(ii); if (clonedInstr != null) { clonedBB.addInstr(clonedInstr); if (clonedInstr instanceof YieldInstr) { ii.recordYieldSite(clonedBB, (YieldInstr)clonedInstr); } else if (i instanceof NonlocalReturnInstr && clonedInstr instanceof CopyInstr) { // non-local returns assign to method return variable but must jump to proper exit point clonedBB.addInstr(new JumpInstr(ii.getHostScope().getCFG().getExitBB().getLabel())); // FIXME: enebo...I see no guarantee that this copy will be part of a return? This behavior is // masked in any case I can see with optimization to not use a copy but convert non-local to local return. } } } return clonedBB; }