diff --git a/src/mapleall/maple_ir/include/bin_mpl_import.h b/src/mapleall/maple_ir/include/bin_mpl_import.h index 1970d73ba25621337d34d33e300050b3c7d37c70..5ea94e90b9bf605ab3918b1167568ff454f856a6 100644 --- a/src/mapleall/maple_ir/include/bin_mpl_import.h +++ b/src/mapleall/maple_ir/include/bin_mpl_import.h @@ -93,7 +93,7 @@ class BinaryMplImport { void InsertInHashTable(MIRType &ptype); void SetupEHRootType(); void UpdateMethodSymbols(); - void ImportConstBase(MIRConstKind &kind, MIRTypePtr &type, uint32 &fieldID); + void ImportConstBase(MIRConstKind &kind, MIRTypePtr &type); MIRConst *ImportConst(MIRFunction *func); GStrIdx ImportStr(); UStrIdx ImportUsrStr(); diff --git a/src/mapleall/maple_ir/include/global_tables.h b/src/mapleall/maple_ir/include/global_tables.h index 4d7ca4441d54dc82b1803e9076b51dbb5eae6ce6..666876a45b988f1e6dd9cdb88ed0dccf7d89e3a9 100644 --- a/src/mapleall/maple_ir/include/global_tables.h +++ b/src/mapleall/maple_ir/include/global_tables.h @@ -504,9 +504,9 @@ class FPConstTable { ~FPConstTable(); // get the const from floatConstTable or create a new one - MIRFloatConst *GetOrCreateFloatConst(float fval, uint32 fieldID); + MIRFloatConst *GetOrCreateFloatConst(float fval); // get the const from doubleConstTable or create a new one - MIRDoubleConst *GetOrCreateDoubleConst(double fval, uint32 fieldID); + MIRDoubleConst *GetOrCreateDoubleConst(double fval); static std::unique_ptr Create() { auto p = std::unique_ptr(new FPConstTable()); @@ -541,7 +541,7 @@ class IntConstTable { IntConstTable &operator=(const IntConstTable &p) = delete; ~IntConstTable(); - MIRIntConst *GetOrCreateIntConst(int64 val, MIRType &type, uint32 fieldID); + MIRIntConst *GetOrCreateIntConst(int64 val, MIRType &type); static std::unique_ptr Create() { auto p = std::unique_ptr(new IntConstTable()); @@ -550,8 +550,8 @@ class IntConstTable { private: IntConstTable() = default; - MIRIntConst *DoGetOrCreateIntConst(int64 val, MIRType &type, uint32 fieldID); - MIRIntConst *DoGetOrCreateIntConstTreadSafe(int64 val, MIRType &type, uint32 fieldID); + MIRIntConst *DoGetOrCreateIntConst(int64 val, MIRType &type); + MIRIntConst *DoGetOrCreateIntConstTreadSafe(int64 val, MIRType &type); std::shared_timed_mutex mtx; std::unordered_map intConstTable; }; diff --git a/src/mapleall/maple_ir/include/mir_const.h b/src/mapleall/maple_ir/include/mir_const.h index e52913813ec205f6b4dbcb27d50dfac36c965828..ae143a81206fdd6af35a1e22a3fa1c8cbea7f206 100644 --- a/src/mapleall/maple_ir/include/mir_const.h +++ b/src/mapleall/maple_ir/include/mir_const.h @@ -39,19 +39,13 @@ enum MIRConstKind { class MIRConst { public: - explicit MIRConst(MIRType &type, MIRConstKind constKind = kConstInvalid, uint32 fieldID = 0) - : type(type), kind(constKind), fieldID(fieldID) {} + explicit MIRConst(MIRType &type, MIRConstKind constKind = kConstInvalid) + : type(type), kind(constKind) {} virtual ~MIRConst() = default; - virtual void Dump(const MIRSymbolTable *localSymTab = nullptr) const; - - uint32 GetFieldId() const { - return fieldID; - } - - void SetFieldID(uint32 fieldIdx) { - fieldID = fieldIdx; + virtual void Dump(const MIRSymbolTable *localSymTab = nullptr) const { + (void)localSymTab; } virtual bool IsZero() const { @@ -94,15 +88,12 @@ class MIRConst { private: MIRType &type; MIRConstKind kind; - - protected: - uint32 fieldID; }; class MIRIntConst : public MIRConst { public: using value_type = int64; - MIRIntConst(int64 val, MIRType &type, uint32 fieldID = 0) : MIRConst(type, kConstInt, fieldID), value(val) { + MIRIntConst(int64 val, MIRType &type) : MIRConst(type, kConstInt), value(val) { if (!IsPrimitiveDynType(type.GetPrimType())) { Trunc(GetPrimTypeBitSize(type.GetPrimType())); } @@ -163,11 +154,11 @@ class MIRIntConst : public MIRConst { class MIRAddrofConst : public MIRConst { public: - MIRAddrofConst(StIdx sy, FieldID fi, MIRType &ty, uint32 fieldID = 0) - : MIRConst(ty, kConstAddrof, fieldID), stIdx(sy), fldID(fi), offset(0) {} + MIRAddrofConst(StIdx sy, FieldID fi, MIRType &ty) + : MIRConst(ty, kConstAddrof), stIdx(sy), fldID(fi), offset(0) {} - MIRAddrofConst(StIdx sy, FieldID fi, MIRType &ty, int32 ofst, uint32 fieldID = 0) - : MIRConst(ty, kConstAddrof, fieldID), stIdx(sy), fldID(fi), offset(ofst) {} + MIRAddrofConst(StIdx sy, FieldID fi, MIRType &ty, int32 ofst) + : MIRConst(ty, kConstAddrof), stIdx(sy), fldID(fi), offset(ofst) {} ~MIRAddrofConst() = default; @@ -199,8 +190,8 @@ class MIRAddrofConst : public MIRConst { class MIRAddroffuncConst : public MIRConst { public: - MIRAddroffuncConst(PUIdx idx, MIRType &ty, uint32 fieldID = 0) - : MIRConst(ty, kConstAddrofFunc, fieldID), puIdx(idx) {} + MIRAddroffuncConst(PUIdx idx, MIRType &ty) + : MIRConst(ty, kConstAddrofFunc), puIdx(idx) {} ~MIRAddroffuncConst() = default; @@ -222,8 +213,8 @@ class MIRAddroffuncConst : public MIRConst { class MIRLblConst : public MIRConst { public: - MIRLblConst(LabelIdx val, PUIdx pidx, MIRType &type, uint32 fieldID = 0) - : MIRConst(type, kConstLblConst, fieldID), value(val), puIdx(pidx) {} + MIRLblConst(LabelIdx val, PUIdx pidx, MIRType &type) + : MIRConst(type, kConstLblConst), value(val), puIdx(pidx) {} ~MIRLblConst() = default; @@ -249,9 +240,9 @@ class MIRLblConst : public MIRConst { class MIRStrConst : public MIRConst { public: - MIRStrConst(UStrIdx val, MIRType &type, uint32 fieldID = 0) : MIRConst(type, kConstStrConst, fieldID), value(val) {} + MIRStrConst(UStrIdx val, MIRType &type) : MIRConst(type, kConstStrConst), value(val) {} - MIRStrConst(const std::string &str, MIRType &type, uint32 fieldID = 0); + MIRStrConst(const std::string &str, MIRType &type); ~MIRStrConst() = default; @@ -277,10 +268,10 @@ class MIRStrConst : public MIRConst { class MIRStr16Const : public MIRConst { public: - MIRStr16Const(const U16StrIdx &val, MIRType &type, uint32 fieldID = 0) - : MIRConst(type, kConstStr16Const, fieldID), value(val) {} + MIRStr16Const(const U16StrIdx &val, MIRType &type) + : MIRConst(type, kConstStr16Const), value(val) {} - MIRStr16Const(const std::u16string &str, MIRType &type, uint32 fieldID = 0); + MIRStr16Const(const std::u16string &str, MIRType &type); ~MIRStr16Const() = default; static PrimType GetPrimType() { @@ -306,7 +297,7 @@ class MIRStr16Const : public MIRConst { class MIRFloatConst : public MIRConst { public: using value_type = float; - MIRFloatConst(float val, MIRType &type, uint32 fieldID = 0) : MIRConst(type, kConstFloatConst, fieldID) { + MIRFloatConst(float val, MIRType &type) : MIRConst(type, kConstFloatConst) { value.floatValue = val; } @@ -372,7 +363,7 @@ class MIRFloatConst : public MIRConst { class MIRDoubleConst : public MIRConst { public: using value_type = double; - MIRDoubleConst(double val, MIRType &type, uint32 fieldID = 0) : MIRConst(type, kConstDoubleConst, fieldID) { + MIRDoubleConst(double val, MIRType &type) : MIRConst(type, kConstDoubleConst) { value.dValue = val; } @@ -439,8 +430,8 @@ class MIRDoubleConst : public MIRConst { class MIRFloat128Const : public MIRConst { public: - MIRFloat128Const(const uint64 &val, MIRType &type, uint32 fieldID = 0) - : MIRConst(type, kConstFloat128Const, fieldID) { + MIRFloat128Const(const uint64 &val, MIRType &type) + : MIRConst(type, kConstFloat128Const) { value = &val; } @@ -484,23 +475,36 @@ class MIRFloat128Const : public MIRConst { class MIRAggConst : public MIRConst { public: - MIRAggConst(MIRModule &mod, MIRType &type, uint32 fieldID = 0) - : MIRConst(type, kConstAggConst, fieldID), constVec(mod.GetMPAllocator().Adapter()) {} + MIRAggConst(MIRModule &mod, MIRType &type) + : MIRConst(type, kConstAggConst), + constVec(mod.GetMPAllocator().Adapter()), + fieldIdVec(mod.GetMPAllocator().Adapter()) {} ~MIRAggConst() = default; MIRConst *GetAggConstElement(unsigned int fieldidx) { - for (size_t i = 0; i < constVec.size(); ++i) { - if (constVec[i] == nullptr) { - CHECK_FATAL(false, "exist nullptr in constVec"); - } - if (fieldidx == constVec[i]->GetFieldId()) { + for (size_t i = 0; i < fieldIdVec.size(); ++i) { + if (fieldIdVec[i] == fieldidx) { return constVec[i]; } } return nullptr; } + void SetFieldIdOfElement(const MIRConst *elem, uint32 fieldId) { + for (uint32 id = 0; id < constVec.size(); ++id) { + if (constVec[id] == elem) { + fieldIdVec[id] = fieldId; + return; + } + } + } + + void SetFieldIdOfElement(uint32 elemIndex, uint32 fieldId) { + ASSERT(elemIndex < fieldIdVec.size(), "index out of range"); + fieldIdVec[elemIndex] = fieldId; + } + const MapleVector &GetConstVec() const { return constVec; } @@ -519,12 +523,20 @@ class MIRAggConst : public MIRConst { return constVec[index]; } - void SetConstVecItem(uint32 index, MIRConst &mirConst) { + uint32 GetFieldIdItem(size_t index) { + ASSERT(index < fieldIdVec.size(), "index out of range"); + return fieldIdVec[index]; + } + + void SetItem(uint32 index, MIRConst *mirConst, uint32 fieldId) { CHECK_FATAL(index < constVec.size(), "index out of range"); - constVec[index] = &mirConst; + constVec[index] = mirConst; + fieldIdVec[index] = fieldId; } - void PushBack(MIRConst *elem) { + + void AddItem(MIRConst *elem, uint32 fieldId) { constVec.push_back(elem); + fieldIdVec.push_back(fieldId); } void Dump(const MIRSymbolTable *localSymTab) const override; @@ -536,13 +548,14 @@ class MIRAggConst : public MIRConst { private: MapleVector constVec; + MapleVector fieldIdVec; }; // the const has one or more symbols class MIRStConst : public MIRConst { public: - MIRStConst(MIRModule &mod, MIRType &type, uint32 fieldID = 0) - : MIRConst(type, kConstStConst, fieldID), + MIRStConst(MIRModule &mod, MIRType &type) + : MIRConst(type, kConstStConst), stVec(mod.GetMPAllocator().Adapter()), stOffsetVec(mod.GetMPAllocator().Adapter()) {} diff --git a/src/mapleall/maple_ir/include/mir_parser.h b/src/mapleall/maple_ir/include/mir_parser.h index 9782ff0ca025dfeb767c412a40e259c1b2df6fc3..74009f5ab98cb8dd4fcce651dbd70ac22633e436 100644 --- a/src/mapleall/maple_ir/include/mir_parser.h +++ b/src/mapleall/maple_ir/include/mir_parser.h @@ -54,7 +54,7 @@ class MIRParser { bool IsStatement(TokenKind tk) const; PrimType GetPrimitiveType(TokenKind tk) const; MIRIntrinsicID GetIntrinsicID(TokenKind tk) const; - bool ParseScalarValue(MIRConstPtr&, MIRType&, uint32 fieldID); + bool ParseScalarValue(MIRConstPtr&, MIRType&); bool ParseConstAddrLeafExpr(MIRConstPtr&); bool ParseInitValue(MIRConstPtr&, TyIdx, bool allowEmpty = false); bool ParseDeclaredSt(StIdx&); diff --git a/src/mapleall/maple_ir/src/bin_mpl_export.cpp b/src/mapleall/maple_ir/src/bin_mpl_export.cpp index 26e6aa9ff1614f7e4651d550f9bc42ebf59d7825..22bc6768270942bfcdb4cc01c8a7af96ba4354bf 100644 --- a/src/mapleall/maple_ir/src/bin_mpl_export.cpp +++ b/src/mapleall/maple_ir/src/bin_mpl_export.cpp @@ -106,6 +106,7 @@ void OutputConstAgg(const MIRConst &constVal, BinaryMplExport &mplExport) { size_t size = aggConst.GetConstVec().size(); mplExport.WriteNum(size); for (size_t i = 0; i < size; ++i) { + mplExport.WriteNum(aggConst.GetFieldIdItem(i)); mplExport.OutputConst(aggConst.GetConstVecItem(i)); } } @@ -396,7 +397,6 @@ void BinaryMplExport::DumpBuf(const std::string &name) { void BinaryMplExport::OutputConstBase(const MIRConst &constVal) { WriteNum(constVal.GetKind()); OutputTypeViaTypeName(constVal.GetType().GetTypeIndex()); - WriteNum(constVal.GetFieldId()); } void BinaryMplExport::OutputConst(MIRConst *constVal) { diff --git a/src/mapleall/maple_ir/src/bin_mpl_import.cpp b/src/mapleall/maple_ir/src/bin_mpl_import.cpp index 2ac33c8b175d7737052f81f717c5e0501244482f..893f256c5ce8eb52a0d169b3b9e8bc8821a596a0 100644 --- a/src/mapleall/maple_ir/src/bin_mpl_import.cpp +++ b/src/mapleall/maple_ir/src/bin_mpl_import.cpp @@ -89,14 +89,10 @@ void BinaryMplImport::ReadFileAt(const std::string &name, int32 offset) { CHECK_FATAL(result == static_cast(size), "Error while reading the binary file: %s", name.c_str()); } -void BinaryMplImport::ImportConstBase(MIRConstKind &kind, MIRTypePtr &type, uint32 &fieldID) { +void BinaryMplImport::ImportConstBase(MIRConstKind &kind, MIRTypePtr &type) { kind = static_cast(ReadNum()); TyIdx tyidx = ImportType(); type = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyidx); - int64 tmp = ReadNum(); - CHECK_FATAL(tmp <= INT_MAX, "num out of range"); - CHECK_FATAL(tmp >= INT_MIN, "num out of range"); - fieldID = static_cast(tmp); } MIRConst *BinaryMplImport::ImportConst(MIRFunction *func) { @@ -107,40 +103,39 @@ MIRConst *BinaryMplImport::ImportConst(MIRFunction *func) { MIRConstKind kind; MIRType *type = nullptr; - uint32 fieldID; MemPool *memPool = (func == nullptr) ? mod.GetMemPool() : func->GetCodeMempool(); - ImportConstBase(kind, type, fieldID); + ImportConstBase(kind, type); switch (tag) { case kBinKindConstInt: - return GlobalTables::GetIntConstTable().GetOrCreateIntConst(ReadNum(), *type, fieldID); + return GlobalTables::GetIntConstTable().GetOrCreateIntConst(ReadNum(), *type); case kBinKindConstAddrof: { MIRSymbol *sym = InSymbol(func); CHECK_FATAL(sym != nullptr, "null ptr check"); FieldID fi = ReadNum(); int32 ofst = ReadNum(); - return memPool->New(sym->GetStIdx(), fi, *type, ofst, fieldID); + return memPool->New(sym->GetStIdx(), fi, *type, ofst); } case kBinKindConstAddrofLocal: { uint32 fullidx = ReadNum(); FieldID fi = ReadNum(); int32 ofst = ReadNum(); - return memPool->New(StIdx(fullidx), fi, *type, ofst, fieldID); + return memPool->New(StIdx(fullidx), fi, *type, ofst); } case kBinKindConstAddrofFunc: { PUIdx puIdx = ImportFunction(); - return memPool->New(puIdx, *type, fieldID); + return memPool->New(puIdx, *type); } case kBinKindConstAddrofLabel: { LabelIdx lidx = ReadNum(); PUIdx puIdx = func->GetPuidx(); - MIRLblConst *lblConst = memPool->New(lidx, puIdx, *type, fieldID); + MIRLblConst *lblConst = memPool->New(lidx, puIdx, *type); (void)func->GetLabelTab()->addrTakenLabels.insert(lidx); return lblConst; } case kBinKindConstStr: { UStrIdx ustr = ImportUsrStr(); - return memPool->New(ustr, *type, fieldID); + return memPool->New(ustr, *type); } case kBinKindConstStr16: { Conststr16Node *cs; @@ -154,7 +149,7 @@ MIRConst *BinaryMplImport::ImportConst(MIRFunction *func) { std::u16string str16; (void)namemangler::UTF8ToUTF16(str16, ostr.str()); cs->SetStrIdx(GlobalTables::GetU16StrTable().GetOrCreateStrIdxFromName(str16)); - return memPool->New(cs->GetStrIdx(), *type, fieldID); + return memPool->New(cs->GetStrIdx(), *type); } case kBinKindConstFloat: { union { @@ -163,7 +158,7 @@ MIRConst *BinaryMplImport::ImportConst(MIRFunction *func) { } value; value.ivalue = ReadNum(); - return GlobalTables::GetFpConstTable().GetOrCreateFloatConst(value.fvalue, fieldID); + return GlobalTables::GetFpConstTable().GetOrCreateFloatConst(value.fvalue); } case kBinKindConstDouble: { union { @@ -172,18 +167,19 @@ MIRConst *BinaryMplImport::ImportConst(MIRFunction *func) { } value; value.ivalue = ReadNum(); - return GlobalTables::GetFpConstTable().GetOrCreateDoubleConst(value.dvalue, fieldID); + return GlobalTables::GetFpConstTable().GetOrCreateDoubleConst(value.dvalue); } case kBinKindConstAgg: { - MIRAggConst *aggConst = mod.GetMemPool()->New(mod, *type, fieldID); + MIRAggConst *aggConst = mod.GetMemPool()->New(mod, *type); int64 size = ReadNum(); for (int64 i = 0; i < size; ++i) { - aggConst->PushBack(ImportConst(func)); + auto fieldId = static_cast(ReadInt64()); + aggConst->AddElement(ImportConst(func), fieldId); } return aggConst; } case kBinKindConstSt: { - MIRStConst *stConst = mod.GetMemPool()->New(mod, *type, fieldID); + MIRStConst *stConst = mod.GetMemPool()->New(mod, *type); int64 size = ReadNum(); for (int64 i = 0; i < size; ++i) { stConst->PushbackSymbolToSt(InSymbol(func)); diff --git a/src/mapleall/maple_ir/src/mir_const.cpp b/src/mapleall/maple_ir/src/mir_const.cpp index 3a45856eb80c26f259f00c88e6aa501fade17d1f..b1e7dc45d12d610dc83ac4875f985c819f30ef2a 100644 --- a/src/mapleall/maple_ir/src/mir_const.cpp +++ b/src/mapleall/maple_ir/src/mir_const.cpp @@ -21,15 +21,7 @@ #if MIR_FEATURE_FULL namespace maple { -void MIRConst::Dump(const MIRSymbolTable *localSymTab) const { - (void)localSymTab; - if (fieldID) { - LogInfo::MapleLogger() << fieldID << "= "; - } -} - -void MIRIntConst::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); +void MIRIntConst::Dump(const MIRSymbolTable*) const { constexpr int64 valThreshold = 1024; if (value <= valThreshold) { LogInfo::MapleLogger() << value; @@ -89,7 +81,6 @@ int64 MIRIntConst::GetValueUnderType() const { } void MIRAddrofConst::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); LogInfo::MapleLogger() << "addrof " << GetPrimTypeName(PTY_ptr); const MIRSymbol *sym = stIdx.IsGlobal() ? GlobalTables::GetGsymTable().GetSymbolFromStidx(stIdx.Idx()) : localSymTab->GetSymbolFromStIdx(stIdx.Idx()); @@ -118,8 +109,7 @@ bool MIRAddrofConst::operator==(const MIRConst &rhs) const { return (stIdx == rhsA.stIdx) && (fldID == rhsA.fldID); } -void MIRAddroffuncConst::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); +void MIRAddroffuncConst::Dump(const MIRSymbolTable*) const { LogInfo::MapleLogger() << "addroffunc " << GetPrimTypeName(PTY_ptr); MIRFunction *func = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(puIdx); LogInfo::MapleLogger() << " &" << GlobalTables::GetGsymTable().GetSymbolFromStidx(func->GetStIdx().Idx())->GetName(); @@ -136,8 +126,7 @@ bool MIRAddroffuncConst::operator==(const MIRConst &rhs) const { return (&GetType() == &rhs.GetType()) && (puIdx == rhsAf.puIdx); } -void MIRLblConst::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); +void MIRLblConst::Dump(const MIRSymbolTable*) const { LogInfo::MapleLogger() << "addroflabel " << GetPrimTypeName(PTY_ptr); MIRFunction *func = GlobalTables::GetFunctionTable().GetFunctionFromPuidx(puIdx); LogInfo::MapleLogger() << " @" << func->GetLabelName(value); @@ -221,17 +210,15 @@ bool MIRAggConst::operator==(const MIRConst &rhs) const { return true; } -void MIRFloatConst::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); +void MIRFloatConst::Dump(const MIRSymbolTable*) const { LogInfo::MapleLogger() << std::setprecision(std::numeric_limits::max_digits10) << value.floatValue << "f"; } -void MIRDoubleConst::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); +void MIRDoubleConst::Dump(const MIRSymbolTable*) const { LogInfo::MapleLogger() << std::setprecision(std::numeric_limits::max_digits10) << value.dValue; } -void MIRFloat128Const::Dump(const MIRSymbolTable *localSymTab) const { +void MIRFloat128Const::Dump(const MIRSymbolTable*) const { constexpr int fieldWidth = 16; MIRConst::Dump(localSymTab); std::ios::fmtflags f(LogInfo::MapleLogger().flags()); @@ -242,10 +229,12 @@ void MIRFloat128Const::Dump(const MIRSymbolTable *localSymTab) const { } void MIRAggConst::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); LogInfo::MapleLogger() << "["; size_t size = constVec.size(); for (size_t i = 0; i < size; ++i) { + if (fieldIdVec[i] != 0) { + LogInfo::MapleLogger() << fieldIdVec[i] << "= "; + } constVec[i]->Dump(localSymTab); if (i != size - 1) { LogInfo::MapleLogger() << ", "; @@ -254,11 +243,10 @@ void MIRAggConst::Dump(const MIRSymbolTable *localSymTab) const { LogInfo::MapleLogger() << "]"; } -MIRStrConst::MIRStrConst(const std::string &str, MIRType &type, uint32 fieldID) - : MIRConst(type, kConstStrConst, fieldID), value(GlobalTables::GetUStrTable().GetOrCreateStrIdxFromName(str)) {} +MIRStrConst::MIRStrConst(const std::string &str, MIRType &type) + : MIRConst(type, kConstStrConst), value(GlobalTables::GetUStrTable().GetOrCreateStrIdxFromName(str)) {} -void MIRStrConst::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); +void MIRStrConst::Dump(const MIRSymbolTable*) const { LogInfo::MapleLogger() << "conststr " << GetPrimTypeName(GetType().GetPrimType()); const std::string &dumpStr = GlobalTables::GetUStrTable().GetStringFromStrIdx(value); PrintString(dumpStr); @@ -279,8 +267,7 @@ MIRStr16Const::MIRStr16Const(const std::u16string &str, MIRType &type, uint32 fi : MIRConst(type, kConstStr16Const, fieldID), value(GlobalTables::GetU16StrTable().GetOrCreateStrIdxFromName(str)) {} -void MIRStr16Const::Dump(const MIRSymbolTable *localSymTab) const { - MIRConst::Dump(localSymTab); +void MIRStr16Const::Dump(const MIRSymbolTable*) const { LogInfo::MapleLogger() << "conststr16 " << GetPrimTypeName(GetType().GetPrimType()); std::u16string str16 = GlobalTables::GetU16StrTable().GetStringFromStrIdx(value); // UTF-16 string are dumped as UTF-8 string in mpl to keep the printable chars in ascii form