// Done this way because of floating-point arithmetic. Never sum doubles // if you can sum integers and then calculate the double. public static double getIlpOperations(List<Operation> operations, Mapper ilpScene) { // Create ILP Data ilpScene.processOperations(operations); return calcIlp(ilpScene.getNumberOfOps(), ilpScene.getNumberOfLines()); // List<InstructionBlock> blocks = new ArrayList<InstructionBlock>(); // blocks.add(block); // return getIlp(blocks, ilpScene); }
public static double getIlpBlock(List<InstructionBlock> blocks, Mapper ilpScene) { int totalOperations = 0; int totalLines = 0; for (InstructionBlock block : blocks) { getIlpBlock(block, ilpScene); // Transform block into IR // List<Operation> operations = MbParser.parseMbInstructions(block.getInstructions()); // Collect ILP // MbIlpScene1 ilp = new MbIlpScene1(new MbImmutableTest(), new MbMemoryTest()); // Mapper ilp = new MbIlpScene2(new MbImmutableTest(), new MbMemoryTest()); // ilpScene.processOperations(operations); // Collect data totalOperations += (ilpScene.getNumberOfOps() * block.getRepetitions()); totalLines += (ilpScene.getNumberOfLines() * block.getRepetitions()); } return ((double) totalOperations / (double) totalLines); }