1 //===-------------------- IncrementalSourceMgr.cpp ------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file defines some implementations for IncrementalSourceMgr.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/MCA/IncrementalSourceMgr.h"
16 #include "llvm/Support/Format.h"
20 using namespace llvm::mca
;
22 void IncrementalSourceMgr::clear() {
29 void IncrementalSourceMgr::updateNext() {
31 Instruction
*I
= Staging
.front();
40 void IncrementalSourceMgr::printStatistic(raw_ostream
&OS
) {
41 unsigned MaxInstStorageSize
= InstStorage
.size();
42 if (MaxInstStorageSize
<= TotalCounter
) {
43 auto Ratio
= double(MaxInstStorageSize
) / double(TotalCounter
);
44 OS
<< "Cache ratio = " << MaxInstStorageSize
<< " / " << TotalCounter
45 << llvm::format(" (%.2f%%)", (1.0 - Ratio
) * 100.0) << "\n";
47 OS
<< "Error: Number of created instructions "
48 << "are larger than the number of issued instructions\n";