54 uint64_t numNonEscaped)
65 const uint64_t totalMemoryStates =
66 numAllocas + numMallocs + numDeltas + numImports + numLambdas + numExternal;
80 uint64_t numAllocas = 0;
81 uint64_t numMallocs = 0;
82 uint64_t numDeltas = 0;
83 uint64_t numImports = 0;
84 uint64_t numLambdas = 0;
85 uint64_t numExternal = 0;
87 uint64_t numNonEscaped = 0;
89 for (
const auto memoryNode : memoryNodes.
Items())
94 const auto kind = pointsToGraph.
getNodeKind(memoryNode);
116 throw std::logic_error(
"Unknown MemoryNode kind");
216 static std::unique_ptr<EncodingStatistics>
219 return std::make_unique<EncodingStatistics>(sourceFile);
275 JLM_ASSERT(is<MemoryStateType>(state.Type()));
282 const std::vector<MemoryNodeStatePair *> & memoryNodeStatePairs,
283 const std::vector<rvsdg::Output *> & states)
285 JLM_ASSERT(memoryNodeStatePairs.size() == states.size());
286 for (
size_t n = 0; n < memoryNodeStatePairs.size(); n++)
292 const std::vector<MemoryNodeStatePair *> & memoryNodeStatePairs,
295 auto it = states.
begin();
296 for (
auto memoryNodeStatePair : memoryNodeStatePairs)
298 memoryNodeStatePair->ReplaceState(*it);
304 static std::vector<rvsdg::Output *>
305 States(
const std::vector<MemoryNodeStatePair *> & memoryNodeStatePairs)
307 std::vector<rvsdg::Output *> states;
308 for (
auto & memoryNodeStatePair : memoryNodeStatePairs)
309 states.push_back(memoryNodeStatePair->State_);
334 if (
const auto it =
states_.find(memoryNode); it !=
states_.end())
340 const MemoryNodeStatePair *
352 MemoryNodeStatePair *
355 if (
const auto statePair =
TryGetState(memoryNode))
357 throw std::logic_error(
"Memory node does not have a state.");
360 std::vector<MemoryNodeStatePair *>
363 std::vector<MemoryNodeStatePair *> memoryNodeStatePairs;
364 for (
auto & memoryNode : memoryNodes.
Items())
366 memoryNodeStatePairs.push_back(
GetState(memoryNode));
369 return memoryNodeStatePairs;
379 std::vector<MemoryNodeStatePair *>
382 std::vector<MemoryNodeStatePair *> memoryNodeStatePairs;
383 for (
auto & memoryNode : memoryNodes.
Items())
385 if (
const auto statePair =
TryGetState(memoryNode))
386 memoryNodeStatePairs.push_back(statePair);
389 return memoryNodeStatePairs;
399 MemoryNodeStatePair *
402 auto [it, added] =
states_.insert({ memoryNode, { memoryNode, state } });
404 throw std::logic_error(
"Memory node already has a state.");
408 static std::unique_ptr<StateMap>
411 return std::make_unique<StateMap>();
417 std::unordered_map<PointsToGraph::NodeIndex, MemoryNodeStatePair>
states_;
469 std::vector<StateMap::MemoryNodeStatePair *>
487 std::vector<StateMap::MemoryNodeStatePair *>
495 std::vector<StateMap::MemoryNodeStatePair *>
531 std::unordered_map<const rvsdg::Region *, std::unique_ptr<StateMap>>
StateMaps_;
590 static std::unique_ptr<MemoryStateEncoder::Context>
593 return std::make_unique<Context>(modRefSummary);
607 static std::vector<MemoryNodeId>
610 std::vector<MemoryNodeId> memoryNodeIds;
611 for (
const auto memoryNode : memoryNodes.
Items())
613 memoryNodeIds.push_back(memoryNode);
616 return memoryNodeIds;
621 MemoryStateEncoder::MemoryStateEncoder() = default;
625 rvsdg::RvsdgModule & rvsdgModule,
627 util::StatisticsCollector & statisticsCollector)
629 Context_ = Context::Create(modRefSummary);
632 statistics->Start(rvsdgModule.Rvsdg());
633 EncodeRegion(rvsdgModule.Rvsdg().GetRootRegion());
636 statistics->AddIntraProceduralRegionMemoryStateCounts(
637 Context_->GetInterProceduralRegionCounter());
638 statistics->AddLoadMemoryStateCounts(Context_->GetLoadCounter());
639 statistics->AddStoreMemoryStateCounts(Context_->GetStoreCounter());
640 statistics->AddCallEntryMergeStateCounts(Context_->GetCallEntryMergeCounter());
642 statisticsCollector.CollectDemandedStatistics(std::move(statistics));
649 deadNodeElimination.
Run(rvsdgModule, statisticsCollector);
658 for (
const auto node : traverser)
680 else if (
auto deltaNode =
dynamic_cast<const rvsdg::DeltaNode *
>(&structuralNode))
684 else if (
auto phiNode =
dynamic_cast<const rvsdg::PhiNode *
>(&structuralNode))
688 else if (
auto gammaNode =
dynamic_cast<rvsdg::GammaNode *
>(&structuralNode))
692 else if (
auto thetaNode =
dynamic_cast<rvsdg::ThetaNode *
>(&structuralNode))
709 EncodeAlloca(simpleNode);
713 EncodeMalloc(simpleNode);
717 EncodeLoad(simpleNode);
721 EncodeStore(simpleNode);
725 EncodeCall(simpleNode);
729 EncodeFree(simpleNode);
733 EncodeMemcpy(simpleNode);
742 JLM_ASSERT(!hasMemoryState(simpleNode));
751 auto & stateMap =
Context_->GetRegionalizedStateMap();
752 auto allocaMemoryNodes = stateMap.GetSimpleNodeModRef(allocaNode);
754 auto allocaMemoryNode = *allocaMemoryNodes.Items().begin();
755 auto & allocaNodeStateOutput = *allocaNode.
output(1);
759 if (
const auto statePair = stateMap.TryGetState(*allocaNode.
region(), allocaMemoryNode))
763 auto & joinOutput = *joinNode.
output(0);
764 statePair->ReplaceState(joinOutput);
768 stateMap.InsertState(allocaMemoryNode, allocaNodeStateOutput);
776 auto & stateMap =
Context_->GetRegionalizedStateMap();
777 auto mallocMemoryNodes = stateMap.GetSimpleNodeModRef(mallocNode);
779 auto mallocMemoryNode = *mallocMemoryNodes.Items().begin();
787 if (
const auto statePair = stateMap.TryGetState(*mallocNode.
region(), mallocMemoryNode))
791 auto & joinOutput = *joinNode.
output(0);
792 statePair->ReplaceState(joinOutput);
796 stateMap.InsertState(mallocMemoryNode, mallocNodeStateOutput);
804 auto & stateMap =
Context_->GetRegionalizedStateMap();
806 const auto & memoryNodes = stateMap.GetSimpleNodeModRef(node);
807 Context_->GetLoadCounter().CountEntity(
808 Context_->GetModRefSummary().GetPointsToGraph(),
811 const auto memoryNodeStatePairs = stateMap.GetExistingStates(*node.
region(), memoryNodes);
817 memoryNodeStatePairs,
824 auto & stateMap =
Context_->GetRegionalizedStateMap();
826 const auto & memoryNodes = stateMap.GetSimpleNodeModRef(node);
827 Context_->GetStoreCounter().CountEntity(
828 Context_->GetModRefSummary().GetPointsToGraph(),
831 const auto memoryNodeStatePairs = stateMap.GetExistingStates(*node.
region(), memoryNodes);
837 memoryNodeStatePairs,
845 auto & stateMap =
Context_->GetRegionalizedStateMap();
849 auto memoryNodeStatePairs = stateMap.GetExistingStates(freeNode);
858 memoryNodeStatePairs,
865 const auto region = callNode.
region();
866 auto & regionalizedStateMap =
Context_->GetRegionalizedStateMap();
868 const auto & memoryNodes = regionalizedStateMap.GetSimpleNodeModRef(callNode);
869 Context_->GetCallEntryMergeCounter().CountEntity(
870 Context_->GetModRefSummary().GetPointsToGraph(),
873 const auto statePairs = regionalizedStateMap.GetExistingStates(*region, memoryNodes);
875 std::vector<rvsdg::Output *> inputStates;
876 std::vector<MemoryNodeId> memoryNodeIds;
877 for (
auto statePair : statePairs)
879 inputStates.emplace_back(&statePair->State());
880 memoryNodeIds.push_back(statePair->MemoryNode());
883 auto & entryMergeNode =
898 auto & stateMap =
Context_->GetRegionalizedStateMap();
900 auto memoryNodeStatePairs = stateMap.GetExistingStates(memcpyNode);
921 const auto & memoryNodes =
Context_->GetModRefSummary().GetLambdaEntryModRef(lambdaNode);
922 Context_->GetInterProceduralRegionCounter().CountEntity(
923 Context_->GetModRefSummary().GetPointsToGraph(),
927 auto & stateMap =
Context_->GetRegionalizedStateMap();
929 stateMap.PushRegion(*lambdaNode.
subregion());
930 auto & lambdaEntrySplitNode =
935 for (
auto & memoryNode : memoryNodes.Items())
936 stateMap.InsertState(memoryNode, *states[n++]);
955 memoryStateArgument.divertUsersWhere(
959 return rvsdg::TryGetOwnerNode<rvsdg::SimpleNode>(user) != &lambdaEntrySplitNode;
967 const auto & memoryNodes =
Context_->GetModRefSummary().GetLambdaExitModRef(lambdaNode);
968 auto & stateMap =
Context_->GetRegionalizedStateMap();
971 std::vector<rvsdg::Output *> states;
972 std::vector<MemoryNodeId> memoryNodeIds;
973 auto & subregion = *lambdaNode.
subregion();
974 const auto memoryNodeStatePairs = stateMap.GetStates(subregion, memoryNodes);
975 for (
const auto memoryNodeStatePair : memoryNodeStatePairs)
977 states.push_back(&memoryNodeStatePair->State());
978 memoryNodeIds.push_back(memoryNodeStatePair->MemoryNode());
981 const auto mergedState =
983 memoryStateResult.divert_to(mergedState);
985 stateMap.PopRegion(*lambdaNode.
subregion());
1003 for (
auto & subregion : gammaNode.
Subregions())
1004 Context_->GetRegionalizedStateMap().PushRegion(subregion);
1008 for (
auto & subregion : gammaNode.
Subregions())
1013 for (
auto & subregion : gammaNode.
Subregions())
1014 Context_->GetRegionalizedStateMap().PopRegion(subregion);
1020 auto region = gammaNode.
region();
1021 auto & stateMap =
Context_->GetRegionalizedStateMap();
1022 auto memoryNodes =
Context_->GetModRefSummary().GetGammaEntryModRef(gammaNode);
1025 for ([[maybe_unused]]
auto & subregion : gammaNode.
Subregions())
1026 Context_->GetInterProceduralRegionCounter().CountEntity(
1027 Context_->GetModRefSummary().GetPointsToGraph(),
1030 auto memoryNodeStatePairs = stateMap.GetExistingStates(*region, memoryNodes);
1031 for (
auto & memoryNodeStatePair : memoryNodeStatePairs)
1033 auto gammaInput = gammaNode.
AddEntryVar(&memoryNodeStatePair->State());
1034 for (
auto & argument : gammaInput.branchArgument)
1035 stateMap.InsertState(memoryNodeStatePair->MemoryNode(), *argument);
1042 auto & stateMap =
Context_->GetRegionalizedStateMap();
1043 auto memoryNodes =
Context_->GetModRefSummary().GetGammaExitModRef(gammaNode);
1044 auto memoryNodeStatePairs = stateMap.GetExistingStates(*gammaNode.
region(), memoryNodes);
1046 for (
auto & memoryNodeStatePair : memoryNodeStatePairs)
1048 std::vector<rvsdg::Output *> states;
1050 for (
auto & subregion : gammaNode.
Subregions())
1052 auto & state = stateMap.GetState(subregion, memoryNodeStatePair->MemoryNode())->State();
1053 states.push_back(&state);
1057 memoryNodeStatePair->ReplaceState(*state);
1073 std::vector<rvsdg::Output *>
1076 auto region = thetaNode.
region();
1077 auto & stateMap =
Context_->GetRegionalizedStateMap();
1078 const auto & memoryNodes =
Context_->GetModRefSummary().GetThetaModRef(thetaNode);
1079 Context_->GetInterProceduralRegionCounter().CountEntity(
1080 Context_->GetModRefSummary().GetPointsToGraph(),
1083 std::vector<rvsdg::Output *> thetaStateOutputs;
1084 auto memoryNodeStatePairs = stateMap.GetExistingStates(*region, memoryNodes);
1085 for (
auto & memoryNodeStatePair : memoryNodeStatePairs)
1087 auto loopvar = thetaNode.
AddLoopVar(&memoryNodeStatePair->State());
1088 stateMap.InsertState(memoryNodeStatePair->MemoryNode(), *loopvar.pre);
1089 thetaStateOutputs.push_back(loopvar.output);
1092 return thetaStateOutputs;
1098 const std::vector<rvsdg::Output *> & thetaStateOutputs)
1101 auto & stateMap =
Context_->GetRegionalizedStateMap();
1102 const auto & memoryNodes =
Context_->GetModRefSummary().GetThetaModRef(thetaNode);
1103 auto memoryNodeStatePairs = stateMap.GetExistingStates(*thetaNode.
region(), memoryNodes);
1105 JLM_ASSERT(memoryNodeStatePairs.size() == thetaStateOutputs.size());
1106 for (
size_t n = 0; n < thetaStateOutputs.size(); n++)
1108 auto thetaStateOutput = thetaStateOutputs[n];
1109 auto & memoryNodeStatePair = memoryNodeStatePairs[n];
1110 auto memoryNode = memoryNodeStatePair->MemoryNode();
1112 JLM_ASSERT(loopvar.input->origin() == &memoryNodeStatePair->State());
1114 auto & subregionState = stateMap.GetState(*subregion, memoryNode)->State();
1115 loopvar.post->divert_to(&subregionState);
1116 memoryNodeStatePair->ReplaceState(*thetaStateOutput);
1123 const std::vector<rvsdg::Output *> & memoryStates)
1127 if (
const auto loadVolatileOperation =
1134 loadVolatileOperation->GetLoadedType(),
1135 loadVolatileOperation->GetAlignment());
1140 oldLoadedValueOutput.divert_users(&newLoadedValueOutput);
1141 oldIOStateOutput.divert_users(&newIOStateOutput);
1145 if (
const auto loadNonVolatileOperation =
1151 loadNonVolatileOperation->GetLoadedType(),
1152 loadNonVolatileOperation->GetAlignment());
1155 oldLoadedValueOutput.divert_users(&newLoadedValueOutput);
1165 const std::vector<rvsdg::Output *> & memoryStates)
1167 if (
const auto oldStoreVolatileOperation =
1175 oldStoreVolatileOperation->GetAlignment());
1178 oldIOStateOutput.divert_users(&newIOStateOutput);
1179 return newStoreNode;
1182 if (
const auto oldStoreNonVolatileOperation =
1189 oldStoreNonVolatileOperation->GetAlignment());
1195 std::vector<rvsdg::Output *>
1198 const std::vector<rvsdg::Output *> & memoryStates)
1206 if (is<MemCpyVolatileOperation>(memcpyNode.
GetOperation()))
1209 auto & newMemcpyNode =
1217 return { std::next(results.begin()), results.end() };
1219 if (is<MemCpyNonVolatileOperation>(memcpyNode.
GetOperation()))
1224 throw std::logic_error(
"Unhandled memcpy operation type.");
static rvsdg::SimpleNode & CreateNode(rvsdg::Region ®ion, const std::vector< rvsdg::Output * > &operands, std::vector< MemoryNodeId > memoryNodeIds)
static rvsdg::SimpleNode & CreateNode(rvsdg::Output &operand, std::vector< MemoryNodeId > memoryNodeIds)
static rvsdg::Input & GetMemoryStateInput(const rvsdg::Node &node) noexcept
static rvsdg::Output & GetMemoryStateOutput(const rvsdg::Node &node) noexcept
Dead Node Elimination Optimization.
void Run(rvsdg::RvsdgModule &module, util::StatisticsCollector &statisticsCollector) override
Perform RVSDG transformation.
static std::unique_ptr< llvm::ThreeAddressCode > Create(const Variable *pointer, const std::vector< const Variable * > &memoryStates, const Variable *iOState)
static rvsdg::SimpleNode & CreateNode(rvsdg::Output &operand, std::vector< MemoryNodeId > memoryNodeIds)
static rvsdg::Node & CreateNode(rvsdg::Region ®ion, const std::vector< rvsdg::Output * > &operands, const std::vector< MemoryNodeId > &memoryNodeIds)
static rvsdg::SimpleNode & CreateNode(rvsdg::Region ®ion, std::unique_ptr< LoadNonVolatileOperation > loadOperation, const std::vector< rvsdg::Output * > &operands)
static rvsdg::Input & AddressInput(const rvsdg::Node &node) noexcept
static rvsdg::Output & LoadedValueOutput(const rvsdg::Node &node)
static rvsdg::Node::OutputIteratorRange MemoryStateOutputs(const rvsdg::Node &node) noexcept
static rvsdg::Input & IOStateInput(const rvsdg::Node &node) noexcept
static rvsdg::SimpleNode & CreateNode(rvsdg::Region ®ion, std::unique_ptr< LoadVolatileOperation > loadOperation, const std::vector< rvsdg::Output * > &operands)
static rvsdg::Output & IOStateOutput(const rvsdg::Node &node)
static rvsdg::Output & memoryStateOutput(const rvsdg::Node &node)
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *destination, const Variable *source, const Variable *length, const std::vector< const Variable * > &memoryStates)
static rvsdg::SimpleNode & CreateNode(rvsdg::Output &destination, rvsdg::Output &source, rvsdg::Output &length, rvsdg::Output &ioState, const std::vector< rvsdg::Output * > &memoryStates)
static rvsdg::SimpleNode & CreateNode(const std::vector< rvsdg::Output * > &operands)
static rvsdg::Output * Create(const std::vector< rvsdg::Output * > &operands)
static rvsdg::SimpleNode & CreateNode(rvsdg::Output &address, rvsdg::Output &value, const std::vector< rvsdg::Output * > &memoryStates, size_t alignment)
static rvsdg::Input & StoredValueInput(const rvsdg::Node &node) noexcept
static rvsdg::Node::OutputIteratorRange MemoryStateOutputs(const rvsdg::SimpleNode &node) noexcept
static rvsdg::Input & AddressInput(const rvsdg::Node &node) noexcept
static rvsdg::Output & IOStateOutput(const rvsdg::Node &node) noexcept
static rvsdg::SimpleNode & CreateNode(rvsdg::Region ®ion, std::unique_ptr< StoreVolatileOperation > storeOperation, const std::vector< rvsdg::Output * > &operands)
static rvsdg::Input & IOStateInput(const rvsdg::Node &node) noexcept
Statistics class for memory state encoder encoding.
static std::unique_ptr< EncodingStatistics > Create(const util::FilePath &sourceFile)
static constexpr auto NumMaxMemoryState_
void AddStoreMemoryStateCounts(const MemoryStateTypeCounter &counter)
static constexpr auto NumStoreOperations_
static constexpr auto NumIntraProceduralRegions_
void AddCallEntryMergeStateCounts(const MemoryStateTypeCounter &counter)
static constexpr auto NumTotalMallocState_
static constexpr auto NumTotalAllocaState_
void AddLoadMemoryStateCounts(const MemoryStateTypeCounter &counter)
static constexpr auto NumCallEntryMergeOperations_
static constexpr auto RegionArgumentStateSuffix_
static constexpr auto NumTotalNonEscapedState_
static constexpr auto NumTotalExternalState_
static constexpr auto LoadStateSuffix_
void AddMemoryStateTypeCounter(const std::string &suffix, const MemoryStateTypeCounter &counter)
void AddIntraProceduralRegionMemoryStateCounts(const MemoryStateTypeCounter &counter)
static constexpr auto CallEntryMergeStateSuffix_
EncodingStatistics(const util::FilePath &sourceFile)
static constexpr auto NumMaxNonEscapedMemoryState_
static constexpr auto NumTotalDeltaState_
~EncodingStatistics() override=default
static constexpr auto NumTotalImportState_
static constexpr auto StoreStateSuffix_
static constexpr auto NumTotalLambdaState_
static constexpr auto NumLoadOperations_
void Start(const rvsdg::Graph &graph)
Context for the memory state encoder.
Context(const ModRefSummary &modRefSummary)
RegionalizedStateMap RegionalizedStateMap_
static std::unique_ptr< MemoryStateEncoder::Context > Create(const ModRefSummary &modRefSummary)
Context & operator=(const Context &)=delete
MemoryStateTypeCounter & GetCallEntryMergeCounter()
MemoryStateTypeCounter & GetStoreCounter()
MemoryStateTypeCounter & GetLoadCounter()
MemoryStateTypeCounter LoadCounter_
const ModRefSummary & GetModRefSummary() const noexcept
Context(const Context &)=delete
MemoryStateTypeCounter & GetInterProceduralRegionCounter()
RegionalizedStateMap & GetRegionalizedStateMap() noexcept
MemoryStateTypeCounter CallEntryMergeCounter_
MemoryStateTypeCounter InterProceduralRegionCounter_
MemoryStateTypeCounter StoreCounter_
const ModRefSummary & ModRefSummary_
Context(Context &&)=delete
Context & operator=(Context &&)=delete
static std::vector< rvsdg::Output * > ReplaceMemcpyNode(const rvsdg::SimpleNode &memcpyNode, const std::vector< rvsdg::Output * > &memoryStates)
void EncodeMalloc(const rvsdg::SimpleNode &mallocNode)
void EncodeCall(const rvsdg::SimpleNode &callNode)
void EncodeLambdaEntry(const rvsdg::LambdaNode &lambdaNode)
void EncodeAlloca(const rvsdg::SimpleNode &allocaNode)
static rvsdg::SimpleNode & ReplaceStoreNode(const rvsdg::SimpleNode &node, const std::vector< rvsdg::Output * > &memoryStates)
void EncodeStructuralNode(rvsdg::StructuralNode &structuralNode)
void EncodeDelta(const rvsdg::DeltaNode &deltaNode)
void EncodeLambda(const rvsdg::LambdaNode &lambda)
void EncodeLoad(const rvsdg::SimpleNode &node)
void EncodeGammaExit(rvsdg::GammaNode &gammaNode)
void EncodeStore(const rvsdg::SimpleNode &node)
std::unique_ptr< Context > Context_
void EncodeGammaEntry(rvsdg::GammaNode &gammaNode)
void EncodeRegion(rvsdg::Region ®ion)
static rvsdg::SimpleNode & ReplaceLoadNode(const rvsdg::SimpleNode &node, const std::vector< rvsdg::Output * > &memoryStates)
~MemoryStateEncoder() noexcept
void EncodeSimpleNode(const rvsdg::SimpleNode &simpleNode)
std::vector< rvsdg::Output * > EncodeThetaEntry(rvsdg::ThetaNode &thetaNode)
void EncodePhi(const rvsdg::PhiNode &phiNode)
void EncodeMemcpy(const rvsdg::SimpleNode &memcpyNode)
void EncodeGamma(rvsdg::GammaNode &gammaNode)
void EncodeFree(const rvsdg::SimpleNode &freeNode)
void EncodeLambdaExit(const rvsdg::LambdaNode &lambdaNode)
void EncodeThetaExit(rvsdg::ThetaNode &thetaNode, const std::vector< rvsdg::Output * > &thetaStateOutputs)
void EncodeTheta(rvsdg::ThetaNode &thetaNode)
virtual const util::HashSet< PointsToGraph::NodeIndex > & GetSimpleNodeModRef(const rvsdg::SimpleNode &node) const =0
bool isExternallyAvailable(NodeIndex index) const
NodeKind getNodeKind(NodeIndex index) const
Hash map for mapping Rvsdg regions to StateMap class instances.
std::unordered_map< const rvsdg::Region *, std::unique_ptr< StateMap > > StateMaps_
StateMap::MemoryNodeStatePair * GetState(const rvsdg::Region ®ion, PointsToGraph::NodeIndex memoryNode)
const ModRefSummary & ModRefSummary_
void PushRegion(const rvsdg::Region ®ion)
bool HasState(const rvsdg::Region ®ion, PointsToGraph::NodeIndex memoryNode) const
std::vector< StateMap::MemoryNodeStatePair * > GetExistingStates(const rvsdg::SimpleNode &node) const
StateMap::MemoryNodeStatePair * InsertState(PointsToGraph::NodeIndex memoryNode, rvsdg::Output &state)
RegionalizedStateMap(RegionalizedStateMap &&)=delete
RegionalizedStateMap(const ModRefSummary &modRefSummary)
RegionalizedStateMap & operator=(RegionalizedStateMap &&)=delete
std::vector< StateMap::MemoryNodeStatePair * > GetExistingStates(const rvsdg::Region ®ion, const util::HashSet< PointsToGraph::NodeIndex > &memoryNodes) const
const util::HashSet< PointsToGraph::NodeIndex > & GetSimpleNodeModRef(const rvsdg::SimpleNode &node) const
RegionalizedStateMap(const RegionalizedStateMap &)=delete
StateMap::MemoryNodeStatePair * TryGetState(const rvsdg::Region ®ion, PointsToGraph::NodeIndex memoryNode) const
RegionalizedStateMap & operator=(const RegionalizedStateMap &)=delete
std::vector< StateMap::MemoryNodeStatePair * > GetStates(const rvsdg::Region ®ion, const util::HashSet< PointsToGraph::NodeIndex > &memoryNodes)
void PopRegion(const rvsdg::Region ®ion)
StateMap & GetStateMap(const rvsdg::Region ®ion) const noexcept
static void ReplaceStates(const std::vector< MemoryNodeStatePair * > &memoryNodeStatePairs, const rvsdg::Node::OutputIteratorRange &states)
static void ReplaceStates(const std::vector< MemoryNodeStatePair * > &memoryNodeStatePairs, const std::vector< rvsdg::Output * > &states)
void ReplaceState(rvsdg::Output &state) noexcept
PointsToGraph::NodeIndex MemoryNode_
static std::vector< rvsdg::Output * > States(const std::vector< MemoryNodeStatePair * > &memoryNodeStatePairs)
MemoryNodeStatePair(PointsToGraph::NodeIndex memoryNode, rvsdg::Output &state)
PointsToGraph::NodeIndex MemoryNode() const noexcept
rvsdg::Output & State() const noexcept
Hash map for mapping points-to graph memory nodes to RVSDG memory states.
std::unordered_map< PointsToGraph::NodeIndex, MemoryNodeStatePair > states_
std::vector< MemoryNodeStatePair * > GetExistingStates(const util::HashSet< PointsToGraph::NodeIndex > &memoryNodes)
StateMap & operator=(StateMap &&)=delete
MemoryNodeStatePair * GetState(PointsToGraph::NodeIndex memoryNode)
StateMap(const StateMap &)=delete
MemoryNodeStatePair * InsertState(PointsToGraph::NodeIndex memoryNode, rvsdg::Output &state)
std::vector< MemoryNodeStatePair * > GetStates(const util::HashSet< PointsToGraph::NodeIndex > &memoryNodes)
bool HasState(PointsToGraph::NodeIndex memoryNode) const noexcept
static std::unique_ptr< StateMap > Create()
StateMap & operator=(const StateMap &)=delete
MemoryNodeStatePair * TryGetState(PointsToGraph::NodeIndex memoryNode) noexcept
StateMap(StateMap &&)=delete
const MemoryNodeStatePair * TryGetState(PointsToGraph::NodeIndex memoryNode) const noexcept
Conditional operator / pattern matching.
EntryVar AddEntryVar(rvsdg::Output *origin)
Routes a variable into the gamma branches.
ExitVar AddExitVar(std::vector< rvsdg::Output * > values)
Routes per-branch result of gamma to output.
Region & GetRootRegion() const noexcept
rvsdg::Region * subregion() const noexcept
rvsdg::Region * region() const noexcept
NodeOutput * output(size_t index) const noexcept
size_t ninputs() const noexcept
size_t noutputs() const noexcept
rvsdg::Region * region() const noexcept
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
void divert_users(jlm::rvsdg::Output *new_origin)
A phi node represents the fixpoint of mutually recursive definitions.
rvsdg::Region * subregion() const noexcept
Represent acyclic RVSDG subgraphs.
const SimpleOperation & GetOperation() const noexcept override
NodeInput * input(size_t index) const noexcept
NodeOutput * output(size_t index) const noexcept
SubregionIteratorRange Subregions()
LoopVar MapOutputLoopVar(const rvsdg::Output &output) const
Maps variable at exit to full varibale description.
rvsdg::Region * subregion() const noexcept
LoopVar AddLoopVar(rvsdg::Output *origin)
Creates a new loop-carried variable.
IteratorRange< ItemConstIterator > Items() const noexcept
util::Timer & GetTimer(const std::string &name)
Statistics(const Statistics::Id &statisticsId, util::FilePath sourceFile)
util::Timer & AddTimer(std::string name)
void AddMeasurement(std::string name, T value)
#define JLM_UNREACHABLE(msg)
static std::vector< MemoryNodeId > GetMemoryNodeIds(const util::HashSet< PointsToGraph::NodeIndex > &memoryNodes)
rvsdg::Input & GetMemoryStateRegionResult(const rvsdg::LambdaNode &lambdaNode) noexcept
rvsdg::Output & GetMemoryStateRegionArgument(const rvsdg::LambdaNode &lambdaNode) noexcept
void MatchTypeWithDefault(T &obj, const Fns &... fns)
Pattern match over subclass type of given object with default handler.
void MatchTypeOrFail(T &obj, const Fns &... fns)
Pattern match over subclass type of given object.
size_t nnodes(const jlm::rvsdg::Region *region) noexcept
static std::vector< jlm::rvsdg::Output * > outputs(const Node *node)
Helper struct for counting up MemoryNodes, among some set of entities that use them.
void CountEntity(const PointsToGraph &pointsToGraph, util::HashSet< PointsToGraph::NodeIndex > memoryNodes)
uint64_t MaxNonEscapedMemoryStateEntity
void CountEntity(uint64_t numAllocas, uint64_t numMallocs, uint64_t numDeltas, uint64_t numImports, uint64_t numLambdas, uint64_t numExternal, uint64_t numNonEscaped)
uint64_t MaxMemoryStateEntity
rvsdg::Output * output
Output of gamma.
static const char * NumRvsdgNodesBefore
static const char * Timer