IR: Make getNumInsts return type size_t

There's no need to cast here.
This commit is contained in:
Lioncash 2017-01-16 19:38:13 -05:00
parent 459a6e73c3
commit 67fc73e82c
3 changed files with 8 additions and 7 deletions

View File

@ -77,7 +77,7 @@ struct RegInfo final : private NonCopyable
u32 numFSpills = 0;
u32 exitNumber = 0;
RegInfo(JitIL* j, InstLoc f, u32 insts) : Jit(j), FirstI(f), IInfo(insts), lastUsed(insts) {}
RegInfo(JitIL* j, InstLoc f, size_t insts) : Jit(j), FirstI(f), IInfo(insts), lastUsed(insts) {}
};
static BitSet32 regsInUse(RegInfo& R)

View File

@ -1769,15 +1769,15 @@ void IRBuilder::WriteToFile(u64 codeHash)
const InstLoc lastCurReadPtr = curReadPtr;
StartForwardPass();
const unsigned numInsts = getNumInsts();
for (unsigned int i = 0; i < numInsts; ++i)
const size_t numInsts = getNumInsts();
for (size_t i = 0; i < numInsts; ++i)
{
const InstLoc I = ReadForward();
const unsigned opcode = getOpcode(*I);
const bool thisUsed = IsMarkUsed(I) || alwaysUseds.find(opcode) != alwaysUseds.end();
// Line number
fprintf(file, "%4u", i);
fprintf(file, "%4zu", i);
if (!thisUsed)
fprintf(file, "%*c", 32, ' ');
@ -1795,7 +1795,7 @@ void IRBuilder::WriteToFile(u64 codeHash)
if (isImm(*inst))
fprintf(file, " 0x%08x", GetImmValue(inst));
else
fprintf(file, " %10u", i - (unsigned int)(I - inst));
fprintf(file, " %10zu", i - static_cast<size_t>(I - inst));
}
// Op2
@ -1806,7 +1806,7 @@ void IRBuilder::WriteToFile(u64 codeHash)
if (isImm(*inst))
fprintf(file, " 0x%08x", GetImmValue(inst));
else
fprintf(file, " %10u", i - (unsigned int)(I - inst));
fprintf(file, " %10zu", i - static_cast<size_t>(I - inst));
}
if (extra8Regs.count(opcode))

View File

@ -5,6 +5,7 @@
#pragma once
#include <array>
#include <cstddef>
#include <vector>
#include "Common/CommonTypes.h"
@ -379,7 +380,7 @@ public:
InstLoc ReadForward() { return curReadPtr++; }
InstLoc ReadBackward() { return --curReadPtr; }
InstLoc getFirstInst() { return InstList.data(); }
unsigned int getNumInsts() { return (unsigned int)InstList.size(); }
size_t getNumInsts() const { return InstList.size(); }
unsigned int GetImmValue(InstLoc I) const { return (u32)GetImmValue64(I); }
u64 GetImmValue64(InstLoc I) const;
void SetMarkUsed(InstLoc I);