# loki.transformations.transform_region module

Collection of utility routines that provide transformations for code regions.

region_hoist(routine)

  Hoist one or multiple code regions annotated by pragma ranges and insert them at a specified target location.

  The pragma syntax for annotating the regions to hoist is `!$loki region-hoist [group(group-name)] [collapse(n) [promote(var-name, var-name, ...)]]` and `!$loki end region-hoist`. The optional `group(group-name)` can be provided when multiple regions are to be hoisted and inserted at different positions. Multiple pragma ranges can be specified for the same group, all of which are then moved to the target location in the same order as the pragma ranges appear. The optional `collapse(n)` parameter specifies that `n` enclosing scopes (such as loops, conditionals, etc.) should be re-created at the target location. Optionally, this can be combined with variable promotion using `promote(...)`.