diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index d9f420405ad4c0905dd8c47554bb2cf1f24bd87f..493cef0634ea455f6a48c66e4cfbcb0da9b46572 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -29,6 +29,7 @@ import six import numpy as np # noqa from loopy.target import TargetBase, ASTBuilderBase, DummyHostASTBuilder from loopy.diagnostic import LoopyError +from cgen import Pointer from pytools import memoize_method @@ -176,6 +177,12 @@ class CTarget(TargetBase): # }}} +class _ConstRestrictPointer(Pointer): + def get_decl_pair(self): + sub_tp, sub_decl = self.subdecl.get_decl_pair() + return sub_tp, ("*const restrict %s" % sub_decl) + + class CASTBuilder(ASTBuilderBase): # {{{ library @@ -238,12 +245,7 @@ class CASTBuilder(ASTBuilderBase): base_storage_to_scope = {} base_storage_to_align_bytes = {} - from cgen import ArrayOf, Pointer, Initializer, AlignedAttribute, Value, Line - - class ConstRestrictPointer(Pointer): - def get_decl_pair(self): - sub_tp, sub_decl = self.subdecl.get_decl_pair() - return sub_tp, ("*const restrict %s" % sub_decl) + from cgen import ArrayOf, Initializer, AlignedAttribute, Value, Line for tv in sorted( six.itervalues(kernel.temporary_variables), @@ -286,8 +288,8 @@ class CASTBuilder(ASTBuilderBase): # not use them to shovel data from one representation to the # other. That counts, right? - cast_decl = ConstRestrictPointer(cast_decl) - temp_var_decl = ConstRestrictPointer(temp_var_decl) + cast_decl = _ConstRestrictPointer(cast_decl) + temp_var_decl = _ConstRestrictPointer(temp_var_decl) cast_tp, cast_d = cast_decl.get_decl_pair() temp_var_decl = Initializer( diff --git a/loopy/version.py b/loopy/version.py index 7aaa9ca7929dc8102ab94382e9cb9627c847dba6..ce1cf30894964e17a8831588d7aaac91b9cabb6a 100644 --- a/loopy/version.py +++ b/loopy/version.py @@ -32,4 +32,4 @@ except ImportError: else: _islpy_version = islpy.version.VERSION_TEXT -DATA_MODEL_VERSION = "v31-islpy%s" % _islpy_version +DATA_MODEL_VERSION = "v32-islpy%s" % _islpy_version