IR: Move implementation of the constructor and Reset into the cpp file

Neither of these are intended to be called extremely frequently to warrant
this.
This commit is contained in:
Lioncash 2017-01-16 18:21:09 -05:00
parent 47fc72f0a8
commit ef3e6de875
2 changed files with 37 additions and 29 deletions

View File

@ -137,6 +137,39 @@ using namespace Gen;
namespace IREmitter namespace IREmitter
{ {
IRBuilder::IRBuilder()
{
Reset();
}
void IRBuilder::Reset()
{
InstList.clear();
InstList.reserve(100000);
MarkUsed.clear();
MarkUsed.reserve(100000);
for (unsigned i = 0; i < 32; i++)
{
GRegCache[i] = nullptr;
GRegCacheStore[i] = nullptr;
FRegCache[i] = nullptr;
FRegCacheStore[i] = nullptr;
}
CarryCache = nullptr;
CarryCacheStore = nullptr;
for (unsigned i = 0; i < 8; i++)
{
CRCache[i] = nullptr;
CRCacheStore[i] = nullptr;
}
CTRCache = nullptr;
CTRCacheStore = nullptr;
}
InstLoc IRBuilder::EmitZeroOp(unsigned Opcode, unsigned extra = 0) InstLoc IRBuilder::EmitZeroOp(unsigned Opcode, unsigned extra = 0)
{ {
InstLoc curIndex = InstList.data() + InstList.size(); InstLoc curIndex = InstList.data() + InstList.size();

View File

@ -229,7 +229,10 @@ InstLoc inline getOp2(InstLoc i)
class IRBuilder class IRBuilder
{ {
public: public:
IRBuilder() { Reset(); } IRBuilder();
void Reset();
InstLoc EmitIntConst(unsigned value) { return EmitIntConst64(value); } InstLoc EmitIntConst(unsigned value) { return EmitIntConst64(value); }
InstLoc EmitIntConst64(u64 value); InstLoc EmitIntConst64(u64 value);
@ -382,34 +385,6 @@ public:
bool IsMarkUsed(InstLoc I) const; bool IsMarkUsed(InstLoc I) const;
void WriteToFile(u64 codeHash); void WriteToFile(u64 codeHash);
void Reset()
{
InstList.clear();
InstList.reserve(100000);
MarkUsed.clear();
MarkUsed.reserve(100000);
for (unsigned i = 0; i < 32; i++)
{
GRegCache[i] = nullptr;
GRegCacheStore[i] = nullptr;
FRegCache[i] = nullptr;
FRegCacheStore[i] = nullptr;
}
CarryCache = nullptr;
CarryCacheStore = nullptr;
for (unsigned i = 0; i < 8; i++)
{
CRCache[i] = nullptr;
CRCacheStore[i] = nullptr;
}
CTRCache = nullptr;
CTRCacheStore = nullptr;
}
private: private:
IRBuilder(IRBuilder&); // DO NOT IMPLEMENT IRBuilder(IRBuilder&); // DO NOT IMPLEMENT