Skip to content

Commit 8b518f4

Browse files
committed
compiler: Add LocalType._C_tag
1 parent c125e7c commit 8b518f4

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
@@ -305,6 +305,9 @@ def _gen_value(self, obj, mode=1, masked=()):
305305
qualifiers = [v for k, v in self._qualifiers_mapper.items()
306306
if getattr(obj.function, k, False) and v not in masked]
307307

308+
if obj.is_LocalObject and mode == 2:
309+
qualifiers.extend(as_tuple(obj._C_tag))
310+
308311
if (obj._mem_stack or obj._mem_constant) and mode == 1:
309312
strtype = self.ccode(obj._C_typedata)
310313
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
@@ -1921,8 +1921,17 @@ def _mem_internal_lazy(self):
19211921
return self._liveness == 'lazy'
19221922

19231923
"""
1924-
A modifier added to the subclass C declaration when it appears
1925-
in a function signature. For example, a subclass might define `_C_modifier = '&'`
1924+
A modifier added to the declaration of the LocalType when it appears in a
1925+
function signature. For example, a subclass might define `_C_modifier = '&'`
19261926
to impose pass-by-reference semantics.
19271927
"""
19281928
_C_modifier = None
1929+
1930+
"""
1931+
One or more optional keywords added to the declaration of the LocalType
1932+
in between the type and the variable name when it appears in a function
1933+
signature. For example, some languages support these to modify the way
1934+
the compiler generates code for passing the parameter and how the
1935+
runtime accesses it.
1936+
"""
1937+
_C_tag = None

0 commit comments

Comments
 (0)