Skip to content
Snippets Groups Projects
Commit 01d36382 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Don't use local classes in C AST (not picklable)

parent 24446d10
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ import six ...@@ -29,6 +29,7 @@ import six
import numpy as np # noqa import numpy as np # noqa
from loopy.target import TargetBase, ASTBuilderBase, DummyHostASTBuilder from loopy.target import TargetBase, ASTBuilderBase, DummyHostASTBuilder
from loopy.diagnostic import LoopyError from loopy.diagnostic import LoopyError
from cgen import Pointer
from pytools import memoize_method from pytools import memoize_method
...@@ -176,6 +177,12 @@ class CTarget(TargetBase): ...@@ -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): class CASTBuilder(ASTBuilderBase):
# {{{ library # {{{ library
...@@ -238,12 +245,7 @@ class CASTBuilder(ASTBuilderBase): ...@@ -238,12 +245,7 @@ class CASTBuilder(ASTBuilderBase):
base_storage_to_scope = {} base_storage_to_scope = {}
base_storage_to_align_bytes = {} base_storage_to_align_bytes = {}
from cgen import ArrayOf, Pointer, Initializer, AlignedAttribute, Value, Line from cgen import ArrayOf, 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)
for tv in sorted( for tv in sorted(
six.itervalues(kernel.temporary_variables), six.itervalues(kernel.temporary_variables),
...@@ -286,8 +288,8 @@ class CASTBuilder(ASTBuilderBase): ...@@ -286,8 +288,8 @@ class CASTBuilder(ASTBuilderBase):
# not use them to shovel data from one representation to the # not use them to shovel data from one representation to the
# other. That counts, right? # other. That counts, right?
cast_decl = ConstRestrictPointer(cast_decl) cast_decl = _ConstRestrictPointer(cast_decl)
temp_var_decl = ConstRestrictPointer(temp_var_decl) temp_var_decl = _ConstRestrictPointer(temp_var_decl)
cast_tp, cast_d = cast_decl.get_decl_pair() cast_tp, cast_d = cast_decl.get_decl_pair()
temp_var_decl = Initializer( temp_var_decl = Initializer(
......
...@@ -32,4 +32,4 @@ except ImportError: ...@@ -32,4 +32,4 @@ except ImportError:
else: else:
_islpy_version = islpy.version.VERSION_TEXT _islpy_version = islpy.version.VERSION_TEXT
DATA_MODEL_VERSION = "v31-islpy%s" % _islpy_version DATA_MODEL_VERSION = "v32-islpy%s" % _islpy_version
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment