30 AddMeasurement(Label::NumRvsdgNodesBefore,
rvsdg::nnodes(&graph.GetRootRegion()));
31 AddMeasurement(Label::NumRvsdgInputsBefore,
rvsdg::ninputs(&graph.GetRootRegion()));
32 AddTimer(Label::Timer).start();
38 AddMeasurement(Label::NumRvsdgNodesAfter,
rvsdg::nnodes(&graph.GetRootRegion()));
39 AddMeasurement(Label::NumRvsdgInputsAfter,
rvsdg::ninputs(&graph.GetRootRegion()));
41 AddMeasurement(NumRegionsLabel_, getNumRegions());
42 AddMeasurement(NumTotalRegionIterationsLabel_, getTotalIterations());
43 AddMeasurement(MaxIterationsPerRegionLabel_, getMaxIterationsPerRegion());
45 auto & counters = getReductionCounters();
46 AddMeasurement(
"#LoadNonVolatileReductions", counters.numLoadNonVolatileReductions);
47 AddMeasurement(
"#StoreNonVolatileReductions", counters.numStoreNonVolatileReductions);
48 AddMeasurement(
"#MemoryStateMergeReductions", counters.numMemoryStateMergeReductions);
49 AddMeasurement(
"#MemoryStateJoinReductions", counters.numMemoryStateJoinReductions);
50 AddMeasurement(
"#MemoryStateSplitReductions", counters.numMemoryStateSplitReductions);
52 "#LambdaExitMemoryStateMergeReductions",
53 counters.numLambdaExitMemoryStateMergeReductions);
54 AddMeasurement(
"#MatchReductions", counters.numMatchReductions);
55 AddMeasurement(
"#SExtReductions", counters.numSExtReductions);
56 AddMeasurement(
"#ZExtReductions", counters.numZExtReductions);
57 AddMeasurement(
"#TruncReductions", counters.numTruncReductions);
58 AddMeasurement(
"#IntegerEqReductions", counters.numIntegerEqReductions);
59 AddMeasurement(
"#IntegerNeReductions", counters.numIntegerNeReductions);
60 AddMeasurement(
"#IntegerSgeReductions", counters.numIntegerSgeReductions);
61 AddMeasurement(
"#IntegerSgtReductions", counters.numIntegerSgtReductions);
62 AddMeasurement(
"#IntegerSleReductions", counters.numIntegerSleReductions);
63 AddMeasurement(
"#IntegerSltReductions", counters.numIntegerSltReductions);
64 AddMeasurement(
"#IntegerUgeReductions", counters.numIntegerUgeReductions);
65 AddMeasurement(
"#IntegerUgtReductions", counters.numIntegerUgtReductions);
66 AddMeasurement(
"#IntegerUleReductions", counters.numIntegerUleReductions);
67 AddMeasurement(
"#IntegerUltReductions", counters.numIntegerUltReductions);
69 AddMeasurement(
"#IntegerAddReductions", counters.numIntegerAddReductions);
70 AddMeasurement(
"#IntegerSubReductions", counters.numIntegerSubReductions);
71 AddMeasurement(
"#IntegerMulReductions", counters.numIntegerMulReductions);
72 AddMeasurement(
"#IntegerSDivReductions", counters.numIntegerSDivReductions);
73 AddMeasurement(
"#IntegerUDivReductions", counters.numIntegerUDivReductions);
74 AddMeasurement(
"#IntegerSRemReductions", counters.numIntegerSRemReductions);
75 AddMeasurement(
"#IntegerURemReductions", counters.numIntegerURemReductions);
76 AddMeasurement(
"#IntegerAShrReductions", counters.numIntegerAShrReductions);
77 AddMeasurement(
"#IntegerShlReductions", counters.numIntegerShlReductions);
78 AddMeasurement(
"#IntegerLShrReductions", counters.numIntegerLShrReductions);
79 AddMeasurement(
"#IntegerAndReductions", counters.numIntegerAndReductions);
80 AddMeasurement(
"#IntegerOrReductions", counters.numIntegerOrReductions);
81 AddMeasurement(
"#IntegerXorReductions", counters.numIntegerXorReductions);
83 AddMeasurement(
"#PtrCmpReductions", counters.numPtrCmpReductions);
84 AddMeasurement(
"#GetElementPtrReductions", counters.numGetElementPtrReductions);
85 AddMeasurement(
"#BinaryReductions", counters.numBinaryReductions);
86 AddMeasurement(
"#GammaReductions", counters.numGammaReductions);
88 GetTimer(Label::Timer).stop();
102 if (
const auto it = NumIterations_.find(®ion); it != NumIterations_.end())
113 return NumIterations_.size();
120 for (
auto [_, numIterations] : NumIterations_)
122 sum += numIterations;
131 return std::max_element(
132 NumIterations_.begin(),
133 NumIterations_.end(),
134 [](
const auto & p1,
const auto & p2)
136 return p1.second < p2.second;
141static std::vector<rvsdg::NodeNormalization<rvsdg::MatchOperation>>
144static std::vector<rvsdg::NodeNormalization<SExtOperation>>
147static std::vector<rvsdg::NodeNormalization<ZExtOperation>>
150static std::vector<rvsdg::NodeNormalization<TruncOperation>>
153static std::vector<rvsdg::NodeNormalization<IntegerEqOperation>>
156static std::vector<rvsdg::NodeNormalization<IntegerNeOperation>>
159static std::vector<rvsdg::NodeNormalization<IntegerSgeOperation>>
162static std::vector<rvsdg::NodeNormalization<IntegerSgtOperation>>
165static std::vector<rvsdg::NodeNormalization<IntegerSleOperation>>
168static std::vector<rvsdg::NodeNormalization<IntegerSltOperation>>
171static std::vector<rvsdg::NodeNormalization<IntegerUgeOperation>>
174static std::vector<rvsdg::NodeNormalization<IntegerUgtOperation>>
177static std::vector<rvsdg::NodeNormalization<IntegerUleOperation>>
180static std::vector<rvsdg::NodeNormalization<IntegerUltOperation>>
183static std::vector<rvsdg::NodeNormalization<IntegerAddOperation>>
189static std::vector<rvsdg::NodeNormalization<IntegerMulOperation>>
192static std::vector<rvsdg::NodeNormalization<IntegerSDivOperation>>
195static std::vector<rvsdg::NodeNormalization<IntegerUDivOperation>>
198static std::vector<rvsdg::NodeNormalization<IntegerSRemOperation>>
201static std::vector<rvsdg::NodeNormalization<IntegerURemOperation>>
204static std::vector<rvsdg::NodeNormalization<IntegerAShrOperation>>
207static std::vector<rvsdg::NodeNormalization<IntegerShlOperation>>
210static std::vector<rvsdg::NodeNormalization<IntegerLShrOperation>>
213static std::vector<rvsdg::NodeNormalization<IntegerAndOperation>>
216static std::vector<rvsdg::NodeNormalization<IntegerOrOperation>>
219static std::vector<rvsdg::NodeNormalization<IntegerXorOperation>>
222static std::vector<rvsdg::NodeNormalization<LoadNonVolatileOperation>>
229static std::vector<rvsdg::NodeNormalization<StoreNonVolatileOperation>>
237static std::vector<rvsdg::NodeNormalization<MemoryStateMergeOperation>>
243static std::vector<rvsdg::NodeNormalization<MemoryStateJoinOperation>>
247static std::vector<rvsdg::NodeNormalization<MemoryStateSplitOperation>>
252static std::vector<rvsdg::NodeNormalization<LambdaExitMemoryStateMergeOperation>>
258static std::vector<rvsdg::NodeNormalization<PtrCmpOperation>>
261static std::vector<rvsdg::NodeNormalization<GetElementPtrOperation>>
264static std::vector<rvsdg::NodeNormalization<rvsdg::BinaryOperation>>
267template<
typename TOperation>
271 return [&](
const TOperation & operation,
const std::vector<rvsdg::Output *> & operands)
277template<
class TOperation>
286 if (reductionPerformed)
288 return reductionPerformed;
302 const auto & graph = rvsdgModule.
Rvsdg();
316 bool reductionPerformed =
false;
317 size_t numIterations = 0;
321 reductionPerformed =
false;
337 if (reductionPerformed)
343 }
while (reductionPerformed);
351 bool reductionPerformed =
false;
354 if (
const auto gammaNode =
dynamic_cast<rvsdg::GammaNode *
>(&structuralNode))
359 if (reductionPerformed)
366 for (
size_t n = 0; n < structuralNode.
nsubregions(); n++)
368 const auto subregion = structuralNode.
subregion(n);
382 if (reductionPerformed)
383 Statistics_->getReductionCounters().numGammaReductions++;
385 return reductionPerformed;
391 if (is<LoadNonVolatileOperation>(&simpleNode))
393 return reduceSimpleNode<LoadNonVolatileOperation>(
396 Statistics_->getReductionCounters().numLoadNonVolatileReductions);
398 if (is<StoreNonVolatileOperation>(&simpleNode))
400 return reduceSimpleNode<StoreNonVolatileOperation>(
403 Statistics_->getReductionCounters().numStoreNonVolatileReductions);
405 if (is<MemoryStateMergeOperation>(&simpleNode))
407 return reduceSimpleNode<MemoryStateMergeOperation>(
410 Statistics_->getReductionCounters().numMemoryStateMergeReductions);
412 if (is<MemoryStateJoinOperation>(&simpleNode))
414 return reduceSimpleNode<MemoryStateJoinOperation>(
417 Statistics_->getReductionCounters().numMemoryStateJoinReductions);
419 if (is<MemoryStateSplitOperation>(&simpleNode))
421 return reduceSimpleNode<MemoryStateSplitOperation>(
424 Statistics_->getReductionCounters().numMemoryStateSplitReductions);
426 if (is<LambdaExitMemoryStateMergeOperation>(&simpleNode))
428 return reduceSimpleNode<LambdaExitMemoryStateMergeOperation>(
431 Statistics_->getReductionCounters().numLambdaExitMemoryStateMergeReductions);
433 if (is<rvsdg::MatchOperation>(&simpleNode))
435 return reduceSimpleNode<rvsdg::MatchOperation>(
438 Statistics_->getReductionCounters().numMatchReductions);
440 if (is<SExtOperation>(&simpleNode))
442 return reduceSimpleNode<SExtOperation>(
445 Statistics_->getReductionCounters().numSExtReductions);
447 if (is<ZExtOperation>(&simpleNode))
449 return reduceSimpleNode<ZExtOperation>(
452 Statistics_->getReductionCounters().numZExtReductions);
454 if (is<TruncOperation>(&simpleNode))
456 return reduceSimpleNode<TruncOperation>(
459 Statistics_->getReductionCounters().numTruncReductions);
461 if (is<IntegerEqOperation>(&simpleNode))
463 return reduceSimpleNode<IntegerEqOperation>(
466 Statistics_->getReductionCounters().numIntegerEqReductions);
468 if (is<IntegerNeOperation>(&simpleNode))
470 return reduceSimpleNode<IntegerNeOperation>(
473 Statistics_->getReductionCounters().numIntegerNeReductions);
475 if (is<IntegerSgeOperation>(&simpleNode))
477 return reduceSimpleNode<IntegerSgeOperation>(
480 Statistics_->getReductionCounters().numIntegerSgeReductions);
482 if (is<IntegerSgtOperation>(&simpleNode))
484 return reduceSimpleNode<IntegerSgtOperation>(
487 Statistics_->getReductionCounters().numIntegerSgtReductions);
489 if (is<IntegerSleOperation>(&simpleNode))
491 return reduceSimpleNode<IntegerSleOperation>(
494 Statistics_->getReductionCounters().numIntegerSleReductions);
496 if (is<IntegerSltOperation>(&simpleNode))
498 return reduceSimpleNode<IntegerSltOperation>(
501 Statistics_->getReductionCounters().numIntegerSltReductions);
503 if (is<IntegerUgeOperation>(&simpleNode))
505 return reduceSimpleNode<IntegerUgeOperation>(
508 Statistics_->getReductionCounters().numIntegerUgeReductions);
510 if (is<IntegerUgtOperation>(&simpleNode))
512 return reduceSimpleNode<IntegerUgtOperation>(
515 Statistics_->getReductionCounters().numIntegerUgtReductions);
517 if (is<IntegerUleOperation>(&simpleNode))
519 return reduceSimpleNode<IntegerUleOperation>(
522 Statistics_->getReductionCounters().numIntegerUleReductions);
524 if (is<IntegerUltOperation>(&simpleNode))
526 return reduceSimpleNode<IntegerUltOperation>(
529 Statistics_->getReductionCounters().numIntegerUltReductions);
531 if (is<IntegerAddOperation>(&simpleNode))
533 return reduceSimpleNode<IntegerAddOperation>(
536 Statistics_->getReductionCounters().numIntegerAddReductions);
538 if (is<IntegerSubOperation>(&simpleNode))
540 return reduceSimpleNode<IntegerSubOperation>(
543 Statistics_->getReductionCounters().numIntegerSubReductions);
545 if (is<IntegerMulOperation>(&simpleNode))
547 return reduceSimpleNode<IntegerMulOperation>(
550 Statistics_->getReductionCounters().numIntegerMulReductions);
552 if (is<IntegerSDivOperation>(&simpleNode))
554 return reduceSimpleNode<IntegerSDivOperation>(
557 Statistics_->getReductionCounters().numIntegerSDivReductions);
559 if (is<IntegerUDivOperation>(&simpleNode))
561 return reduceSimpleNode<IntegerUDivOperation>(
564 Statistics_->getReductionCounters().numIntegerUDivReductions);
566 if (is<IntegerSRemOperation>(&simpleNode))
568 return reduceSimpleNode<IntegerSRemOperation>(
571 Statistics_->getReductionCounters().numIntegerSRemReductions);
573 if (is<IntegerURemOperation>(&simpleNode))
575 return reduceSimpleNode<IntegerURemOperation>(
578 Statistics_->getReductionCounters().numIntegerURemReductions);
580 if (is<IntegerAShrOperation>(&simpleNode))
582 return reduceSimpleNode<IntegerAShrOperation>(
585 Statistics_->getReductionCounters().numIntegerAShrReductions);
587 if (is<IntegerShlOperation>(&simpleNode))
589 return reduceSimpleNode<IntegerShlOperation>(
592 Statistics_->getReductionCounters().numIntegerShlReductions);
594 if (is<IntegerLShrOperation>(&simpleNode))
596 return reduceSimpleNode<IntegerLShrOperation>(
599 Statistics_->getReductionCounters().numIntegerLShrReductions);
601 if (is<IntegerAndOperation>(&simpleNode))
603 return reduceSimpleNode<IntegerAndOperation>(
606 Statistics_->getReductionCounters().numIntegerAndReductions);
608 if (is<IntegerOrOperation>(&simpleNode))
610 return reduceSimpleNode<IntegerOrOperation>(
613 Statistics_->getReductionCounters().numIntegerOrReductions);
615 if (is<IntegerXorOperation>(&simpleNode))
617 return reduceSimpleNode<IntegerXorOperation>(
620 Statistics_->getReductionCounters().numIntegerXorReductions);
622 if (is<PtrCmpOperation>(&simpleNode))
624 return reduceSimpleNode<PtrCmpOperation>(
627 Statistics_->getReductionCounters().numPtrCmpReductions);
629 if (is<GetElementPtrOperation>(&simpleNode))
631 return reduceSimpleNode<GetElementPtrOperation>(
634 Statistics_->getReductionCounters().numGetElementPtrReductions);
636 if (is<rvsdg::BinaryOperation>(&simpleNode))
638 return reduceSimpleNode<rvsdg::BinaryOperation>(
641 Statistics_->getReductionCounters().numBinaryReductions);
static jlm::util::StatisticsCollector statisticsCollector
static std::optional< std::vector< rvsdg::Output * > > normalizeIdempotent(const GetElementPtrOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerAShrOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerAddOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerAndOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerEqOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerLShrOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerMulOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerNeOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerOrOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSDivOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSRemOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSgeOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSgtOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerShlOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSleOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSltOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSubOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > normalizeAdditiveInverse(const IntegerSubOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUDivOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerURemOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUgeOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUgtOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUleOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUltOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerXorOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > NormalizeLoadFromAlloca(const LambdaExitMemoryStateMergeOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > NormalizeStoreToAlloca(const LambdaExitMemoryStateMergeOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > NormalizeAlloca(const LambdaExitMemoryStateMergeOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > normalizeIOBarrierAddress(const LoadNonVolatileOperation &loadOperation, const std::vector< rvsdg::Output * > &operands)
Redirect the address operand of the LoadNonVolatileOperation node from an IOBarrierOperation node whe...
static std::optional< std::vector< rvsdg::Output * > > NormalizeLoadStoreState(const LoadNonVolatileOperation &operation, const std::vector< rvsdg::Output * > &operands)
If the producer of a load's address is an alloca operation, then we can remove all state edges origin...
static std::optional< std::vector< rvsdg::Output * > > NormalizeDuplicateStates(const LoadNonVolatileOperation &operation, const std::vector< rvsdg::Output * > &operands)
Remove duplicated state operands.
static std::optional< std::vector< rvsdg::Output * > > NormalizeLoadAlloca(const LoadNonVolatileOperation &operation, const std::vector< rvsdg::Output * > &operands)
If the producer of a load's address is an alloca operation, then we can remove all state edges origin...
static std::optional< std::vector< rvsdg::Output * > > NormalizeLoadStore(const LoadNonVolatileOperation &operation, const std::vector< rvsdg::Output * > &operands)
Forwards the value from a store operation.
static std::optional< std::vector< rvsdg::Output * > > NormalizeDuplicateOperands(const MemoryStateJoinOperation &operation, const std::vector< rvsdg::Output * > &operands)
Removes duplicated operands from the MemoryStateJoinOperation.
static std::optional< std::vector< rvsdg::Output * > > NormalizeSingleOperand(const MemoryStateJoinOperation &operation, const std::vector< rvsdg::Output * > &operands)
Removes the MemoryStateJoinOperation as it has only a single operand, i.e., no joining is performed.
static std::optional< std::vector< rvsdg::Output * > > NormalizeNestedMerges(const MemoryStateMergeOperation &operation, const std::vector< rvsdg::Output * > &operands)
Fuses nested merges into a single merge.
static std::optional< std::vector< rvsdg::Output * > > NormalizeMergeSplit(const MemoryStateMergeOperation &operation, const std::vector< rvsdg::Output * > &operands)
Fuses nested splits into a single merge.
static std::optional< std::vector< rvsdg::Output * > > NormalizeSingleOperand(const MemoryStateMergeOperation &operation, const std::vector< rvsdg::Output * > &operands)
Removes the MemoryStateMergeOperation as it has only a single operand, i.e., no merging is performed.
static std::optional< std::vector< rvsdg::Output * > > NormalizeDuplicateOperands(const MemoryStateMergeOperation &operation, const std::vector< rvsdg::Output * > &operands)
Removes duplicated operands from the MemoryStateMergeOperation.
static std::optional< std::vector< rvsdg::Output * > > NormalizeNestedSplits(const MemoryStateSplitOperation &operation, const std::vector< rvsdg::Output * > &operands)
Fuses nested splits into a single split.
static std::optional< std::vector< rvsdg::Output * > > NormalizeSingleResult(const MemoryStateSplitOperation &operation, const std::vector< rvsdg::Output * > &operands)
Removes the MemoryStateSplitOperation as it has only a single result, i.e., no splitting is performed...
static std::optional< std::vector< rvsdg::Output * > > NormalizeSplitMerge(const MemoryStateSplitOperation &operation, const std::vector< rvsdg::Output * > &operands)
Removes an idempotent split-merge pair.
size_t getTotalIterations() const noexcept
size_t getNumRegions() const noexcept
bool AddIteration(const rvsdg::Region ®ion, size_t numIterations)
size_t getMaxIterationsPerRegion() const noexcept
void End(const rvsdg::Graph &graph) noexcept
std::unordered_map< const rvsdg::Region *, size_t > NumIterations_
void Start(const rvsdg::Graph &graph) noexcept
static std::unique_ptr< Statistics > Create(const util::FilePath &sourceFile)
std::optional< size_t > GetNumIterations(const rvsdg::Region ®ion) const noexcept
void ReduceNodesInRegion(rvsdg::Region ®ion)
std::unique_ptr< Statistics > Statistics_
void Run(rvsdg::RvsdgModule &rvsdgModule, util::StatisticsCollector &statisticsCollector) override
Perform RVSDG transformation.
bool ReduceStructuralNode(rvsdg::StructuralNode &structuralNode)
bool ReduceGammaNode(rvsdg::GammaNode &gammaNode)
bool ReduceSimpleNode(rvsdg::SimpleNode &simpleNode)
~NodeReduction() noexcept override
static std::optional< std::vector< rvsdg::Output * > > normalizeNullPointerComparison(const PtrCmpOperation &ptrCmpOperation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstant(const SExtOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > normalizeStoreStore(const StoreNonVolatileOperation &store2Op, const std::vector< rvsdg::Output * > &operands)
Removes a duplicated store to the same address.
static std::optional< std::vector< rvsdg::Output * > > normalizeIOBarrierAddress(const StoreNonVolatileOperation &storeOperation, const std::vector< rvsdg::Output * > &operands)
Redirect the address operand of the StoreNonVolatileOperation node from an IOBarrierOperation node wh...
static std::optional< std::vector< rvsdg::Output * > > NormalizeStoreMux(const StoreNonVolatileOperation &operation, const std::vector< rvsdg::Output * > &operands)
Swaps a memory state merge operation and a store operation.
static std::optional< std::vector< rvsdg::Output * > > normalizeStoreAllocaSingleUser(const StoreNonVolatileOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > NormalizeStoreAlloca(const StoreNonVolatileOperation &operation, const std::vector< rvsdg::Output * > &operands)
Removes unnecessary state from a store node when its address originates directly from an alloca node.
static std::optional< std::vector< rvsdg::Output * > > NormalizeDuplicateStates(const StoreNonVolatileOperation &operation, const std::vector< rvsdg::Output * > &operands)
Remove duplicated state operands.
static std::optional< std::vector< rvsdg::Output * > > foldConstant(const TruncOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstant(const ZExtOperation &operation, const std::vector< rvsdg::Output * > &operands)
Conditional operator / pattern matching.
Represent acyclic RVSDG subgraphs.
void prune(bool recursive)
const std::optional< util::FilePath > & SourceFilePath() const noexcept
rvsdg::Region * subregion(size_t index) const noexcept
size_t nsubregions() const noexcept
void CollectDemandedStatistics(std::unique_ptr< Statistics > statistics)
Global memory state passed between functions.
static std::vector< rvsdg::NodeNormalization< IntegerLShrOperation > > integerLShrNormalizations({ IntegerLShrOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerAndOperation > > integerAndNormalizations({ IntegerAndOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< GetElementPtrOperation > > getElementPtrNormalizations({ GetElementPtrOperation::normalizeIdempotent })
static std::vector< rvsdg::NodeNormalization< IntegerAddOperation > > integerAddNormalizations({ IntegerAddOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerXorOperation > > integerXorNormalizations({ IntegerXorOperation::foldConstants })
static bool reduceSimpleNode(rvsdg::SimpleNode &simpleNode, const std::vector< rvsdg::NodeNormalization< TOperation > > &normalizations, size_t &counter)
static std::vector< rvsdg::NodeNormalization< IntegerAShrOperation > > integerAShrNormalizations({ IntegerAShrOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< LoadNonVolatileOperation > > loadNonVolatileNormalizations({ LoadNonVolatileOperation::NormalizeLoadStore, LoadNonVolatileOperation::NormalizeLoadAlloca, LoadNonVolatileOperation::NormalizeDuplicateStates, LoadNonVolatileOperation::NormalizeLoadStoreState, LoadNonVolatileOperation::normalizeIOBarrierAddress })
static std::vector< rvsdg::NodeNormalization< IntegerEqOperation > > integerEqNormalizations({ IntegerEqOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< rvsdg::MatchOperation > > matchOperationNormalizations({ foldMatchOperationWithConstant })
static std::vector< rvsdg::NodeNormalization< IntegerShlOperation > > integerShlNormalizations({ IntegerShlOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerSRemOperation > > integerSRemNormalizations({ IntegerSRemOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< rvsdg::BinaryOperation > > binaryOperationNormalizations({ rvsdg::NormalizeBinaryOperation })
static std::vector< rvsdg::NodeNormalization< SExtOperation > > sextOperationNormalizations({ SExtOperation::foldConstant })
static std::vector< rvsdg::NodeNormalization< IntegerSubOperation > > integerSubNormalizations({ IntegerSubOperation::normalizeAdditiveInverse, IntegerSubOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerURemOperation > > integerURemNormalizations({ IntegerURemOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerUleOperation > > integerUleNormalizations({ IntegerUleOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< MemoryStateJoinOperation > > memoryStateJoinNormalizations({ MemoryStateJoinOperation::NormalizeSingleOperand, MemoryStateJoinOperation::NormalizeDuplicateOperands })
static std::vector< rvsdg::NodeNormalization< IntegerSltOperation > > integerSltNormalizations({ IntegerSltOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< LambdaExitMemoryStateMergeOperation > > lambdaExitMemoryStateMergeNormalizations({ LambdaExitMemoryStateMergeOperation::NormalizeLoadFromAlloca, LambdaExitMemoryStateMergeOperation::NormalizeStoreToAlloca, LambdaExitMemoryStateMergeOperation::NormalizeAlloca })
static std::vector< rvsdg::NodeNormalization< IntegerMulOperation > > integerMulNormalizations({ IntegerMulOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerNeOperation > > integerNeNormalizations({ IntegerNeOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerUgeOperation > > integerUgeNormalizations({ IntegerUgeOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerSDivOperation > > integerSDivNormalizations({ IntegerSDivOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerSgtOperation > > integerSgtNormalizations({ IntegerSgtOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< MemoryStateMergeOperation > > memoryStateMergeNormalizations({ MemoryStateMergeOperation::NormalizeSingleOperand, MemoryStateMergeOperation::NormalizeDuplicateOperands, MemoryStateMergeOperation::NormalizeNestedMerges, MemoryStateMergeOperation::NormalizeMergeSplit })
static std::vector< rvsdg::NodeNormalization< IntegerSgeOperation > > integerSgeNormalizations({ IntegerSgeOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< PtrCmpOperation > > ptrCmpNormalizations({ PtrCmpOperation::normalizeNullPointerComparison })
static std::vector< rvsdg::NodeNormalization< ZExtOperation > > zextOperationNormalizations({ ZExtOperation::foldConstant })
static std::vector< rvsdg::NodeNormalization< IntegerUltOperation > > integerUltNormalizations({ IntegerUltOperation::foldConstants })
bool reduceStaticallyKnownPredicate(rvsdg::GammaNode &gammaNode)
static std::vector< rvsdg::NodeNormalization< MemoryStateSplitOperation > > memoryStateSplitNormalizations({ MemoryStateSplitOperation::NormalizeSingleResult, MemoryStateSplitOperation::NormalizeNestedSplits, MemoryStateSplitOperation::NormalizeSplitMerge })
static std::vector< rvsdg::NodeNormalization< IntegerOrOperation > > integerOrNormalizations({ IntegerOrOperation::foldConstants })
std::optional< std::vector< rvsdg::Output * > > foldMatchOperationWithConstant(const rvsdg::MatchOperation &matchOperation, const std::vector< rvsdg::Output * > &operands)
static std::vector< rvsdg::NodeNormalization< IntegerUDivOperation > > integerUDivNormalizations({ IntegerUDivOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< IntegerUgtOperation > > integerUgtNormalizations({ IntegerUgtOperation::foldConstants })
static std::vector< rvsdg::NodeNormalization< StoreNonVolatileOperation > > storeNonVolatileNormalizations({ StoreNonVolatileOperation::NormalizeStoreMux, StoreNonVolatileOperation::normalizeStoreStore, StoreNonVolatileOperation::NormalizeStoreAlloca, StoreNonVolatileOperation::NormalizeDuplicateStates, StoreNonVolatileOperation::normalizeIOBarrierAddress, StoreNonVolatileOperation::normalizeStoreAllocaSingleUser })
static std::vector< rvsdg::NodeNormalization< IntegerSleOperation > > integerSleNormalizations({ IntegerSleOperation::foldConstants })
static rvsdg::NodeNormalization< TOperation > createNormalizer(const std::vector< rvsdg::NodeNormalization< TOperation > > &nodeNormalizations)
static std::vector< rvsdg::NodeNormalization< TruncOperation > > truncOperationNormalizations({ TruncOperation::foldConstant })
std::optional< std::vector< rvsdg::Output * > > NormalizeBinaryOperation(const BinaryOperation &operation, const std::vector< rvsdg::Output * > &operands)
Applies the reductions implemented in the binary operations reduction functions.
size_t nnodes(const jlm::rvsdg::Region *region) noexcept
size_t ninputs(const rvsdg::Region *region) noexcept
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
std::function< std::optional< std::vector< Output * > >(const TOperation &, const std::vector< Output * > &)> NodeNormalization
detail::TopDownTraverserGeneric< false > TopDownTraverser
Traverser for visiting every node in a region in a top down order.