1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Trimmed trailing whitespace

This commit is contained in:
Brian Fiete 2022-07-27 12:26:36 -04:00
parent 4f2fd58284
commit 602c7f318f
13 changed files with 1049 additions and 1113 deletions

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,7 @@ public:
bool mIsStatic; bool mIsStatic;
bool mIsTLS; bool mIsTLS;
BeMCSymbolKind mSymKind; BeMCSymbolKind mSymKind;
int mValue; int mValue;
int mIdx; int mIdx;
int mSectionNum; int mSectionNum;
@ -169,7 +169,7 @@ public:
return false; return false;
for (int i = 0; i < (int)lhs->mType->mParams.size(); i++) for (int i = 0; i < (int)lhs->mType->mParams.size(); i++)
if (lhs->mType->mParams[i] != rhs->mType->mParams[i]) if (lhs->mType->mParams[i] != rhs->mType->mParams[i])
return false; return false;
return true; return true;
} }
}; };
@ -215,16 +215,16 @@ public:
PerfManager* mPerfManager; PerfManager* mPerfManager;
DataStream* mStream; DataStream* mStream;
BumpAllocator mAlloc; BumpAllocator mAlloc;
BeModule* mBeModule; BeModule* mBeModule;
OwnedVector<BeMCSymbol> mSymbols; OwnedVector<BeMCSymbol> mSymbols;
OwnedVector<BeCOFFSection> mDynSects; OwnedVector<BeCOFFSection> mDynSects;
uint32 mTimestamp; uint32 mTimestamp;
BeCOFFSection mTextSect; BeCOFFSection mTextSect;
BeCOFFSection mDataSect; BeCOFFSection mDataSect;
BeCOFFSection mRDataSect; BeCOFFSection mRDataSect;
BeCOFFSection mBSSSect; BeCOFFSection mBSSSect;
BeCOFFSection mTLSSect; BeCOFFSection mTLSSect;
BeCOFFSection mPDataSect; BeCOFFSection mPDataSect;
BeCOFFSection mXDataSect; BeCOFFSection mXDataSect;
BeCOFFSection mDebugSSect; BeCOFFSection mDebugSSect;
@ -234,8 +234,8 @@ public:
int mBSSPos; int mBSSPos;
Array<BeCOFFSection*> mUsedSections; Array<BeCOFFSection*> mUsedSections;
Dictionary<BeValue*, BeMCSymbol*> mSymbolMap; Dictionary<BeValue*, BeMCSymbol*> mSymbolMap;
Dictionary<String, BeMCSymbol*> mNamedSymbolMap; Dictionary<String, BeMCSymbol*> mNamedSymbolMap;
HashSet<COFFArgListRef> mArgListSet; HashSet<COFFArgListRef> mArgListSet;
HashSet<COFFFuncTypeRef> mFuncTypeSet; HashSet<COFFFuncTypeRef> mFuncTypeSet;
Deque<BeFunction*> mFuncWorkList; Deque<BeFunction*> mFuncWorkList;
int mTTagStartPos; int mTTagStartPos;
@ -244,10 +244,10 @@ public:
int mSectionStartPos; int mSectionStartPos;
int mCurStringId; int mCurStringId;
int mCurJumpTableIdx; int mCurJumpTableIdx;
bool mTypesLocked; bool mTypesLocked;
String mDirectives; String mDirectives;
public: public:
void ToString(BeMDNode* mdNode, String& str); void ToString(BeMDNode* mdNode, String& str);
int GetCVRegNum(X64CPURegister reg, int bits); int GetCVRegNum(X64CPURegister reg, int bits);
@ -255,10 +255,10 @@ public:
void DbgTStartTag(); void DbgTStartTag();
void DbgTEndTag(); void DbgTEndTag();
void DbgEncodeConstant(DynMemStream& memStream, int64 val); void DbgEncodeConstant(DynMemStream& memStream, int64 val);
void DbgEncodeString(DynMemStream& memStream, const StringImpl& str); void DbgEncodeString(DynMemStream& memStream, const StringImpl& str);
void DbgMakeFuncType(BeDbgFunction* dbgFunc); void DbgMakeFuncType(BeDbgFunction* dbgFunc);
void DbgMakeFunc(BeDbgFunction* dbgFunc); void DbgMakeFunc(BeDbgFunction* dbgFunc);
int DbgGetTypeId(BeDbgType* dbgType, bool doDefine = false); int DbgGetTypeId(BeDbgType* dbgType, bool doDefine = false);
void DbgGenerateTypeInfo(); void DbgGenerateTypeInfo();
void DbgSAlign(); void DbgSAlign();
@ -270,18 +270,18 @@ public:
void DbgEndSection(); void DbgEndSection();
void DbgStartVarDefRange(BeDbgFunction* dbgFunc, BeDbgVariable* dbgVar, const BeDbgVariableLoc& varLoc, int offset, int range); void DbgStartVarDefRange(BeDbgFunction* dbgFunc, BeDbgVariable* dbgVar, const BeDbgVariableLoc& varLoc, int offset, int range);
void DbgEndLineBlock(BeDbgFunction* dbgFunc, const Array<BeDbgCodeEmission>& emissions, int blockStartPos, int emissionStartIdx, int lineCount); void DbgEndLineBlock(BeDbgFunction* dbgFunc, const Array<BeDbgCodeEmission>& emissions, int blockStartPos, int emissionStartIdx, int lineCount);
void DbgGenerateModuleInfo(); void DbgGenerateModuleInfo();
void InitSect(BeCOFFSection& sect, const StringImpl& name, int characteristics, bool addNow, bool makeSectSymbol); void InitSect(BeCOFFSection& sect, const StringImpl& name, int characteristics, bool addNow, bool makeSectSymbol);
void AlignConst(BeCOFFSection& sect, BeConstant* constVal); void AlignConst(BeCOFFSection& sect, BeConstant* constVal);
void WriteConst(BeCOFFSection& sect, BeConstant* constVal); void WriteConst(BeCOFFSection& sect, BeConstant* constVal);
void Generate(BeModule* module); void Generate(BeModule* module);
public: public:
BeCOFFObject(); BeCOFFObject();
void Finish(); void Finish();
bool Generate(BeModule* module, const StringImpl& fileName); bool Generate(BeModule* module, const StringImpl& fileName);
BeMCSymbol* GetSymbol(BeValue* value, bool allowCreate = true); BeMCSymbol* GetSymbol(BeValue* value, bool allowCreate = true);
BeMCSymbol* GetSymbolRef(const StringImpl& name); BeMCSymbol* GetSymbolRef(const StringImpl& name);
void MarkSectionUsed(BeCOFFSection& sect, bool getSectSymbol = false); void MarkSectionUsed(BeCOFFSection& sect, bool getSectSymbol = false);

View file

@ -28,7 +28,7 @@ BeType* BeContext::GetPrimitiveType(BeTypeCode typeCode)
primType->mTypeCode = typeCode; primType->mTypeCode = typeCode;
switch (typeCode) switch (typeCode)
{ {
case BeTypeCode_None: case BeTypeCode_None:
primType->mSize = 0; primType->mSize = 0;
primType->mAlign = 0; primType->mAlign = 0;
break; break;
@ -80,24 +80,24 @@ BeStructType* BeContext::CreateStruct(const StringImpl& name)
BeStructType* structType = mTypes.Alloc<BeStructType>(); BeStructType* structType = mTypes.Alloc<BeStructType>();
structType->mContext = this; structType->mContext = this;
structType->mTypeCode = BeTypeCode_Struct; structType->mTypeCode = BeTypeCode_Struct;
structType->mName = name; structType->mName = name;
structType->mIsOpaque = true; structType->mIsOpaque = true;
return structType; return structType;
} }
BeStructType* BeContext::CreateStruct(const SizedArrayImpl<BeType*>& types) BeStructType* BeContext::CreateStruct(const SizedArrayImpl<BeType*>& types)
{ {
BeStructType** valuePtr = NULL; BeStructType** valuePtr = NULL;
if (mAnonymousStructMap.TryGetValueWith(types, &valuePtr)) if (mAnonymousStructMap.TryGetValueWith(types, &valuePtr))
return *valuePtr; return *valuePtr;
Array<BeType*> key; Array<BeType*> key;
for (auto type : types) for (auto type : types)
key.Add(type); key.Add(type);
BeStructType* structType = CreateStruct(""); BeStructType* structType = CreateStruct("");
SetStructBody(structType, types, false); SetStructBody(structType, types, false);
mAnonymousStructMap.TryAdd(key, structType); mAnonymousStructMap.TryAdd(key, structType);
return structType; return structType;
} }
@ -109,7 +109,7 @@ BePointerType* BeContext::GetPointerTo(BeType* beType)
pointerType->mTypeCode = BeTypeCode_Pointer; pointerType->mTypeCode = BeTypeCode_Pointer;
pointerType->mElementType = beType; pointerType->mElementType = beType;
pointerType->mSize = mPointerSize; pointerType->mSize = mPointerSize;
pointerType->mAlign = mPointerSize; pointerType->mAlign = mPointerSize;
beType->mPointerType = pointerType; beType->mPointerType = pointerType;
/*if (beType->IsSizedArray()) /*if (beType->IsSizedArray())
@ -197,12 +197,12 @@ bool BeContext::AreTypesEqual(BeType* lhs, BeType* rhs)
{ {
if (lhs == rhs) if (lhs == rhs)
return true; return true;
if (lhs->mTypeCode != rhs->mTypeCode) if (lhs->mTypeCode != rhs->mTypeCode)
return false; return false;
switch (lhs->mTypeCode) switch (lhs->mTypeCode)
{ {
case BeTypeCode_None: case BeTypeCode_None:
case BeTypeCode_NullPtr: case BeTypeCode_NullPtr:
case BeTypeCode_Boolean: case BeTypeCode_Boolean:
@ -214,7 +214,7 @@ bool BeContext::AreTypesEqual(BeType* lhs, BeType* rhs)
case BeTypeCode_Double: case BeTypeCode_Double:
return true; return true;
case BeTypeCode_Pointer: case BeTypeCode_Pointer:
return AreTypesEqual(((BePointerType*)lhs)->mElementType, ((BePointerType*)rhs)->mElementType); return AreTypesEqual(((BePointerType*)lhs)->mElementType, ((BePointerType*)rhs)->mElementType);
case BeTypeCode_SizedArray: case BeTypeCode_SizedArray:
{ {
auto lhsSizedArray = (BeSizedArrayType*)lhs; auto lhsSizedArray = (BeSizedArrayType*)lhs;
@ -222,7 +222,7 @@ bool BeContext::AreTypesEqual(BeType* lhs, BeType* rhs)
if (lhsSizedArray->mLength != rhsSizedArray->mLength) if (lhsSizedArray->mLength != rhsSizedArray->mLength)
return false; return false;
return AreTypesEqual(lhsSizedArray->mElementType, rhsSizedArray->mElementType); return AreTypesEqual(lhsSizedArray->mElementType, rhsSizedArray->mElementType);
} }
case BeTypeCode_Vector: case BeTypeCode_Vector:
{ {
auto lhsSizedArray = (BeVectorType*)lhs; auto lhsSizedArray = (BeVectorType*)lhs;
@ -233,5 +233,4 @@ bool BeContext::AreTypesEqual(BeType* lhs, BeType* rhs)
} }
} }
return false; return false;
} }

View file

@ -88,7 +88,6 @@ public:
virtual ~BeType() virtual ~BeType()
{ {
} }
int GetStride() int GetStride()
@ -120,7 +119,6 @@ public:
{ {
return (mTypeCode == BeTypeCode_Float) || (mTypeCode == BeTypeCode_Double); return (mTypeCode == BeTypeCode_Float) || (mTypeCode == BeTypeCode_Double);
} }
bool IsStruct() bool IsStruct()
{ {
@ -159,10 +157,10 @@ public:
} }
virtual void HashContent(BeHashContext& hashCtx) virtual void HashContent(BeHashContext& hashCtx)
{ {
BF_ASSERT(mTypeCode < BeTypeCode_Struct); BF_ASSERT(mTypeCode < BeTypeCode_Struct);
hashCtx.Mixin(mTypeCode); hashCtx.Mixin(mTypeCode);
} }
}; };
class BeStructMember class BeStructMember
@ -174,21 +172,21 @@ public:
class BeStructType : public BeType class BeStructType : public BeType
{ {
public: public:
BeContext* mContext; BeContext* mContext;
String mName; String mName;
Array<BeStructMember> mMembers; Array<BeStructMember> mMembers;
bool mIsPacked; bool mIsPacked;
bool mIsOpaque; bool mIsOpaque;
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
hashCtx.MixinStr(mName); hashCtx.MixinStr(mName);
hashCtx.Mixin(mMembers.size()); hashCtx.Mixin(mMembers.size());
for (auto& member : mMembers) for (auto& member : mMembers)
{ {
member.mType->HashReference(hashCtx); member.mType->HashReference(hashCtx);
hashCtx.Mixin(member.mByteOffset); hashCtx.Mixin(member.mByteOffset);
} }
hashCtx.Mixin(mIsPacked); hashCtx.Mixin(mIsPacked);
hashCtx.Mixin(mIsOpaque); hashCtx.Mixin(mIsOpaque);
@ -213,9 +211,9 @@ public:
BeContext* mContext; BeContext* mContext;
BeType* mElementType; BeType* mElementType;
int mLength; int mLength;
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(BeTypeCode_SizedArray); hashCtx.Mixin(BeTypeCode_SizedArray);
hashCtx.Mixin(mLength); hashCtx.Mixin(mLength);
mElementType->HashReference(hashCtx); mElementType->HashReference(hashCtx);
@ -247,27 +245,27 @@ class BeFunctionType : public BeType
{ {
public: public:
String mName; String mName;
BeType* mReturnType; BeType* mReturnType;
Array<BeFunctionTypeParam> mParams; Array<BeFunctionTypeParam> mParams;
bool mIsVarArg; bool mIsVarArg;
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(BeTypeCode_Function); hashCtx.Mixin(BeTypeCode_Function);
hashCtx.MixinStr(mName); hashCtx.MixinStr(mName);
mReturnType->HashReference(hashCtx); mReturnType->HashReference(hashCtx);
hashCtx.Mixin(mParams.size()); hashCtx.Mixin(mParams.size());
for (auto& param : mParams) for (auto& param : mParams)
{ {
param.mType->HashReference(hashCtx); param.mType->HashReference(hashCtx);
} }
hashCtx.Mixin(mIsVarArg); hashCtx.Mixin(mIsVarArg);
} }
}; };
class BeContext class BeContext
{ {
public: public:
int mPointerSize; int mPointerSize;
//BumpAllocator mAlloc; //BumpAllocator mAlloc;
BeType* mPrimitiveTypes[BeTypeCode_COUNT]; BeType* mPrimitiveTypes[BeTypeCode_COUNT];
@ -278,8 +276,8 @@ public:
void NotImpl(); void NotImpl();
public: public:
BeContext(); BeContext();
BeType* GetPrimitiveType(BeTypeCode typeCode); BeType* GetPrimitiveType(BeTypeCode typeCode);
BeType* GetVoidPtrType(); BeType* GetVoidPtrType();
BeStructType* CreateStruct(const StringImpl& name); BeStructType* CreateStruct(const StringImpl& name);
BeStructType* CreateStruct(const SizedArrayImpl<BeType*>& types); BeStructType* CreateStruct(const SizedArrayImpl<BeType*>& types);

View file

@ -8,4 +8,3 @@
NS_BF_BEGIN NS_BF_BEGIN
NS_BF_END NS_BF_END

File diff suppressed because it is too large Load diff

View file

@ -75,40 +75,40 @@ class BeIRCodeGen : public BfIRCodeGenBase
{ {
public: public:
bool mDebugging; bool mDebugging;
BfIRBuilder* mBfIRBuilder; BfIRBuilder* mBfIRBuilder;
BeFunction* mActiveFunction; BeFunction* mActiveFunction;
BeContext* mBeContext; BeContext* mBeContext;
BeModule* mBeModule; BeModule* mBeModule;
Array<BeDbgLoc*> mSavedDebugLocs; Array<BeDbgLoc*> mSavedDebugLocs;
bool mHasDebugLoc; bool mHasDebugLoc;
int mCmdCount; int mCmdCount;
Dictionary<int, BeIRCodeGenEntry> mResults; Dictionary<int, BeIRCodeGenEntry> mResults;
Dictionary<int, BeIRTypeEntry> mTypes; Dictionary<int, BeIRTypeEntry> mTypes;
Dictionary<BeType*, BeDbgType*> mOnDemandTypeMap; Dictionary<BeType*, BeDbgType*> mOnDemandTypeMap;
Dictionary<BeType*, BeValue*> mReflectDataMap; Dictionary<BeType*, BeValue*> mReflectDataMap;
Array<int> mConfigConsts; Array<int> mConfigConsts;
public: public:
void FatalError(const StringImpl& str); void FatalError(const StringImpl& str);
void NotImpl(); void NotImpl();
BfTypeCode GetTypeCode(BeType* type, bool isSigned); BfTypeCode GetTypeCode(BeType* type, bool isSigned);
void SetResult(int id, BeValue* value); void SetResult(int id, BeValue* value);
void SetResult(int id, BeType* type); void SetResult(int id, BeType* type);
void SetResult(int id, BeBlock* value); void SetResult(int id, BeBlock* value);
void SetResult(int id, BeMDNode* md); void SetResult(int id, BeMDNode* md);
BeType* GetBeType(BfTypeCode typeCode, bool& isSigned); BeType* GetBeType(BfTypeCode typeCode, bool& isSigned);
BeIRTypeEntry& GetTypeEntry(int typeId); BeIRTypeEntry& GetTypeEntry(int typeId);
void FixValues(BeStructType* structType, CmdParamVec<BeValue*>& values); void FixValues(BeStructType* structType, CmdParamVec<BeValue*>& values);
public: public:
BeIRCodeGen(); BeIRCodeGen();
~BeIRCodeGen(); ~BeIRCodeGen();
void Hash(BeHashContext& hashCtx); void Hash(BeHashContext& hashCtx);
bool IsModuleEmpty(); bool IsModuleEmpty();
@ -127,12 +127,12 @@ public:
void Read(BeConstant*& beConstant); void Read(BeConstant*& beConstant);
void Read(BeFunction*& beFunc); void Read(BeFunction*& beFunc);
void Read(BeBlock*& beBlock); void Read(BeBlock*& beBlock);
void Read(BeMDNode*& beMD); void Read(BeMDNode*& beMD);
template <typename T> template <typename T>
void Read(SizedArrayImpl<T>& vec) void Read(SizedArrayImpl<T>& vec)
{ {
int len = (int)ReadSLEB128(); int len = (int)ReadSLEB128();
for (int i = 0; i < len; i++) for (int i = 0; i < len; i++)
{ {
T result; T result;
@ -140,11 +140,11 @@ public:
vec.push_back(result); vec.push_back(result);
} }
} }
void Init(const BfSizedArray<uint8>& buffer); void Init(const BfSizedArray<uint8>& buffer);
void Process(); void Process();
virtual void ProcessBfIRData(const BfSizedArray<uint8>& buffer) override; virtual void ProcessBfIRData(const BfSizedArray<uint8>& buffer) override;
virtual void HandleNextCmd() override; virtual void HandleNextCmd() override;
virtual void SetConfigConst(int idx, int value) override; virtual void SetConfigConst(int idx, int value) override;

View file

@ -1,4 +1,3 @@
#pragma warning(disable:4996) #pragma warning(disable:4996)
#include "BeLibManger.h" #include "BeLibManger.h"
#include "BeefySysLib/util/BeefPerf.h" #include "BeefySysLib/util/BeefPerf.h"
@ -37,7 +36,7 @@ bool BeLibFile::ReadLib()
mOldFileStream.Read(fileId, 8); mOldFileStream.Read(fileId, 8);
if (strncmp(fileId, "!<arch>\n", 8) != 0) if (strncmp(fileId, "!<arch>\n", 8) != 0)
return false; return false;
const char* libStrTable = NULL; const char* libStrTable = NULL;
Dictionary<int, BeLibEntry*> pendingLibEntryMap; Dictionary<int, BeLibEntry*> pendingLibEntryMap;
@ -62,18 +61,18 @@ bool BeLibFile::ReadLib()
mOldFileStream.Read(data, len); mOldFileStream.Read(data, len);
int numSymbols = FromBigEndian(*(int32*)data); int numSymbols = FromBigEndian(*(int32*)data);
uint8* strTab = data + 4 + numSymbols * 4; uint8* strTab = data + 4 + numSymbols * 4;
for (int symIdx = 0; symIdx < numSymbols; symIdx++) for (int symIdx = 0; symIdx < numSymbols; symIdx++)
{ {
const char* str = (char*)strTab; const char* str = (char*)strTab;
strTab += strlen((char*)strTab) + 1; strTab += strlen((char*)strTab) + 1;
int offset = FromBigEndian(((int32*)(data + 4))[symIdx]); int offset = FromBigEndian(((int32*)(data + 4))[symIdx]);
BeLibEntry* pendingEntry; BeLibEntry* pendingEntry;
BeLibEntry** pendingEntryPtr = NULL; BeLibEntry** pendingEntryPtr = NULL;
if (!pendingLibEntryMap.TryAdd(offset, NULL, &pendingEntryPtr)) if (!pendingLibEntryMap.TryAdd(offset, NULL, &pendingEntryPtr))
{ {
@ -93,7 +92,6 @@ bool BeLibFile::ReadLib()
} }
else else
{ {
} }
} }
else if (strncmp(header.mName, "// ", 3) == 0) else if (strncmp(header.mName, "// ", 3) == 0)
@ -115,7 +113,7 @@ bool BeLibFile::ReadLib()
fileName.Append(&libStrTable[tabIdx], checkIdx - tabIdx); fileName.Append(&libStrTable[tabIdx], checkIdx - tabIdx);
break; break;
} }
} }
} }
else else
{ {
@ -125,9 +123,9 @@ bool BeLibFile::ReadLib()
fileName.Append(&header.mName[0], i); fileName.Append(&header.mName[0], i);
} }
} }
BeLibEntry* libEntry = NULL; BeLibEntry* libEntry = NULL;
if (!pendingLibEntryMap.TryGetValue(headerFilePos, &libEntry)) if (!pendingLibEntryMap.TryGetValue(headerFilePos, &libEntry))
{ {
libEntry = new BeLibEntry(); libEntry = new BeLibEntry();
@ -171,11 +169,11 @@ bool BeLibFile::ReadLib()
} }
bool BeLibFile::Init(const StringImpl& filePath, bool moveFile) bool BeLibFile::Init(const StringImpl& filePath, bool moveFile)
{ {
bool isInitialized = false; bool isInitialized = false;
if (FileExists(filePath)) if (FileExists(filePath))
{ {
String altName; String altName;
if (moveFile) if (moveFile)
{ {
@ -196,14 +194,14 @@ bool BeLibFile::Init(const StringImpl& filePath, bool moveFile)
if (!mOldFileStream.Open(altName, "rb")) if (!mOldFileStream.Open(altName, "rb"))
return false; return false;
if (!ReadLib()) if (!ReadLib())
return false; return false;
} }
String newLibName = filePath; String newLibName = filePath;
mFilePath = newLibName; mFilePath = newLibName;
return true; return true;
} }
@ -212,9 +210,9 @@ bool BeLibFile::Finish()
BP_ZONE("BeLibFile::Finish"); BP_ZONE("BeLibFile::Finish");
//mOldEntries.clear(); //mOldEntries.clear();
Dictionary<String, BeLibEntry*>* libEntryMaps[2] = { &mEntries, &mOldEntries }; Dictionary<String, BeLibEntry*>* libEntryMaps[2] = { &mEntries, &mOldEntries };
Array<BeLibEntry*> libEntries; Array<BeLibEntry*> libEntries;
bool isAllReferenced = true; bool isAllReferenced = true;
@ -241,7 +239,7 @@ bool BeLibFile::Finish()
} }
if (!mFileStream.Open(mFilePath, "wb")) if (!mFileStream.Open(mFilePath, "wb"))
{ {
mFailed = true; mFailed = true;
return false; return false;
} }
@ -255,7 +253,7 @@ bool BeLibFile::Finish()
mFileStream.Write("!<arch>\n", 8); mFileStream.Write("!<arch>\n", 8);
std::sort(libEntries.begin(), libEntries.end(), std::sort(libEntries.begin(), libEntries.end(),
[&](BeLibEntry* lhs, BeLibEntry* rhs) [&](BeLibEntry* lhs, BeLibEntry* rhs)
{ {
return lhs->mName < rhs->mName; return lhs->mName < rhs->mName;
@ -263,12 +261,12 @@ bool BeLibFile::Finish()
int longNamesSize = 0; int longNamesSize = 0;
int tabSize = 4; // num symbols int tabSize = 4; // num symbols
int numSymbols = 0; int numSymbols = 0;
for (auto libEntry : libEntries) for (auto libEntry : libEntries)
{ {
if (libEntry->mName.length() > 15) if (libEntry->mName.length() > 15)
{ {
longNamesSize += (int)libEntry->mName.length() + 2; longNamesSize += (int)libEntry->mName.length() + 2;
} }
@ -277,28 +275,27 @@ bool BeLibFile::Finish()
numSymbols++; numSymbols++;
tabSize += 4; // Offset tabSize += 4; // Offset
tabSize += (int)sym.length() + 1; // String table tabSize += (int)sym.length() + 1; // String table
} }
} }
// Determine where all these entries will be placed // Determine where all these entries will be placed
int predictPos = mFileStream.GetPos() + sizeof(BeLibMemberHeader) + BF_ALIGN(tabSize, 2); int predictPos = mFileStream.GetPos() + sizeof(BeLibMemberHeader) + BF_ALIGN(tabSize, 2);
if (longNamesSize > 0) if (longNamesSize > 0)
predictPos += sizeof(BeLibMemberHeader) + BF_ALIGN(longNamesSize, 2); predictPos += sizeof(BeLibMemberHeader) + BF_ALIGN(longNamesSize, 2);
for (auto libEntry : libEntries) for (auto libEntry : libEntries)
{ {
libEntry->mNewDataPos = predictPos; libEntry->mNewDataPos = predictPos;
predictPos += sizeof(BeLibMemberHeader); predictPos += sizeof(BeLibMemberHeader);
predictPos += BF_ALIGN(libEntry->mLength, 2); predictPos += BF_ALIGN(libEntry->mLength, 2);
} }
int tabStartPos = mFileStream.GetPos(); int tabStartPos = mFileStream.GetPos();
BeLibMemberHeader header; BeLibMemberHeader header;
header.Init("/", "0", tabSize); header.Init("/", "0", tabSize);
mFileStream.WriteT(header); mFileStream.WriteT(header);
mFileStream.Write(ToBigEndian((int32)numSymbols)); mFileStream.Write(ToBigEndian((int32)numSymbols));
@ -308,7 +305,7 @@ bool BeLibFile::Finish()
for (auto& sym : libEntry->mSymbols) for (auto& sym : libEntry->mSymbols)
{ {
mFileStream.Write((int32)ToBigEndian(libEntry->mNewDataPos)); mFileStream.Write((int32)ToBigEndian(libEntry->mNewDataPos));
} }
} }
// String map table // String map table
@ -317,11 +314,11 @@ bool BeLibFile::Finish()
for (auto& sym : libEntry->mSymbols) for (auto& sym : libEntry->mSymbols)
{ {
mFileStream.Write((uint8*)sym.c_str(), (int)sym.length() + 1); mFileStream.Write((uint8*)sym.c_str(), (int)sym.length() + 1);
} }
} }
int actualTabSize = mFileStream.GetPos() - tabStartPos - sizeof(BeLibMemberHeader); int actualTabSize = mFileStream.GetPos() - tabStartPos - sizeof(BeLibMemberHeader);
//return true; //return true;
if ((tabSize % 2) != 0) if ((tabSize % 2) != 0)
@ -332,16 +329,16 @@ bool BeLibFile::Finish()
// Create long names table // Create long names table
if (longNamesSize > 0) if (longNamesSize > 0)
{ {
header.Init("//", "0", longNamesSize); header.Init("//", "0", longNamesSize);
mFileStream.WriteT(header); mFileStream.WriteT(header);
for (auto libEntry : libEntries) for (auto libEntry : libEntries)
{ {
if (libEntry->mName.length() > 15) if (libEntry->mName.length() > 15)
{ {
mFileStream.Write((uint8*)libEntry->mName.c_str(), (int)libEntry->mName.length()); mFileStream.Write((uint8*)libEntry->mName.c_str(), (int)libEntry->mName.length());
mFileStream.Write("/\n", 2); mFileStream.Write("/\n", 2);
} }
} }
if ((longNamesSize % 2) != 0) if ((longNamesSize % 2) != 0)
@ -357,9 +354,9 @@ bool BeLibFile::Finish()
String entryName; String entryName;
if (libEntry->mName.length() > 15) if (libEntry->mName.length() > 15)
{ {
char idxStr[32]; char idxStr[32];
_itoa(longNamesPos, idxStr, 10); _itoa(longNamesPos, idxStr, 10);
entryName = "/"; entryName = "/";
entryName += idxStr; entryName += idxStr;
longNamesPos += (int)libEntry->mName.length() + 2; longNamesPos += (int)libEntry->mName.length() + 2;
@ -370,7 +367,7 @@ bool BeLibFile::Finish()
entryName += "/"; entryName += "/";
} }
header.Init(entryName.c_str(), "644", libEntry->mLength); header.Init(entryName.c_str(), "644", libEntry->mLength);
mFileStream.WriteT(header); mFileStream.WriteT(header);
if (libEntry->mOldDataPos != -1) if (libEntry->mOldDataPos != -1)
@ -383,11 +380,11 @@ bool BeLibFile::Finish()
} }
else if (libEntry->mData.size() != 0) else if (libEntry->mData.size() != 0)
{ {
mFileStream.Write((uint8*)&libEntry->mData[0], (int)libEntry->mData.size()); mFileStream.Write((uint8*)&libEntry->mData[0], (int)libEntry->mData.size());
} }
if ((libEntry->mLength % 2) != 0) if ((libEntry->mLength % 2) != 0)
mFileStream.Write((uint8)0); mFileStream.Write((uint8)0);
} }
mFileStream.Close(); mFileStream.Close();
@ -448,7 +445,7 @@ BeLibEntry* BeLibManager::AddFile(const StringImpl& filePath, void* data, int si
libFile = *libFilePtr; libFile = *libFilePtr;
} }
else else
{ {
libFile = new BeLibFile(); libFile = new BeLibFile();
*libFilePtr = libFile; *libFilePtr = libFile;
@ -485,7 +482,7 @@ BeLibEntry* BeLibManager::AddFile(const StringImpl& filePath, void* data, int si
// It's possible that we rebuild a type (generic, probably), decide we don't have any refs so we delete the type, // It's possible that we rebuild a type (generic, probably), decide we don't have any refs so we delete the type,
// but then we specialize methods and then have to recreate it. Thus two entries here. // but then we specialize methods and then have to recreate it. Thus two entries here.
delete *libEntryPtr; delete *libEntryPtr;
} }
libEntry = new BeLibEntry(); libEntry = new BeLibEntry();
libEntry->mLibFile = libFile; libEntry->mLibFile = libFile;
*libEntryPtr = libEntry; *libEntryPtr = libEntry;
@ -494,7 +491,7 @@ BeLibEntry* BeLibManager::AddFile(const StringImpl& filePath, void* data, int si
libEntry->mName = fileName; libEntry->mName = fileName;
libEntry->mData.Insert(0, (uint8*)data, size); libEntry->mData.Insert(0, (uint8*)data, size);
libEntry->mLength = size; libEntry->mLength = size;
return libEntry; return libEntry;
} }
@ -533,5 +530,4 @@ String BeLibManager::GetLibFilePath(const StringImpl& objFilePath)
BeLibManager* BeLibManager::Get() BeLibManager* BeLibManager::Get()
{ {
return &gBfLibManager; return &gBfLibManager;
} }

View file

@ -39,7 +39,7 @@ struct BeLibMemberHeader
memcpy(mDate, "0", 1); memcpy(mDate, "0", 1);
memcpy(mMode, mode, strlen(mode)); memcpy(mMode, mode, strlen(mode));
char sizeStr[32]; char sizeStr[32];
sprintf(sizeStr, "%d", size); sprintf(sizeStr, "%d", size);
memcpy(mSize, sizeStr, strlen(sizeStr)); memcpy(mSize, sizeStr, strlen(sizeStr));
} }
@ -60,7 +60,7 @@ public:
Array<uint8> mData; Array<uint8> mData;
BeLibEntry* mNextWithSameName; BeLibEntry* mNextWithSameName;
public: public:
BeLibEntry() BeLibEntry()
{ {
mReferenced = false; mReferenced = false;
@ -84,7 +84,7 @@ public:
String mFilePath; String mFilePath;
String mOldFilePath; String mOldFilePath;
FileStream mOldFileStream; FileStream mOldFileStream;
FileStream mFileStream; FileStream mFileStream;
Dictionary<String, BeLibEntry*> mOldEntries; Dictionary<String, BeLibEntry*> mOldEntries;
Dictionary<String, BeLibEntry*> mEntries; Dictionary<String, BeLibEntry*> mEntries;
bool mFailed; bool mFailed;
@ -107,7 +107,7 @@ public:
Dictionary<String, BeLibFile*> mLibFiles; Dictionary<String, BeLibFile*> mLibFiles;
Array<String> mErrors; Array<String> mErrors;
public: public:
BeLibManager(); BeLibManager();
~BeLibManager(); ~BeLibManager();
@ -118,8 +118,7 @@ public:
void Finish(); void Finish();
static String GetLibFilePath(const StringImpl& objFilePath); static String GetLibFilePath(const StringImpl& objFilePath);
static BeLibManager* Get(); static BeLibManager* Get();
}; };
NS_BF_END NS_BF_END

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,6 @@ NS_BF_BEGIN
class BeMCAddInst class BeMCAddInst
{ {
public: public:
}; };
struct BeVTrackingBits struct BeVTrackingBits
@ -109,9 +108,7 @@ public:
DiffIterator& operator++() DiffIterator& operator++()
{ {
} }
};*/ };*/
Iterator begin() Iterator begin()
@ -198,7 +195,7 @@ enum BeMCOperandKind
BeMCOperandKind_Immediate_f64, BeMCOperandKind_Immediate_f64,
BeMCOperandKind_Immediate_f32_Packed128, BeMCOperandKind_Immediate_f32_Packed128,
BeMCOperandKind_Immediate_f64_Packed128, BeMCOperandKind_Immediate_f64_Packed128,
BeMCOperandKind_Immediate_int32x4, BeMCOperandKind_Immediate_int32x4,
BeMCOperandKind_ConstAgg, BeMCOperandKind_ConstAgg,
BeMCOperandKind_Block, BeMCOperandKind_Block,
BeMCOperandKind_Label, BeMCOperandKind_Label,
@ -769,14 +766,14 @@ class BeMCVRegInfo
{ {
public: public:
X64CPURegister mReg; X64CPURegister mReg;
X64CPURegister mNaturalReg; // From param X64CPURegister mNaturalReg; // From param
BeType* mType; BeType* mType;
int mAlign; int mAlign;
int mFrameOffset; // 0 = 'RBP' (probably first local var or saved RBP), 8 means retAddr int mFrameOffset; // 0 = 'RBP' (probably first local var or saved RBP), 8 means retAddr
bool mRegNumPinned; bool mRegNumPinned;
bool mHasDynLife; bool mHasDynLife;
bool mDoConservativeLife; // Keep alive through 'init' as well as 'uninit' bool mDoConservativeLife; // Keep alive through 'init' as well as 'uninit'
bool mIsExpr; // Not an actual value, something like 'mRelTo + mRelOffset' bool mIsExpr; // Not an actual value, something like 'mRelTo + mRelOffset'
bool mWantsExprActualize; bool mWantsExprActualize;
bool mWantsExprOffsetActualize; bool mWantsExprOffsetActualize;
bool mChainLifetimeEnd; // Kill relTo's when we are killed bool mChainLifetimeEnd; // Kill relTo's when we are killed
@ -794,7 +791,7 @@ public:
bool mDisableR13; // Special case when this vreg is used in an ModRM scale, which isn't allowed bool mDisableR13; // Special case when this vreg is used in an ModRM scale, which isn't allowed
bool mDisableRAX; // Special case when RAX must be preserved (ie: For IDIV) bool mDisableRAX; // Special case when RAX must be preserved (ie: For IDIV)
bool mDisableRDX; // Special case when RDX must be preserved (ie: For IDIV) bool mDisableRDX; // Special case when RDX must be preserved (ie: For IDIV)
bool mDisableEx; // Disable any registers that require a REX bool mDisableEx; // Disable any registers that require a REX
int mVRegAffinity; // Try to match the mReg of this vreg int mVRegAffinity; // Try to match the mReg of this vreg
BeMCOperand mRelTo; BeMCOperand mRelTo;
int mRelOffsetScale; int mRelOffsetScale;
@ -804,7 +801,7 @@ public:
bool mFoundLastUse; bool mFoundLastUse;
bool mMustExist; // Regs we must be able to debug bool mMustExist; // Regs we must be able to debug
// Must be refreshed with RefreshRefCounts // Must be refreshed with RefreshRefCounts
int mRefCount; int mRefCount;
int mAssignCount; int mAssignCount;
@ -961,7 +958,6 @@ enum BeTrackKind
BeTrackKind_COUNT = 2 BeTrackKind_COUNT = 2
}; };
// BeVTrackingEntry is immutable -- the Set/Clear/Merge methods allocate new entries if // BeVTrackingEntry is immutable -- the Set/Clear/Merge methods allocate new entries if
// the requested change produces a new liveness set // the requested change produces a new liveness set
class BeVTrackingContext class BeVTrackingContext
@ -1476,7 +1472,7 @@ public:
void EmitStdInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode_rm_r, uint8 opcode_r_rm, uint8 opcode_rm_imm, uint8 opcode_rm_imm_rx, uint8 opcode_rm_imm8, uint8 opcode_rm_imm8_rx); void EmitStdInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode_rm_r, uint8 opcode_r_rm, uint8 opcode_rm_imm, uint8 opcode_rm_imm_rx, uint8 opcode_rm_imm8, uint8 opcode_rm_imm8_rx);
bool EmitStdXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode); bool EmitStdXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode);
bool EmitStdXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode, uint8 opcode_dest_frm); bool EmitStdXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode, uint8 opcode_dest_frm);
bool EmitPackedXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode); bool EmitPackedXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode);
bool EmitIntXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode); bool EmitIntXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode);
bool EmitIntBitwiseXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode); bool EmitIntBitwiseXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 opcode);
void EmitAggMov(const BeMCOperand& dest, const BeMCOperand& src); void EmitAggMov(const BeMCOperand& dest, const BeMCOperand& src);

File diff suppressed because it is too large Load diff

View file

@ -68,7 +68,7 @@ public:
virtual void Visit(BeValue* beValue) {} virtual void Visit(BeValue* beValue) {}
virtual void Visit(BeBlock* beBlock) {} virtual void Visit(BeBlock* beBlock) {}
virtual void Visit(BeArgument* beArgument) {} virtual void Visit(BeArgument* beArgument) {}
virtual void Visit(BeInst* beInst) {} virtual void Visit(BeInst* beInst) {}
virtual void Visit(BeNopInst* nopInst) {} virtual void Visit(BeNopInst* nopInst) {}
virtual void Visit(BeUnreachableInst* unreachableInst) {} virtual void Visit(BeUnreachableInst* unreachableInst) {}
@ -76,10 +76,10 @@ public:
virtual void Visit(BeUndefValueInst* undefValue) {} virtual void Visit(BeUndefValueInst* undefValue) {}
virtual void Visit(BeExtractValueInst* extractValue) {} virtual void Visit(BeExtractValueInst* extractValue) {}
virtual void Visit(BeInsertValueInst* insertValue) {} virtual void Visit(BeInsertValueInst* insertValue) {}
virtual void Visit(BeNumericCastInst* castInst) {} virtual void Visit(BeNumericCastInst* castInst) {}
virtual void Visit(BeBitCastInst* castInst) {} virtual void Visit(BeBitCastInst* castInst) {}
virtual void Visit(BeNegInst* negInst) {} virtual void Visit(BeNegInst* negInst) {}
virtual void Visit(BeNotInst* notInst) {} virtual void Visit(BeNotInst* notInst) {}
virtual void Visit(BeBinaryOpInst* binaryOpInst) {} virtual void Visit(BeBinaryOpInst* binaryOpInst) {}
virtual void Visit(BeFenceInst* fenceInst) {} virtual void Visit(BeFenceInst* fenceInst) {}
virtual void Visit(BeStackSaveInst* stackSaveInst) {} virtual void Visit(BeStackSaveInst* stackSaveInst) {}
@ -108,8 +108,8 @@ public:
virtual void Visit(BeSwitchInst* switchInst) {} virtual void Visit(BeSwitchInst* switchInst) {}
virtual void Visit(BeRetInst* retInst) {} virtual void Visit(BeRetInst* retInst) {}
virtual void Visit(BeCallInst* callInst) {} virtual void Visit(BeCallInst* callInst) {}
//virtual void Visit(BeDbgVariable* dbgVariable) {} //virtual void Visit(BeDbgVariable* dbgVariable) {}
virtual void Visit(BeDbgDeclareInst* dbgDeclareInst) {} virtual void Visit(BeDbgDeclareInst* dbgDeclareInst) {}
}; };
@ -122,15 +122,15 @@ class BeInliner : public BeValueVisitor
public: public:
BumpAllocator* mAlloc; BumpAllocator* mAlloc;
OwnedVector<BeValue>* mOwnedValueVec; OwnedVector<BeValue>* mOwnedValueVec;
Dictionary<BeValue*, BeValue*> mValueMap; Dictionary<BeValue*, BeValue*> mValueMap;
Dictionary<BeDbgLoc*, BeDbgLoc*> mInlinedAtMap; Dictionary<BeDbgLoc*, BeDbgLoc*> mInlinedAtMap;
BeModule* mModule; BeModule* mModule;
BeFunction* mSrcFunc; BeFunction* mSrcFunc;
BeFunction* mDestFunc; BeFunction* mDestFunc;
BeCallInst* mCallInst; BeCallInst* mCallInst;
BeBlock* mDestBlock; BeBlock* mDestBlock;
BeDbgLoc* mSrcDbgLoc; BeDbgLoc* mSrcDbgLoc;
BeDbgLoc* mDestDbgLoc; BeDbgLoc* mDestDbgLoc;
public: public:
@ -158,7 +158,7 @@ public:
auto inst = mOwnedValueVec->Alloc<T>(); auto inst = mOwnedValueVec->Alloc<T>();
AddInst(inst, srcInst); AddInst(inst, srcInst);
return inst; return inst;
} }
virtual void Visit(BeValue* beValue) override; virtual void Visit(BeValue* beValue) override;
virtual void Visit(BeBlock* beBlock) override; virtual void Visit(BeBlock* beBlock) override;
@ -202,7 +202,7 @@ public:
virtual void Visit(BeSwitchInst* switchInst) override; virtual void Visit(BeSwitchInst* switchInst) override;
virtual void Visit(BeRetInst* retInst) override; virtual void Visit(BeRetInst* retInst) override;
virtual void Visit(BeCallInst* callInst) override; virtual void Visit(BeCallInst* callInst) override;
virtual void Visit(BeDbgDeclareInst* dbgDeclareInst) override; virtual void Visit(BeDbgDeclareInst* dbgDeclareInst) override;
}; };
@ -212,7 +212,7 @@ public:
int mRefCount; int mRefCount;
#ifdef _DEBUG #ifdef _DEBUG
bool mLifetimeEnded; bool mLifetimeEnded;
bool mWasRemoved; bool mWasRemoved;
BeValue() BeValue()
{ {
mLifetimeEnded = false; mLifetimeEnded = false;
@ -228,12 +228,11 @@ public:
virtual ~BeValue() virtual ~BeValue()
{ {
} }
static const int TypeId = 0; static const int TypeId = 0;
virtual void Accept(BeValueVisitor* beVisitor) = 0; virtual void Accept(BeValueVisitor* beVisitor) = 0;
virtual bool TypeIdIsA(int typeId) = 0; virtual bool TypeIdIsA(int typeId) = 0;
virtual BeValue* DynCast(int typeId) virtual BeValue* DynCast(int typeId)
{ {
if (TypeIdIsA(typeId)) if (TypeIdIsA(typeId))
@ -246,7 +245,6 @@ public:
} }
virtual int GetTypeId() { return TypeId; } virtual int GetTypeId() { return TypeId; }
public: public:
virtual BeType* GetType() virtual BeType* GetType()
{ {
@ -255,7 +253,6 @@ public:
virtual void SetName(const StringImpl& name) virtual void SetName(const StringImpl& name)
{ {
} }
}; };
@ -310,8 +307,8 @@ class BeConstant : public BeValue
{ {
public: public:
BE_VALUE_TYPE(BeConstant, BeValue); BE_VALUE_TYPE(BeConstant, BeValue);
BeType* mType; BeType* mType;
union union
{ {
bool mBool; bool mBool;
@ -325,7 +322,7 @@ public:
uint8 mUInt8; uint8 mUInt8;
uint8 mChar; uint8 mChar;
uint32 mChar32; uint32 mChar32;
double mDouble; double mDouble;
//BeType* mTypeParam; //BeType* mTypeParam;
//BeGlobalVariable* mGlobalVar; //BeGlobalVariable* mGlobalVar;
BeConstant* mTarget; BeConstant* mTarget;
@ -338,7 +335,7 @@ public:
return false; return false;
} }
virtual BeType* GetType(); virtual BeType* GetType();
virtual void GetData(BeConstData& data); virtual void GetData(BeConstData& data);
virtual void HashContent(BeHashContext& hashCtx) override; virtual void HashContent(BeHashContext& hashCtx) override;
}; };
@ -365,7 +362,7 @@ class BeGEP1Constant : public BeConstant
{ {
public: public:
BE_VALUE_TYPE(BeGEP1Constant, BeConstant); BE_VALUE_TYPE(BeGEP1Constant, BeConstant);
int mIdx0; int mIdx0;
virtual BeType* GetType(); virtual BeType* GetType();
@ -373,14 +370,14 @@ public:
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
mTarget->HashReference(hashCtx); mTarget->HashReference(hashCtx);
hashCtx.Mixin(mIdx0); hashCtx.Mixin(mIdx0);
} }
}; };
class BeGEP2Constant : public BeConstant class BeGEP2Constant : public BeConstant
{ {
public: public:
BE_VALUE_TYPE(BeGEP2Constant, BeConstant); BE_VALUE_TYPE(BeGEP2Constant, BeConstant);
int mIdx0; int mIdx0;
int mIdx1; int mIdx1;
@ -388,7 +385,7 @@ public:
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
mTarget->HashReference(hashCtx); mTarget->HashReference(hashCtx);
hashCtx.Mixin(mIdx0); hashCtx.Mixin(mIdx0);
hashCtx.Mixin(mIdx1); hashCtx.Mixin(mIdx1);
@ -399,7 +396,7 @@ class BeExtractValueConstant : public BeConstant
{ {
public: public:
BE_VALUE_TYPE(BeExtractValueConstant, BeConstant); BE_VALUE_TYPE(BeExtractValueConstant, BeConstant);
int mIdx0; int mIdx0;
virtual BeType* GetType(); virtual BeType* GetType();
@ -407,14 +404,14 @@ public:
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
mTarget->HashReference(hashCtx); mTarget->HashReference(hashCtx);
hashCtx.Mixin(mIdx0); hashCtx.Mixin(mIdx0);
} }
}; };
class BeStructConstant : public BeConstant class BeStructConstant : public BeConstant
{ {
public: public:
BE_VALUE_TYPE(BeStructConstant, BeConstant); BE_VALUE_TYPE(BeStructConstant, BeConstant);
SizedArray<BeConstant*, 4> mMemberValues; SizedArray<BeConstant*, 4> mMemberValues;
@ -434,25 +431,25 @@ class BeUndefConstant : public BeConstant
{ {
public: public:
BE_VALUE_TYPE(BeUndefConstant, BeConstant); BE_VALUE_TYPE(BeUndefConstant, BeConstant);
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(mType); hashCtx.Mixin(mType);
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
} }
}; };
class BeStringConstant : public BeConstant class BeStringConstant : public BeConstant
{ {
public: public:
BE_VALUE_TYPE(BeStringConstant, BeConstant); BE_VALUE_TYPE(BeStringConstant, BeConstant);
String mString; String mString;
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
hashCtx.MixinStr(mString); hashCtx.MixinStr(mString);
} }
}; };
@ -471,8 +468,8 @@ public:
int mAlign; int mAlign;
bool mUnnamedAddr; bool mUnnamedAddr;
virtual BeType* GetType(); virtual BeType* GetType();
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
@ -485,12 +482,12 @@ public:
hashCtx.Mixin(mIsTLS); hashCtx.Mixin(mIsTLS);
hashCtx.Mixin(mAlign); hashCtx.Mixin(mAlign);
hashCtx.Mixin(mUnnamedAddr); hashCtx.Mixin(mUnnamedAddr);
} }
virtual void GetData(BeConstData& data) override virtual void GetData(BeConstData& data) override
{ {
data.mConsts.Add({ (int)data.mData.size(), this }); data.mConsts.Add({ (int)data.mData.size(), this });
data.mData.Insert(data.mData.size(), (uint8)0, 8); data.mData.Insert(data.mData.size(), (uint8)0, 8);
} }
}; };
@ -522,13 +519,13 @@ class BeIntrinsic : public BeValue
{ {
public: public:
BE_VALUE_TYPE(BeIntrinsic, BeValue); BE_VALUE_TYPE(BeIntrinsic, BeValue);
String mName; String mName;
BfIRIntrinsic mKind; BfIRIntrinsic mKind;
BeType* mReturnType; BeType* mReturnType;
BeIntrinsic() BeIntrinsic()
{ {
mReturnType = NULL; mReturnType = NULL;
} }
@ -536,7 +533,7 @@ public:
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
hashCtx.Mixin(mKind); hashCtx.Mixin(mKind);
} }
}; };
class BeFunction : public BeConstant class BeFunction : public BeConstant
@ -544,15 +541,15 @@ class BeFunction : public BeConstant
public: public:
BE_VALUE_TYPE(BeFunction, BeConstant); BE_VALUE_TYPE(BeFunction, BeConstant);
BeModule* mModule; BeModule* mModule;
#ifdef _DEBUG #ifdef _DEBUG
StringT<256> mName; StringT<256> mName;
#else #else
String mName; String mName;
#endif #endif
BfIRLinkageType mLinkageType; BfIRLinkageType mLinkageType;
bool mIsVarReturn; bool mIsVarReturn;
bool mAlwaysInline; bool mAlwaysInline;
bool mNoUnwind; bool mNoUnwind;
bool mUWTable; bool mUWTable;
bool mNoReturn; bool mNoReturn;
@ -561,10 +558,10 @@ public:
bool mIsDLLExport; bool mIsDLLExport;
bool mIsDLLImport; bool mIsDLLImport;
BfIRCallingConv mCallingConv; BfIRCallingConv mCallingConv;
Array<BeBlock*> mBlocks; Array<BeBlock*> mBlocks;
Array<BeFunctionParam> mParams; Array<BeFunctionParam> mParams;
BeDbgFunction* mDbgFunction; BeDbgFunction* mDbgFunction;
BeGlobalVariable* mRemapBindVar; BeGlobalVariable* mRemapBindVar;
public: public:
BeFunction() BeFunction()
@ -575,15 +572,15 @@ public:
mDbgFunction = NULL; mDbgFunction = NULL;
mIsVarReturn = false; mIsVarReturn = false;
mAlwaysInline = false; mAlwaysInline = false;
mDidInlinePass = false; mDidInlinePass = false;
mNoUnwind = false; mNoUnwind = false;
mUWTable = false; mUWTable = false;
mNoReturn = false; mNoReturn = false;
mNoFramePointerElim = false; mNoFramePointerElim = false;
mIsDLLExport = false; mIsDLLExport = false;
mIsDLLImport = false; mIsDLLImport = false;
mRemapBindVar = NULL; mRemapBindVar = NULL;
} }
BeFunctionType* GetFuncType() BeFunctionType* GetFuncType()
{ {
@ -600,7 +597,7 @@ public:
{ {
return (!mParams.IsEmpty()) && (mParams[0].mStructRet); return (!mParams.IsEmpty()) && (mParams[0].mStructRet);
} }
virtual void HashContent(BeHashContext& hashCtx) override; virtual void HashContent(BeHashContext& hashCtx) override;
}; };
@ -614,12 +611,11 @@ public:
BeFunction* mFunction; BeFunction* mFunction;
public: public:
bool IsEmpty(); bool IsEmpty();
virtual void HashContent(BeHashContext& hashCtx) override; virtual void HashContent(BeHashContext& hashCtx) override;
}; };
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
class BeInst : public BeValue class BeInst : public BeValue
@ -630,8 +626,8 @@ public:
BeBlock* mParentBlock; BeBlock* mParentBlock;
const char* mName; const char* mName;
BeDbgLoc* mDbgLoc; BeDbgLoc* mDbgLoc;
public: public:
BeContext* GetContext(); BeContext* GetContext();
BeModule* GetModule(); BeModule* GetModule();
@ -640,7 +636,7 @@ public:
return GetType() != NULL; return GetType() != NULL;
} }
virtual void SetName(const StringImpl& name) override; virtual void SetName(const StringImpl& name) override;
BeInst() BeInst()
{ {
@ -650,7 +646,7 @@ public:
} }
virtual void HashInst(BeHashContext& hashCtx) = 0; virtual void HashInst(BeHashContext& hashCtx) = 0;
virtual void HashContent(BeHashContext& hashCtx) override; virtual void HashContent(BeHashContext& hashCtx) override;
}; };
class BeNopInst : public BeInst class BeNopInst : public BeInst
@ -707,7 +703,7 @@ class BeExtractValueInst : public BeInst
public: public:
BE_VALUE_TYPE(BeExtractValueInst, BeInst); BE_VALUE_TYPE(BeExtractValueInst, BeInst);
BeValue* mAggVal; BeValue* mAggVal;
int mIdx; int mIdx;
virtual BeType* GetType() override; virtual BeType* GetType() override;
@ -769,7 +765,7 @@ public:
BeValue* mValue; BeValue* mValue;
BeType* mToType; BeType* mToType;
virtual BeType* GetType() override; virtual BeType* GetType() override;
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
@ -777,7 +773,7 @@ public:
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
mValue->HashReference(hashCtx); mValue->HashReference(hashCtx);
mToType->HashReference(hashCtx); mToType->HashReference(hashCtx);
} }
}; };
class BeNegInst : public BeInst class BeNegInst : public BeInst
@ -785,7 +781,7 @@ class BeNegInst : public BeInst
public: public:
BE_VALUE_TYPE(BeNegInst, BeInst); BE_VALUE_TYPE(BeNegInst, BeInst);
BeValue* mValue; BeValue* mValue;
virtual BeType* GetType() override; virtual BeType* GetType() override;
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
@ -823,15 +819,15 @@ enum BeBinaryOpKind
BeBinaryOpKind_BitwiseAnd, BeBinaryOpKind_BitwiseAnd,
BeBinaryOpKind_BitwiseOr, BeBinaryOpKind_BitwiseOr,
BeBinaryOpKind_ExclusiveOr, BeBinaryOpKind_ExclusiveOr,
BeBinaryOpKind_LeftShift, BeBinaryOpKind_LeftShift,
BeBinaryOpKind_RightShift, BeBinaryOpKind_RightShift,
BeBinaryOpKind_ARightShift, BeBinaryOpKind_ARightShift,
BeBinaryOpKind_Equality, BeBinaryOpKind_Equality,
BeBinaryOpKind_InEquality, BeBinaryOpKind_InEquality,
BeBinaryOpKind_GreaterThan, BeBinaryOpKind_GreaterThan,
BeBinaryOpKind_LessThan, BeBinaryOpKind_LessThan,
BeBinaryOpKind_GreaterThanOrEqual, BeBinaryOpKind_GreaterThanOrEqual,
BeBinaryOpKind_LessThanOrEqual, BeBinaryOpKind_LessThanOrEqual,
}; };
class BeBinaryOpInst : public BeInst class BeBinaryOpInst : public BeInst
@ -844,7 +840,7 @@ public:
BeValue* mLHS; BeValue* mLHS;
BeValue* mRHS; BeValue* mRHS;
virtual BeType* GetType() override; virtual BeType* GetType() override;
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
@ -920,7 +916,7 @@ public:
bool mForceMem; bool mForceMem;
public: public:
virtual BeType* GetType() override; virtual BeType* GetType() override;
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
@ -1034,7 +1030,7 @@ public:
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
} }
}; };
@ -1043,7 +1039,7 @@ class BeValueScopeRetainInst : public BeInst
public: public:
BE_VALUE_TYPE(BeValueScopeRetainInst, BeInst); BE_VALUE_TYPE(BeValueScopeRetainInst, BeInst);
BeValue* mValue; BeValue* mValue;
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
@ -1054,7 +1050,7 @@ public:
class BeValueScopeEndInst : public BeInst class BeValueScopeEndInst : public BeInst
{ {
public: public:
BE_VALUE_TYPE(BeValueScopeEndInst, BeInst); BE_VALUE_TYPE(BeValueScopeEndInst, BeInst);
BeValueScopeStartInst* mScopeStart; BeValueScopeStartInst* mScopeStart;
@ -1077,7 +1073,7 @@ public:
bool mIsVolatile; bool mIsVolatile;
public: public:
virtual BeType* GetType() override; virtual BeType* GetType() override;
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
@ -1144,7 +1140,7 @@ public:
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
} }
}; };
@ -1155,7 +1151,7 @@ public:
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
} }
virtual BeType* GetType() override virtual BeType* GetType() override
@ -1278,7 +1274,7 @@ class BeSwitchCase
{ {
public: public:
BeConstant* mValue; BeConstant* mValue;
BeBlock* mBlock; BeBlock* mBlock;
}; };
class BeSwitchInst : public BeInst class BeSwitchInst : public BeInst
@ -1338,7 +1334,7 @@ public:
bool mStructRet; bool mStructRet;
bool mZExt; bool mZExt;
bool mNoAlias; bool mNoAlias;
bool mNoCapture; bool mNoCapture;
Arg() Arg()
{ {
mValue = NULL; mValue = NULL;
@ -1352,14 +1348,14 @@ public:
}; };
public: public:
BE_VALUE_TYPE(BeCallInst, BeInst); BE_VALUE_TYPE(BeCallInst, BeInst);
BeValue* mInlineResult; BeValue* mInlineResult;
BeValue* mFunc; BeValue* mFunc;
SizedArray<Arg, 4> mArgs; SizedArray<Arg, 4> mArgs;
BfIRCallingConv mCallingConv; BfIRCallingConv mCallingConv;
bool mNoReturn; bool mNoReturn;
bool mTailCall; bool mTailCall;
virtual BeType* GetType() override; virtual BeType* GetType() override;
@ -1369,7 +1365,7 @@ public:
mFunc = NULL; mFunc = NULL;
mCallingConv = BfIRCallingConv_CDecl; mCallingConv = BfIRCallingConv_CDecl;
mNoReturn = false; mNoReturn = false;
mTailCall = false; mTailCall = false;
} }
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
@ -1379,7 +1375,7 @@ public:
mInlineResult->HashReference(hashCtx); mInlineResult->HashReference(hashCtx);
mFunc->HashReference(hashCtx); mFunc->HashReference(hashCtx);
for (auto& arg : mArgs) for (auto& arg : mArgs)
{ {
arg.mValue->HashReference(hashCtx); arg.mValue->HashReference(hashCtx);
hashCtx.Mixin(arg.mStructRet); hashCtx.Mixin(arg.mStructRet);
hashCtx.Mixin(arg.mZExt); hashCtx.Mixin(arg.mZExt);
@ -1388,7 +1384,7 @@ public:
} }
hashCtx.Mixin(mCallingConv); hashCtx.Mixin(mCallingConv);
hashCtx.Mixin(mNoReturn); hashCtx.Mixin(mNoReturn);
hashCtx.Mixin(mTailCall); hashCtx.Mixin(mTailCall);
} }
bool HasStructRet() bool HasStructRet()
@ -1405,9 +1401,9 @@ public:
BE_VALUE_TYPE(BeComptimeError, BeInst); BE_VALUE_TYPE(BeComptimeError, BeInst);
public: public:
int mError; int mError;
public: public:
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
@ -1424,7 +1420,7 @@ public:
int mTypeId; int mTypeId;
BeType* mResultType; BeType* mResultType;
public: public:
virtual BeType* GetType() override virtual BeType* GetType() override
{ {
return mResultType; return mResultType;
@ -1476,7 +1472,7 @@ public:
} }
virtual void HashInst(BeHashContext& hashCtx) override virtual void HashInst(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
mValue->HashReference(hashCtx); mValue->HashReference(hashCtx);
hashCtx.Mixin(mTypeId); hashCtx.Mixin(mTypeId);
@ -1554,7 +1550,7 @@ public:
struct BeDumpContext struct BeDumpContext
{ {
public: public:
Dictionary<BeValue*, String> mValueNameMap; Dictionary<BeValue*, String> mValueNameMap;
Dictionary<String, int> mSeenNames; Dictionary<String, int> mSeenNames;
@ -1588,7 +1584,6 @@ public:
bool mIsValue; bool mIsValue;
virtual void HashInst(BeHashContext& hashCtx) override; virtual void HashInst(BeHashContext& hashCtx) override;
}; };
class BeMDNode : public BeValue class BeMDNode : public BeValue
@ -1599,7 +1594,6 @@ public:
public: public:
virtual ~BeMDNode() virtual ~BeMDNode()
{ {
} }
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
@ -1620,20 +1614,20 @@ public:
int mColumn; int mColumn;
BeMDNode* mDbgScope; BeMDNode* mDbgScope;
BeDbgLoc* mDbgInlinedAt; BeDbgLoc* mDbgInlinedAt;
int mIdx; int mIdx;
bool mHadInline; bool mHadInline;
public: public:
BeDbgLoc() BeDbgLoc()
{ {
} }
int GetInlineDepth(); int GetInlineDepth();
int GetInlineMatchDepth(BeDbgLoc* other); int GetInlineMatchDepth(BeDbgLoc* other);
BeDbgLoc* GetInlinedAt(int idx = 0); BeDbgLoc* GetInlinedAt(int idx = 0);
BeDbgLoc* GetRoot(); BeDbgLoc* GetRoot();
BeDbgFunction* GetDbgFunc(); BeDbgFunction* GetDbgFunc();
BeDbgFile* GetDbgFile(); BeDbgFile* GetDbgFile();
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
@ -1645,7 +1639,7 @@ public:
else else
hashCtx.Mixin(-1); hashCtx.Mixin(-1);
if (mDbgInlinedAt != NULL) if (mDbgInlinedAt != NULL)
mDbgInlinedAt->HashReference(hashCtx); mDbgInlinedAt->HashReference(hashCtx);
} }
}; };
@ -1660,7 +1654,7 @@ public:
BeBlock* mLastBeBlock; BeBlock* mLastBeBlock;
int mId; int mId;
virtual void HashContent(BeHashContext& hashCtx) override; virtual void HashContent(BeHashContext& hashCtx) override;
}; };
class BeDbgNamespace : public BeMDNode class BeDbgNamespace : public BeMDNode
@ -1687,16 +1681,16 @@ public:
public: public:
int mTypeId; int mTypeId;
BeDbgTypeId() BeDbgTypeId()
{ {
mTypeId = -1; mTypeId = -1;
} }
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
hashCtx.Mixin(TypeId); hashCtx.Mixin(TypeId);
hashCtx.Mixin(mTypeId); hashCtx.Mixin(mTypeId);
} }
}; };
@ -1704,7 +1698,7 @@ class BeDbgType : public BeMDNode
{ {
public: public:
BE_VALUE_TYPE(BeDbgType, BeMDNode); BE_VALUE_TYPE(BeDbgType, BeMDNode);
public: public:
int mSize; int mSize;
int mAlign; int mAlign;
@ -1744,7 +1738,7 @@ public:
BE_VALUE_TYPE(BeDbgBasicType, BeDbgType); BE_VALUE_TYPE(BeDbgBasicType, BeDbgType);
public: public:
String mName; String mName;
int mEncoding; int mEncoding;
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
@ -1763,7 +1757,7 @@ public:
BE_VALUE_TYPE(BeDbgArrayType, BeDbgType); BE_VALUE_TYPE(BeDbgArrayType, BeDbgType);
public: public:
BeDbgType* mElement; BeDbgType* mElement;
int mNumElements; int mNumElements;
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
@ -1772,7 +1766,7 @@ public:
hashCtx.Mixin(mSize); hashCtx.Mixin(mSize);
hashCtx.Mixin(mAlign); hashCtx.Mixin(mAlign);
hashCtx.Mixin(mNumElements); hashCtx.Mixin(mNumElements);
mElement->HashReference(hashCtx); mElement->HashReference(hashCtx);
} }
}; };
@ -1824,10 +1818,10 @@ public:
class BeDbgPointerType : public BeDbgType class BeDbgPointerType : public BeDbgType
{ {
public: public:
BE_VALUE_TYPE(BeDbgPointerType, BeDbgType); BE_VALUE_TYPE(BeDbgPointerType, BeDbgType);
public: public:
BeDbgType* mElement; BeDbgType* mElement;
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
@ -1862,7 +1856,7 @@ public:
int mFlags; int mFlags;
int mOffset; int mOffset;
bool mIsStatic; bool mIsStatic;
BeValue* mStaticValue; BeValue* mStaticValue;
public: public:
BeDbgStructMember() BeDbgStructMember()
@ -1895,7 +1889,7 @@ public:
public: public:
BeDbgType* mReturnType; BeDbgType* mReturnType;
Array<BeDbgType*> mParams; Array<BeDbgType*> mParams;
public: public:
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
{ {
@ -1954,9 +1948,9 @@ public:
Kind_SymbolAddr Kind_SymbolAddr
}; };
Kind mKind; Kind mKind;
X64CPURegister mReg; X64CPURegister mReg;
int mOfs; int mOfs;
public: public:
BeDbgVariableLoc() BeDbgVariableLoc()
@ -1974,7 +1968,7 @@ public:
public: public:
String mName; String mName;
BeMDNode* mType; BeMDNode* mType;
BeValue* mValue; BeValue* mValue;
int mParamNum; int mParamNum;
BfIRInitType mInitType; BfIRInitType mInitType;
@ -1984,13 +1978,13 @@ public:
BeDbgLoc* mDeclDbgLoc; BeDbgLoc* mDeclDbgLoc;
BeDbgVariableLoc mPrimaryLoc; BeDbgVariableLoc mPrimaryLoc;
BeDbgVariableLoc mSavedLoc; BeDbgVariableLoc mSavedLoc;
int mDeclStart; int mDeclStart;
int mDeclEnd; int mDeclEnd;
int mDeclMCBlockId; int mDeclMCBlockId;
bool mDeclLifetimeExtend; bool mDeclLifetimeExtend;
bool mDbgLifeEnded; bool mDbgLifeEnded;
bool mIsValue; // Value vs Addr bool mIsValue; // Value vs Addr
Array<BeDbgVariableRange> mSavedRanges; Array<BeDbgVariableRange> mSavedRanges;
Array<BeDbgVariableRange> mGaps; Array<BeDbgVariableRange> mGaps;
@ -2027,7 +2021,7 @@ public:
if (mScope != NULL) if (mScope != NULL)
mScope->HashReference(hashCtx); mScope->HashReference(hashCtx);
if (mDeclDbgLoc != NULL) if (mDeclDbgLoc != NULL)
mDeclDbgLoc->HashReference(hashCtx); mDeclDbgLoc->HashReference(hashCtx);
// The others only get filled in after generation -- not part of hash // The others only get filled in after generation -- not part of hash
} }
@ -2065,8 +2059,8 @@ public:
bool mIncludedAsMember; bool mIncludedAsMember;
int mFlags; int mFlags;
int mVK; int mVK;
int mVIndex; int mVIndex;
Array<BeDbgVariable*> mVariables; Array<BeDbgVariable*> mVariables;
int mPrologSize; int mPrologSize;
int mCodeLen; int mCodeLen;
@ -2089,9 +2083,9 @@ public:
mIsLocalToUnit = false; mIsLocalToUnit = false;
mVK = -1; mVK = -1;
mVIndex = -1; mVIndex = -1;
mIsStaticMethod = true; mIsStaticMethod = true;
mIncludedAsMember = false; mIncludedAsMember = false;
mPrologSize = 0; mPrologSize = 0;
mCodeLen = -1; mCodeLen = -1;
mCvTypeId = -1; mCvTypeId = -1;
mCvFuncId = -1; mCvFuncId = -1;
@ -2128,7 +2122,7 @@ public:
return ((mVariables.size() > 0) && (mVariables[0]->mName == "this")); return ((mVariables.size() > 0) && (mVariables[0]->mName == "this"));
}*/ }*/
} }
virtual void HashContent(BeHashContext& hashCtx) override; virtual void HashContent(BeHashContext& hashCtx) override;
}; };
@ -2166,7 +2160,7 @@ public:
public: public:
BeDbgStructType() BeDbgStructType()
{ {
mScope = NULL; mScope = NULL;
mDerivedFrom = NULL; mDerivedFrom = NULL;
mIsStatic = false; mIsStatic = false;
mIsFullyDefined = false; mIsFullyDefined = false;
@ -2236,12 +2230,12 @@ public:
BE_VALUE_TYPE(BeDbgFile, BeMDNode); BE_VALUE_TYPE(BeDbgFile, BeMDNode);
public: public:
String mFileName; String mFileName;
String mDirectory; String mDirectory;
Val128 mMD5Hash; Val128 mMD5Hash;
int mIdx; int mIdx;
void ToString(String& str); void ToString(String& str);
void GetFilePath(String& outStr); void GetFilePath(String& outStr);
virtual void HashContent(BeHashContext& hashCtx) override virtual void HashContent(BeHashContext& hashCtx) override
@ -2295,7 +2289,7 @@ public:
String mFileName; String mFileName;
String mDirectory; String mDirectory;
String mProducer; String mProducer;
OwnedVector<BeDbgFile> mFiles; OwnedVector<BeDbgFile> mFiles;
OwnedVector<BeDbgNamespace> mNamespaces; OwnedVector<BeDbgNamespace> mNamespaces;
OwnedVector<BeDbgGlobalVariable> mGlobalVariables; OwnedVector<BeDbgGlobalVariable> mGlobalVariables;
@ -2303,7 +2297,7 @@ public:
OwnedVector<BeMDNode> mTypes; OwnedVector<BeMDNode> mTypes;
Array<BeDbgFunction*> mFuncs; // Does not include methods in structs Array<BeDbgFunction*> mFuncs; // Does not include methods in structs
virtual void HashContent(BeHashContext& hashCtx) override; virtual void HashContent(BeHashContext& hashCtx) override;
BeDbgReferenceType* CreateReferenceType(BeDbgType* dbgType); BeDbgReferenceType* CreateReferenceType(BeDbgType* dbgType);
}; };
@ -2330,18 +2324,18 @@ public:
int mInsertPos; int mInsertPos;
BeDbgLoc* mCurDbgLoc; BeDbgLoc* mCurDbgLoc;
BeDbgLoc* mPrevDbgLocInline; BeDbgLoc* mPrevDbgLocInline;
BeDbgLoc* mLastDbgLoc; BeDbgLoc* mLastDbgLoc;
Array<BeArgument*> mArgs; Array<BeArgument*> mArgs;
Array<BeFunction*> mFunctions; Array<BeFunction*> mFunctions;
Dictionary<String, BeFunction*> mFunctionMap; Dictionary<String, BeFunction*> mFunctionMap;
int mCurDbgLocIdx; int mCurDbgLocIdx;
int mCurLexBlockId; int mCurLexBlockId;
BeDbgModule* mDbgModule; BeDbgModule* mDbgModule;
CeMachine* mCeMachine; CeMachine* mCeMachine;
public: public:
void AddInst(BeInst* inst); void AddInst(BeInst* inst);
static void ToString(StringImpl& str, BeType* type); static void ToString(StringImpl& str, BeType* type);
static void StructToString(StringImpl& str, BeStructType* type); static void StructToString(StringImpl& str, BeStructType* type);
@ -2362,7 +2356,7 @@ public:
} }
public: public:
BeModule(const StringImpl& moduleName, BeContext* context); BeModule(const StringImpl& moduleName, BeContext* context);
~BeModule(); ~BeModule();
void Hash(BeHashContext& hashCtx); void Hash(BeHashContext& hashCtx);
@ -2375,11 +2369,11 @@ public:
void DoInlining(BeFunction* func); void DoInlining(BeFunction* func);
void DoInlining(); void DoInlining();
static BeCmpKind InvertCmp(BeCmpKind cmpKind); static BeCmpKind InvertCmp(BeCmpKind cmpKind);
static BeCmpKind SwapCmpSides(BeCmpKind cmpKind); static BeCmpKind SwapCmpSides(BeCmpKind cmpKind);
void SetActiveFunction(BeFunction* function); void SetActiveFunction(BeFunction* function);
BeArgument* GetArgument(int arg); BeArgument* GetArgument(int arg);
BeBlock* CreateBlock(const StringImpl& name); BeBlock* CreateBlock(const StringImpl& name);
void AddBlock(BeFunction* function, BeBlock* block); void AddBlock(BeFunction* function, BeBlock* block);
void RemoveBlock(BeFunction* function, BeBlock* block); void RemoveBlock(BeFunction* function, BeBlock* block);
BeBlock* GetInsertBlock(); BeBlock* GetInsertBlock();
@ -2395,9 +2389,9 @@ public:
/// ///
BeNopInst* CreateNop(); BeNopInst* CreateNop();
BeUndefValueInst* CreateUndefValue(BeType* type); BeUndefValueInst* CreateUndefValue(BeType* type);
BeNumericCastInst* CreateNumericCast(BeValue* value, BeType* toType, bool valSigned, bool toSigned); BeNumericCastInst* CreateNumericCast(BeValue* value, BeType* toType, bool valSigned, bool toSigned);
BeBitCastInst* CreateBitCast(BeValue* value, BeType* toType);; BeBitCastInst* CreateBitCast(BeValue* value, BeType* toType);;
BeCmpInst* CreateCmp(BeCmpKind cmpKind, BeValue* lhs, BeValue* rhs); BeCmpInst* CreateCmp(BeCmpKind cmpKind, BeValue* lhs, BeValue* rhs);
BeBinaryOpInst* CreateBinaryOp(BeBinaryOpKind opKind, BeValue* lhs, BeValue* rhs, BfOverflowCheckKind overflowCheckKind = BfOverflowCheckKind_None); BeBinaryOpInst* CreateBinaryOp(BeBinaryOpKind opKind, BeValue* lhs, BeValue* rhs, BfOverflowCheckKind overflowCheckKind = BfOverflowCheckKind_None);
BeAllocaInst* CreateAlloca(BeType* type); BeAllocaInst* CreateAlloca(BeType* type);
@ -2407,19 +2401,17 @@ public:
BeStoreInst* CreateAlignedStore(BeValue* val, BeValue* ptr, int alignment, bool isVolatile); BeStoreInst* CreateAlignedStore(BeValue* val, BeValue* ptr, int alignment, bool isVolatile);
BeGEPInst* CreateGEP(BeValue* ptr, BeValue* idx0, BeValue* idx1); BeGEPInst* CreateGEP(BeValue* ptr, BeValue* idx0, BeValue* idx1);
BeBrInst* CreateBr(BeBlock* block); BeBrInst* CreateBr(BeBlock* block);
BeCondBrInst* CreateCondBr(BeValue* cond, BeBlock* trueBlock, BeBlock* falseBlock); BeCondBrInst* CreateCondBr(BeValue* cond, BeBlock* trueBlock, BeBlock* falseBlock);
BeRetInst* CreateRetVoid(); BeRetInst* CreateRetVoid();
BeRetInst* CreateRet(BeValue* value); BeRetInst* CreateRet(BeValue* value);
BeSetRetInst* CreateSetRet(BeValue* value, int returnTypeId); BeSetRetInst* CreateSetRet(BeValue* value, int returnTypeId);
BeCallInst* CreateCall(BeValue* func, const SizedArrayImpl<BeValue*>& args); BeCallInst* CreateCall(BeValue* func, const SizedArrayImpl<BeValue*>& args);
BeConstant* GetConstant(BeType* type, double floatVal); BeConstant* GetConstant(BeType* type, double floatVal);
BeConstant* GetConstant(BeType* type, int64 intVal); BeConstant* GetConstant(BeType* type, int64 intVal);
BeConstant* GetConstant(BeType* type, bool boolVal); BeConstant* GetConstant(BeType* type, bool boolVal);
BeConstant* GetConstantNull(BePointerType* type); BeConstant* GetConstantNull(BePointerType* type);
}; };
NS_BF_END NS_BF_END