@@ -36,19 +36,19 @@ class EmitMk final {
36
36
std::vector<std::string> m_concatenatedFilenames{};
37
37
38
38
// Concatenating file score for debugTestConcatenation
39
- std:: int64_t m_dbgScore = 0 ;
39
+ uint64_t m_dbgScore = 0 ;
40
40
41
41
bool isConcatenatingFile () const { return !m_concatenatedFilenames.empty (); }
42
42
};
43
43
44
44
struct FilenameWithScore final {
45
45
std::string m_filename;
46
- std:: int64_t m_score;
46
+ uint64_t m_score;
47
47
};
48
48
49
49
// Data of a single work unit used in `singleConcatenatedFilesList()`.
50
50
struct WorkList final {
51
- std:: int64_t m_totalScore = 0 ;
51
+ uint64_t m_totalScore = 0 ;
52
52
std::vector<FilenameWithScore> m_files{};
53
53
// Number of buckets assigned for this list. Used only in concatenable lists.
54
54
int m_bucketsNum = 0 ;
@@ -80,7 +80,7 @@ class EmitMk final {
80
80
};
81
81
82
82
// Debug logging: prints scores histogram
83
- static void debugLogScoreHistogram (const std::vector<std:: int64_t >& sortedScores) {
83
+ static void debugLogScoreHistogram (const std::vector<uint64_t >& sortedScores) {
84
84
constexpr int LOG_LEVEL = 6 ;
85
85
constexpr int MAX_BAR_LENGTH = 80 ;
86
86
constexpr int MAX_INTERVALS_NUM = 60 ;
@@ -248,7 +248,7 @@ class EmitMk final {
248
248
}
249
249
250
250
static std::vector<FileOrConcatenatedFilesList>
251
- singleConcatenatedFilesList (std::vector<FilenameWithScore> inputFiles, std:: int64_t totalScore,
251
+ singleConcatenatedFilesList (std::vector<FilenameWithScore> inputFiles, uint64_t totalScore,
252
252
std::string concatenatingFilePrefix) {
253
253
UINFO (4 , __FUNCTION__ << " :" << endl);
254
254
UINFO (5 , " Number of input files: " << inputFiles.size () << endl);
@@ -303,7 +303,7 @@ class EmitMk final {
303
303
// Calculate score threshold for filtering out upper outliers.
304
304
305
305
// All scores arranged in ascending order.
306
- std::vector<std:: int64_t > sortedScores;
306
+ std::vector<uint64_t > sortedScores;
307
307
sortedScores.reserve (inputFiles.size ());
308
308
std::transform (inputFiles.begin (), inputFiles.end (), std::back_inserter (sortedScores),
309
309
[](const FilenameWithScore& inputFile) { return inputFile.m_score ; });
@@ -312,7 +312,7 @@ class EmitMk final {
312
312
if (debug () >= 6 ) debugLogScoreHistogram (sortedScores);
313
313
314
314
// Input files with a score exceeding this value are excluded from concatenation.
315
- const std:: int64_t concatenableFileMaxScore = totalScore / totalBucketsNum / 2 ;
315
+ const uint64_t concatenableFileMaxScore = totalScore / totalBucketsNum / 2 ;
316
316
317
317
UINFO (5 , " Concatenable file max score: " << concatenableFileMaxScore << endl);
318
318
@@ -439,7 +439,7 @@ class EmitMk final {
439
439
}
440
440
}
441
441
442
- const std:: int64_t idealBucketScore = concatenableFilesTotalScore / totalBucketsNum;
442
+ const uint64_t idealBucketScore = concatenableFilesTotalScore / totalBucketsNum;
443
443
444
444
UINFO (5 , " Number of buckets: " << totalBucketsNum << endl);
445
445
UINFO (5 , " Ideal bucket score: " << idealBucketScore << endl);
@@ -484,20 +484,20 @@ class EmitMk final {
484
484
}
485
485
486
486
// Ideal bucket score limited to buckets and score of the current Work List.
487
- const std:: int64_t listIdealBucketScore = list.m_totalScore / list.m_bucketsNum ;
487
+ const uint64_t listIdealBucketScore = list.m_totalScore / list.m_bucketsNum ;
488
488
489
489
auto fileIt = list.m_files .begin ();
490
490
for (int i = 0 ; i < list.m_bucketsNum ; ++i) {
491
491
FileOrConcatenatedFilesList bucket;
492
- std:: int64_t bucketScore = 0 ;
492
+ uint64_t bucketScore = 0 ;
493
493
494
494
bucket.m_fileName = concatenatingFilePrefix + std::to_string (concatenatedFileId);
495
495
++concatenatedFileId;
496
496
497
497
for (; fileIt != list.m_files .end (); ++fileIt) {
498
- int64_t diffNow = std::abs (listIdealBucketScore - bucketScore);
499
- int64_t diffIfAdded
500
- = std::abs (listIdealBucketScore - bucketScore - fileIt->m_score );
498
+ uint64_t diffNow = std::abs (( int64_t )( listIdealBucketScore - bucketScore) );
499
+ uint64_t diffIfAdded
500
+ = std::abs (( int64_t )( listIdealBucketScore - bucketScore - fileIt->m_score ) );
501
501
if (bucketScore == 0 || fileIt->m_score == 0 || diffNow > diffIfAdded) {
502
502
// Bucket score will be better with the file in it.
503
503
bucketScore += fileIt->m_score ;
@@ -553,15 +553,15 @@ class EmitMk final {
553
553
if (v3Global.opt .outputGroups () > 0 ) {
554
554
std::vector<FilenameWithScore> slowFiles{};
555
555
std::vector<FilenameWithScore> fastFiles{};
556
- std:: int64_t slowTotalScore = 0 ;
557
- std:: int64_t fastTotalScore = 0 ;
556
+ uint64_t slowTotalScore = 0 ;
557
+ uint64_t fastTotalScore = 0 ;
558
558
559
559
for (AstNodeFile* nodep = v3Global.rootp ()->filesp (); nodep;
560
560
nodep = VN_AS (nodep->nextp (), NodeFile)) {
561
561
const AstCFile* const cfilep = VN_CAST (nodep, CFile);
562
562
if (cfilep && cfilep->source () && cfilep->support () == false ) {
563
563
std::vector<FilenameWithScore>& files = cfilep->slow () ? slowFiles : fastFiles;
564
- int64_t & totalScore = cfilep->slow () ? slowTotalScore : fastTotalScore;
564
+ uint64_t & totalScore = cfilep->slow () ? slowTotalScore : fastTotalScore;
565
565
566
566
FilenameWithScore f;
567
567
f.m_filename = V3Os::filenameNonDirExt (cfilep->name ());
@@ -982,7 +982,7 @@ class EmitMkHierVerilation final {
982
982
void V3EmitMk::debugTestConcatenation (const char * inputFile) {
983
983
const std::unique_ptr<std::ifstream> ifp{V3File::new_ifstream_nodepend (inputFile)};
984
984
std::vector<EmitMk::FilenameWithScore> inputList;
985
- std:: int64_t totalScore = 0 ;
985
+ uint64_t totalScore = 0 ;
986
986
987
987
EmitMk::FilenameWithScore current{};
988
988
while ((*ifp) >> current.m_score >> std::ws) {
0 commit comments