diff --git a/src/mapleall/maple_ir/include/mir_symbol.h b/src/mapleall/maple_ir/include/mir_symbol.h index b4e142494f1fb8f2c8b735456db9d94e9b113635..8c2652799071f65022458c696169dcedef6b97c2 100644 --- a/src/mapleall/maple_ir/include/mir_symbol.h +++ b/src/mapleall/maple_ir/include/mir_symbol.h @@ -413,7 +413,7 @@ class MIRSymbol { bool IsGctibSym() const; bool IsPrimordialObject() const; bool IgnoreRC() const; - void Dump(bool isLocal, int32 indent, bool suppressinit = false) const; + void Dump(bool isLocal, int32 indent, bool suppressinit = false, const MIRSymbolTable *localsymtab = nullptr) const; void DumpAsLiteralVar() const; bool operator==(const MIRSymbol &msym) const { return nameStrIdx == msym.nameStrIdx; diff --git a/src/mapleall/maple_ir/include/mir_type.h b/src/mapleall/maple_ir/include/mir_type.h index 5dced4dd0af21affe7d5f95fd7685c128a824e8e..1d382e26a28631c10dc20a0ab32718cebeebb92e 100644 --- a/src/mapleall/maple_ir/include/mir_type.h +++ b/src/mapleall/maple_ir/include/mir_type.h @@ -51,6 +51,7 @@ inline uint32 GetPrimTypeBitSize(PrimType primType) { #endif // MIR_FEATURE_FULL // return the same type with size increased to register size PrimType GetRegPrimType(PrimType primType); +PrimType GetReg64PrimType(PrimType primType); PrimType GetDynType(PrimType primType); PrimType GetNonDynType(PrimType primType); diff --git a/src/mapleall/maple_ir/src/bin_mpl_import.cpp b/src/mapleall/maple_ir/src/bin_mpl_import.cpp index b72991d35a1d767c9f8616491fe5ee7b9ab607f5..96ee881185b0337e8b9f51312fa9c8f664537189 100644 --- a/src/mapleall/maple_ir/src/bin_mpl_import.cpp +++ b/src/mapleall/maple_ir/src/bin_mpl_import.cpp @@ -103,7 +103,7 @@ MIRConst *BinaryMplImport::ImportConst(MIRFunction *func) { MIRConstKind kind; MIRType *type = nullptr; - MemPool *memPool = (func == nullptr) ? mod.GetMemPool() : func->GetCodeMempool(); + MemPool *memPool = mod.GetMemPool(); ImportConstBase(kind, type); switch (tag) { diff --git a/src/mapleall/maple_ir/src/mir_symbol.cpp b/src/mapleall/maple_ir/src/mir_symbol.cpp index da9d66e6c3593c407323aa351310cd232097b9e7..35edfe7a4fdc24b1f482607652367cb537313bdc 100644 --- a/src/mapleall/maple_ir/src/mir_symbol.cpp +++ b/src/mapleall/maple_ir/src/mir_symbol.cpp @@ -307,7 +307,7 @@ bool MIRSymbol::IgnoreRC() const { return strIdx == reflectClassNameIdx; } -void MIRSymbol::Dump(bool isLocal, int32 indent, bool suppressInit) const { +void MIRSymbol::Dump(bool isLocal, int32 indent, bool suppressInit, const MIRSymbolTable *localsymtab) const { if (sKind == kStVar || sKind == kStFunc) { if (srcPosition.FileNum() != 0 && srcPosition.LineNum() != 0 && srcPosition.LineNum() != lastPrintedLineNum) { LogInfo::MapleLogger() << "LOC " << srcPosition.FileNum() << " " << srcPosition.LineNum() << std::endl; @@ -360,7 +360,7 @@ void MIRSymbol::Dump(bool isLocal, int32 indent, bool suppressInit) const { } if (IsConst() && !suppressInit && !(IsLiteral() && GetStorageClass() == kScExtern)) { LogInfo::MapleLogger() << " = "; - GetKonst()->Dump(); + GetKonst()->Dump(localsymtab); } LogInfo::MapleLogger() << '\n'; } @@ -387,7 +387,7 @@ void MIRSymbolTable::Dump(bool isLocal, int32 indent, bool printDeleted) const { if (!printDeleted && symbol->IsDeleted()) { continue; } - symbol->Dump(isLocal, indent); + symbol->Dump(isLocal, indent, false/*suppressinit*/, this); } } diff --git a/src/mapleall/maple_ir/src/mir_type.cpp b/src/mapleall/maple_ir/src/mir_type.cpp index 789ec1683c21b09b2288c0f9b865a970178d9b7d..a221f2da12cb953ed3e7ba93f0d4c2ba5a4199c5 100644 --- a/src/mapleall/maple_ir/src/mir_type.cpp +++ b/src/mapleall/maple_ir/src/mir_type.cpp @@ -57,6 +57,22 @@ PrimType GetRegPrimType(PrimType primType) { } } +PrimType GetReg64PrimType(PrimType primType) { + switch (primType) { + case PTY_i8: + case PTY_i16: + case PTY_i32: + return PTY_i64; + case PTY_u1: + case PTY_u8: + case PTY_u16: + case PTY_u32: + return PTY_u64; + default: + return primType; + } +} + bool VerifyPrimType(PrimType primType1, PrimType primType2) { switch (primType1) { case PTY_u1: diff --git a/src/mapleall/maple_me/src/alias_class.cpp b/src/mapleall/maple_me/src/alias_class.cpp index 8c042609a2d0b2e810666fd8ded5125b46b85ca7..fdee58c29b6d43e725c60fc5c0afbbc8c2f25715 100644 --- a/src/mapleall/maple_me/src/alias_class.cpp +++ b/src/mapleall/maple_me/src/alias_class.cpp @@ -593,14 +593,16 @@ AliasElem *AliasClass::FindOrCreateDummyNADSAe() { dummySym->SetIsDeleted(); OriginalSt *dummyOst = ssaTab.GetOriginalStTable().FindOrCreateSymbolOriginalSt(*dummySym, 0, 0); ssaTab.GetVersionStTable().CreateZeroVersionSt(dummyOst); - if (osym2Elem.size() == dummyOst->GetIndex()) { - AliasElem *dummyAe = acMemPool.New(osym2Elem.size(), *dummyOst); + if (osym2Elem.size() > dummyOst->GetIndex() && osym2Elem[dummyOst->GetIndex()] != nullptr) { + return osym2Elem[dummyOst->GetIndex()]; + } else { + AliasElem *dummyAe = acMemPool.New(id2Elem.size(), *dummyOst); dummyAe->SetNotAllDefsSeen(true); id2Elem.push_back(dummyAe); osym2Elem.push_back(dummyAe); unionFind.NewMember(); + return dummyAe; } - return osym2Elem[dummyOst->GetIndex()]; } // This is applicable only for C language. For each ost that is a struct, diff --git a/src/mapleall/maple_me/src/ssa_pre.cpp b/src/mapleall/maple_me/src/ssa_pre.cpp index fc53d8751e5ad65a07ad47836a4900671b8eae76..3df98356af3f9dc81dadec43f24b51e095aa3bed 100644 --- a/src/mapleall/maple_me/src/ssa_pre.cpp +++ b/src/mapleall/maple_me/src/ssa_pre.cpp @@ -67,8 +67,9 @@ ScalarMeExpr *SSAPre::CreateNewCurTemp(const MeExpr &meExpr) { } else { ty = realMIRType->GetPointedType(); } - CHECK_FATAL(ty->GetPrimType() == meExpr.GetPrimType() || - !(IsAddress(ty->GetPrimType()) && IsAddress(meExpr.GetPrimType())) || + CHECK_FATAL(GetRegPrimType(ty->GetPrimType()) == GetRegPrimType(meExpr.GetPrimType()) || + GetReg64PrimType(ty->GetPrimType()) == GetReg64PrimType(meExpr.GetPrimType()) || + (IsAddress(ty->GetPrimType()) && IsAddress(meExpr.GetPrimType())) || (ty->GetPrimType() == PTY_ptr && meExpr.GetPrimType() == PTY_ref) || (ty->GetPrimType() == PTY_ref && meExpr.GetPrimType() == PTY_ptr), "inconsistent type");