|
docc 0.8.3 (0d44999b)
C++ API Reference
|
Loop condition normalization to convert inequality conditions to relational comparisons. More...
#include <sdfg/transformations/loop_condition_normalize.h>
Public Member Functions | |
| LoopConditionNormalize (structured_control_flow::StructuredLoop &loop) | |
| Construct a LoopConditionNormalize transformation. | |
| virtual std::string | name () const override |
| Get the name of this transformation. | |
| virtual bool | can_be_applied (builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override |
| Check if this transformation can be safely applied. | |
| virtual void | apply (builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override |
| Apply this transformation to the SDFG. | |
| virtual void | to_json (nlohmann::json &j) const override |
| Serialize this transformation to JSON. | |
| Public Member Functions inherited from sdfg::transformations::Transformation | |
| virtual | ~Transformation ()=default |
| virtual void | set_report (PassReportConsumer *report) |
| Set the report consumer for transformation feedback. | |
| virtual bool | try_apply (builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) |
| Attempt to apply the transformation if possible. | |
Static Public Member Functions | |
| static LoopConditionNormalize | from_json (builder::StructuredSDFGBuilder &builder, const nlohmann::json &j) |
Additional Inherited Members | |
| Protected Attributes inherited from sdfg::transformations::Transformation | |
| PassReportConsumer * | report_ = nullptr |
Loop condition normalization to convert inequality conditions to relational comparisons.
This transformation converts loop conditions with != (Unequality) or == (Equality) to relational comparisons (< or >) based on the loop's stride direction.
Precondition: stride is ±1 (apply LoopUnitStride first if needed)
For positive stride (+1): i != N → i < N (loop runs while i < N, exits when reaching N)
For negative stride (-1): i != N → i > N (loop runs while i > N, exits when reaching N)
Example (LLVM-style loop with != condition): // Original: for (i = 0; i != 10; i++) for (i = 0; i != 10; i += 1) body(i)
// After normalization: for (i = 0; i < 10; i += 1) body(i)
The transformation handles affine expressions in the condition: i != 2*N + 1 → i < 2*N + 1 (for stride = +1)
Prerequisites:
Non-applicability:
|
explicit |
Construct a LoopConditionNormalize transformation.
| loop | The loop to normalize (must have unit stride) |
|
overridevirtual |
Apply this transformation to the SDFG.
| builder | The SDFG builder |
| analysis_manager | The analysis manager (may be invalidated) |
Implements sdfg::transformations::Transformation.
|
overridevirtual |
Check if this transformation can be safely applied.
| builder | The SDFG builder |
| analysis_manager | The analysis manager providing necessary analyses |
Implements sdfg::transformations::Transformation.
|
static |
|
overridevirtual |
Get the name of this transformation.
Implements sdfg::transformations::Transformation.
|
overridevirtual |
Serialize this transformation to JSON.
| j | JSON object to populate with transformation description |
| std::logic_error | if not implemented |
Implements sdfg::transformations::Transformation.