|
docc 0.8.3 (0d44999b)
C++ API Reference
|
Loop rotation transformation to convert negative stride to positive stride. More...
#include <sdfg/transformations/loop_rotate.h>
Public Member Functions | |
| LoopRotate (structured_control_flow::StructuredLoop &loop) | |
| Construct a LoopRotate 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. | |
| const std::string & | rotated_container_name () const |
| Get the name of the container holding the rotated (original) value. | |
| 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 LoopRotate | from_json (builder::StructuredSDFGBuilder &builder, const nlohmann::json &j) |
Additional Inherited Members | |
| Protected Attributes inherited from sdfg::transformations::Transformation | |
| PassReportConsumer * | report_ = nullptr |
Loop rotation transformation to convert negative stride to positive stride.
This transformation reverses the iteration direction of a loop with negative stride.
Original loop (negative stride): for (i = init; bound < i; i -= 1) // or equivalently: i > bound body(i)
After LoopRotate: for (i = bound+1; i < init+1; i += 1) body(init + bound + 1 - i) // Transformed index
Example: // Original: i = 10, 9, 8, ..., 1 (while i > 0) for (i = 10; 0 < i; i–) A[i] = ...
// After rotation: i' = 1, 2, 3, ..., 10 for (i = 1; i < 11; i++) A[11 - i] = ... // 11-1=10, 11-2=9, ..., 11-10=1
Prerequisites:
Benefits:
|
explicit |
Construct a LoopRotate transformation.
| loop | The loop to rotate (must have negative 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.
|
inline |
Get the name of the container holding the rotated (original) value.
|
overridevirtual |
Serialize this transformation to JSON.
| j | JSON object to populate with transformation description |
| std::logic_error | if not implemented |
Implements sdfg::transformations::Transformation.