Skip to content

Commit 22d82c3

Browse files
committed
compiler: Add LocalType._C_tag
1 parent f6b6ddd commit 22d82c3

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

devito/ir/iet/visitors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ def _gen_value(self, obj, mode=1, masked=()):
321321
qualifiers = [v for k, v in self._qualifiers_mapper.items()
322322
if getattr(obj.function, k, False) and v not in masked]
323323

324+
if obj.is_LocalObject and mode == 2:
325+
qualifiers.extend(as_tuple(obj._C_tag))
326+
324327
if (obj._mem_stack or obj._mem_constant) and mode == 1:
325328
strtype = self.ccode(obj._C_typedata)
326329
strshape = ''.join(f'[{self.ccode(i)}]' for i in obj.symbolic_shape)

devito/types/basic.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,8 +1937,17 @@ def _mem_internal_lazy(self):
19371937
return self._liveness == 'lazy'
19381938

19391939
"""
1940-
A modifier added to the subclass C declaration when it appears
1941-
in a function signature. For example, a subclass might define `_C_modifier = '&'`
1940+
A modifier added to the declaration of the LocalType when it appears in a
1941+
function signature. For example, a subclass might define `_C_modifier = '&'`
19421942
to impose pass-by-reference semantics.
19431943
"""
19441944
_C_modifier = None
1945+
1946+
"""
1947+
One or more optional keywords added to the declaration of the LocalType
1948+
in between the type and the variable name when it appears in a function
1949+
signature. For example, some languages support these to modify the way
1950+
the compiler generates code for passing the parameter and how the
1951+
runtime accesses it.
1952+
"""
1953+
_C_tag = None

0 commit comments

Comments
 (0)