LayoutTypeSystemNode: add NonScalar field

This field represents that fact that a node of the DLA Graph is not a
scalar and it comes from the Model.
This commit is contained in:
Pietro Fezzardi
2023-07-19 15:02:00 +02:00
parent 552b8a96d9
commit cac7fee07d
3 changed files with 82 additions and 6 deletions
+16 -3
View File
@@ -132,6 +132,8 @@ void debug_function LayoutTypeSystem::dumpDotOnFile(const char *FName,
revng_unreachable();
}
DotFile << " NonScalar: " << L->NonScalar;
if (CollapsedNodePrinter.isEnabled() or ShowCollapsed)
DebugPrinter->printNodeContent(*this, L, DotFile);
@@ -290,12 +292,23 @@ void LayoutTypeSystem::mergeNodes(const LayoutTypeSystemNodePtrVec &ToMerge) {
revng_assert(From != Into);
revng_log(MergeLog, "Merging: " << From->ID << " Into: " << Into->ID);
Into->InterferingInfo = Unknown;
if (Into->NonScalar or From->NonScalar) {
revng_assert(not(Into->NonScalar and From->NonScalar)
or Into->Size == From->Size);
auto *NonScalar = Into->NonScalar ? Into : From;
auto *Other = Into->NonScalar ? From : Into;
revng_assert(Other->Size <= NonScalar->Size);
Into->Size = NonScalar->Size;
} else {
revng_assert(not Into->Size or From->Size <= Into->Size);
Into->Size = std::max(Into->Size, From->Size);
}
Into->NonScalar |= From->NonScalar;
EqClasses.join(IntoID, From->ID);
fixPredSucc(From, Into);
Into->InterferingInfo = Unknown;
revng_assert(not Into->Size or From->Size <= Into->Size);
Into->Size = std::max(Into->Size, From->Size);
// Remove From from Layouts
bool Erased = Layouts.erase(From);