public void addLoop(CodeSegment loop) { if (loop == null) { LoggingUtils.getLogger().warning("LoopUnit is null;"); return; } if (onlyStoreLoops) { // Only write units of the type loop if (!loop.isLoop()) { return; } } // Check if loop has enough iterations if (loop.getIterations() < iterationsThreshold) { return; } // Check if loop was already written if (ids.contains(loop.getId())) { return; } ids.add(loop.getId()); loops.add(loop); }
private int processLoops(List<CodeSegment> loops) { if (loops == null) { return 0; } int loopInstCount = 0; for (CodeSegment unit : loops) { processLoop(unit); // Stats loopInstCount += unit.getTotalInstructions(); } return loopInstCount; }