-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmarkers.py
More file actions
754 lines (609 loc) · 23.3 KB
/
markers.py
File metadata and controls
754 lines (609 loc) · 23.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
from __future__ import annotations
import re
from abc import ABC, abstractmethod
from dataclasses import dataclass, fields, replace
from re import Pattern
from typing import Any, Sequence
@dataclass(frozen=True)
class Marker(ABC):
name: str
id: int
def __post_init__(self) -> None:
"""Check that self.marker is a valid DCEMarker"""
assert self.name.startswith(type(self).prefix())
assert self.name[-1] == "_"
assert self.id >= 0
@classmethod
@abstractmethod
def prefix(cls) -> str:
raise NotImplementedError
@abstractmethod
def macro(self) -> str:
raise NotImplementedError
@abstractmethod
def macro_without_arguments(self) -> str:
"""Returns the preprocessor macro that can
be defined before compiling the program
without its arguments (if any)
"""
raise NotImplementedError
def marker_statement_prefix(self) -> str:
return ""
def marker_statement_postfix(self) -> str:
return ""
def parse_tracked_output_for_refinement(self, output: Sequence[str]) -> Marker:
raise RuntimeError("This should never be called, DCEMarkers cannot be refined")
@abstractmethod
def to_json_dict(self) -> dict[str, Any]:
raise NotImplementedError
@staticmethod
def from_json_dict(j: dict[str, Any]) -> Marker:
match j["kind"]:
case "DCEMarker":
return DCEMarker.from_json_dict(j)
case "VRMarker":
return VRMarker.from_json_dict(j)
case _:
raise ValueError(f"Unknown marker kind {j['kind']}")
def update_id(self, new_id: int) -> Marker:
return replace(
self, name=self.name.replace(str(self.id), str(new_id)), id=new_id
)
@dataclass(frozen=True)
class DCEMarker(Marker):
"""A dead code elimination marker DCEMarkerX_, where X is an
integer.
"""
@staticmethod
def from_str(marker_str: str) -> DCEMarker:
"""Parsers a string of the form DCEMarkerX_
Returns:
DCEMarker:
the parsed marker
"""
assert marker_str.startswith(DCEMarker.prefix())
marker_id = int(marker_str[len(DCEMarker.prefix()) : -1])
return DCEMarker(marker_str, marker_id)
@classmethod
def prefix(cls) -> str:
return "DCEMarker"
def macro(self) -> str:
"""Returns the preprocessor macro that can
be defined before compiling the program
Returns:
str:
DCEMARKERMACROX_
"""
return f"DCEMARKERMACRO{self.name[len(DCEMarker.prefix()):]}"
def macro_without_arguments(self) -> str:
"""Same as self.macro()"""
return self.macro()
def to_json_dict(self) -> dict[str, Any]:
j = {"kind": "DCEMarker", "name": self.name, "id": self.id}
assert set(j.keys()) == set(field.name for field in fields(self)) | set(
("kind",)
)
return j
@staticmethod
def from_json_dict(j: dict[str, Any]) -> DCEMarker:
assert j["kind"] == "DCEMarker"
return DCEMarker(name=j["name"], id=j["id"])
@dataclass(frozen=True)
class VRMarker(Marker):
"""
A value range marker VRMarkerX_, where X is an
integer. VR markers enable range checks via dead
code elimination:
if (!( LowerBound <= var LowerBound && var <= UpperBound))
VRMarkerX_();
The marker is dead if `var` in [LowerBound, UpperBound].
Attributes:
marker(str): the marker in the VRMarkerX_ form
id (int): the id of the marker
variable_type (str): the type of the instrumented variable
lower_bound (int): the lower bound of the range (inclusive)
upper_bound (int): the upper bound of the range (inclusive)
"""
variable_type: str
lower_bound: int = 0
upper_bound: int = 0
def __post_init__(self) -> None:
assert self.lower_bound <= self.upper_bound
@classmethod
def prefix(cls) -> str:
return "VRMarker"
@classmethod
def macroprefix(cls) -> str:
return "VRMARKERMACRO"
@staticmethod
def from_str(marker_str: str, variable_type: str) -> VRMarker:
"""Parsers a string of the form VRMarkerX_
Returns:
VRMarker:
the parsed marker
"""
assert marker_str.startswith(VRMarker.prefix())
marker_id = int(marker_str[len(VRMarker.prefix()) : -1])
return VRMarker(marker_str, marker_id, variable_type)
def macro(self) -> str:
"""Returns the preprocessor macro that can
be defined before compiling the program
Returns:
str:
VRMARKERMACROX_(VAR, TYPE)
"""
return f"{self.macro_without_arguments()}(VAR, TYPE)"
def macro_without_arguments(self) -> str:
"""Returns the preprocessor macro that can
be defined before compiling the program
without its arguments
Returns:
str:
VRMARKERMACROX_
"""
return f"{VRMarker.macroprefix()}{self.id}_"
def marker_statement_prefix(self) -> str:
return (
f"if (!(((VAR) >= {self.lower_bound}) && ((VAR) <= {self.upper_bound}))) "
"{ "
)
def marker_statement_postfix(self) -> str:
return " }"
def parse_tracked_output_for_refinement(self, output: Sequence[str]) -> Marker:
lbs = []
ubs = []
for line in output:
line = line.strip()
assert line.startswith(self.name)
lb, ub = line.split(":")[1].split("/")
lbs.append(int(lb))
ubs.append(int(ub))
assert lbs
assert ubs
return VRMarker(self.name, self.id, self.variable_type, min(lbs), max(ubs))
def get_variable_name_and_type(self, instrumented_code: str) -> tuple[str, str]:
"""Returns the name and type of the instrumented variable.
The marker macro must appear only once in the instrumented code.
Args:
instrumented_code (str):
the instrumented code containing the marker
Returns:
tuple[str, str]:
the name and type
"""
macro = self.macro_without_arguments()
reg = re.compile(rf"{macro}\((?P<name>[^,]+),\s*(?P<type>[^)]+)\)")
matches = [match for match in reg.finditer(instrumented_code)]
assert (
len(matches) == 1
), f"Expected exactly one match for {macro} in {instrumented_code}"
match = matches[0]
return match.group("name"), match.group("type")
def number_occurences_in_code(self, instrumented_code: str) -> int:
"""Returns number of types a marker appears in the instrumented code.
This is useful, e.g., when reducing a program and a marker is duplicated.
Args:
instrumented_code (str):
the instrumented code containing the marker
Returns:
int:
the number of occurences
"""
macro = self.macro_without_arguments()
reg = re.compile(f"{macro}")
return len(reg.findall(instrumented_code))
def to_json_dict(self) -> dict[str, Any]:
j = {
"kind": "VRMarker",
"name": self.name,
"id": self.id,
"variable_type": self.variable_type,
"lower_bound": self.lower_bound,
"upper_bound": self.upper_bound,
}
assert set(j.keys()) == set(field.name for field in fields(self)) | set(
("kind",)
)
return j
@staticmethod
def from_json_dict(j: dict[str, Any]) -> VRMarker:
assert j["kind"] == "VRMarker"
return VRMarker(
name=j["name"],
id=j["id"],
variable_type=j["variable_type"],
lower_bound=j["lower_bound"],
upper_bound=j["upper_bound"],
)
MarkerTypes = (DCEMarker, VRMarker)
@dataclass
class MarkerDirectiveEmitter(ABC):
def emit_directive(self, marker: Marker) -> str:
raise NotImplementedError
def __eq__(self, other: object) -> bool:
if not isinstance(other, MarkerDirectiveEmitter):
return NotImplemented
return isinstance(other, self.__class__)
@staticmethod
def from_json_dict(j: dict[str, Any]) -> MarkerDirectiveEmitter:
match j["kind"]:
case "EnableEmitter":
strategy = MarkerDetectionStrategy.from_json_dict(j["strategy"])
return EnableEmitter(strategy)
case "DisableEmitter":
return DisableEmitter()
case "UnreachableEmitter":
return UnreachableEmitter()
case "AbortEmitter":
return AbortEmitter()
case "TrackingEmitter":
return TrackingEmitter()
case "TrackingForRefinementEmitter":
return TrackingForRefinementEmitter()
case _:
raise ValueError(f"Unknown kind {j['kind']}")
def to_json_dict(self) -> dict[str, Any]:
name = self.__class__.__name__
assert name in (
"EnableEmitter",
"DisableEmitter",
"UnreachableEmitter",
"AbortEmitter",
"TrackingEmitter",
"TrackingForRefinementEmitter",
), self
j: dict[str, Any] = {"kind": name}
if isinstance(self, EnableEmitter):
j["strategy"] = self.strategy.to_json_dict()
return j
@dataclass
class NoEmitter(MarkerDirectiveEmitter):
def emit_directive(self, marker: Marker) -> str:
return ""
@dataclass
class EnableEmitter(MarkerDirectiveEmitter):
strategy: MarkerDetectionStrategy
# def __eq__(self, other: object) -> bool:
# if not isinstance(other, MarkerDirectiveEmitter):
# return NotImplemented
# return isinstance(other, EnableEmitter) and self.strategy == other.strategy
def emit_directive(self, marker: Marker) -> str:
return f"""{self.strategy.definitions_and_declarations(marker)}
#define {marker.macro()} \
{marker.marker_statement_prefix()} \
{self.strategy.make_macro_definition(marker)} \
{marker.marker_statement_postfix()}
"""
@dataclass
class DisableEmitter(MarkerDirectiveEmitter):
def emit_directive(self, marker: Marker) -> str:
return f"#define {marker.macro()} ;"
@dataclass
class UnreachableEmitter(MarkerDirectiveEmitter):
def emit_directive(self, marker: Marker) -> str:
return f"""#define {marker.macro()} \
{marker.marker_statement_prefix()}__builtin_unreachable();{marker.marker_statement_postfix()}
"""
@dataclass
class AbortEmitter(MarkerDirectiveEmitter):
def emit_directive(self, marker: Marker) -> str:
return f"""#define {marker.macro()} \
{marker.marker_statement_prefix()} \
__builtin_printf("BUG\\n"); \
__builtin_abort(); \
{marker.marker_statement_postfix()}
"""
@dataclass
class TrackingEmitter(MarkerDirectiveEmitter):
def emit_directive(self, marker: Marker) -> str:
return f""" int {marker.name}_ENCOUNTERED = 0;
__attribute__((destructor))
void {marker.name}_print() {{
if ({marker.name}_ENCOUNTERED == 1) {{
__builtin_printf("{marker.name}\\n");
}}
}}
#define {marker.macro()} \
{marker.marker_statement_prefix()} \
{marker.name}_ENCOUNTERED = 1; \
{marker.marker_statement_postfix()}
"""
@dataclass
class TrackingForRefinementEmitter(MarkerDirectiveEmitter):
def emit_directive(self, marker: Marker) -> str:
match marker:
case DCEMarker():
return f"#define {marker.macro()} "
case VRMarker():
format_specifier = {
"bool": "%d",
"char": "%d",
"short": "%hd",
"int": "%d",
"long": "%ld",
"long long": "%lld",
"unsigned char": "%u",
"unsigned short": "%hu",
"unsigned int": "%u",
"unsigned long": "%lu",
"unsigned long long": "%llu",
}[marker.variable_type]
variable_type = (
marker.variable_type if marker.variable_type != "bool" else "int"
)
return f"""
int {marker.name}_ENCOUNTERED = 0;
{variable_type} {marker.name}_LB;
{variable_type} {marker.name}_UB;
void track_{marker.name}({variable_type} v) {{
if (!{marker.name}_ENCOUNTERED) {{
{marker.name}_LB = v;
{marker.name}_UB = v;
{marker.name}_ENCOUNTERED = 1;
return;
}}
if (v < {marker.name}_LB) {{
{marker.name}_LB = v;
}}
if (v > {marker.name}_UB) {{
{marker.name}_UB = v;
}}
}}
__attribute__((destructor))
void {marker.name}_print() {{
if ({marker.name}_ENCOUNTERED == 1) {{
__builtin_printf(
"<MarkerTracking>{marker.name}:{format_specifier}/{format_specifier}</MarkerTracking>\\n",
{marker.name}_LB, {marker.name}_UB);
}}
}}
#define {marker.macro()} \
track_{marker.name}(VAR);
"""
case _:
raise ValueError(f"Unsupported marker type {type(marker)}")
class MarkerDetectionStrategy(ABC):
"""The base class of all marker strategies used for detecting Markers.
Subclasses of MarkerDetectionStrategy are used to specify what kind of
marker preprocessor directives should be generated by
`Instrumenter.with_marker_strategy`.
"""
@staticmethod
@abstractmethod
def name() -> str:
"""Returns the name of the marker strategy
Returns:
str:
the name
"""
raise NotImplementedError
@staticmethod
@abstractmethod
def definitions_and_declarations(marker: Marker) -> str:
"""Returns any definitions and declarations
necessary for this marker strategy
Args:
marker (Marker):
the marker for which the macro definition code should be generated
Returns:
str:
the definitions and declarations
"""
raise NotImplementedError
@staticmethod
@abstractmethod
def make_macro_definition(marker: Marker) -> str:
"""Generates the macro definition for the marker
Args:
marker (Marker):
the marker for which the macro definition code should be generated
Returns:
str:
the marker macro defition
"""
raise NotImplementedError
@staticmethod
@abstractmethod
def marker_detection_regex() -> re.Pattern[str]:
"""Returns a pattern of the regex used to detect markers of this strategy
Returns:
re.Pattern[str]:
the regex pattern
"""
raise NotImplementedError
@staticmethod
@abstractmethod
def regex_marker_id_group_index() -> int:
"""Returns the index of the group in the regex, generated by
marker_detection_regex(), containing the marker id
Returns:
int:
the index of the id group
"""
raise NotImplementedError
def detect_marker_id(self, asm_line: str) -> int | None:
if m := self.marker_detection_regex().match(asm_line.strip()):
idx = self.regex_marker_id_group_index()
return int(m.group(idx))
return None
def to_json_dict(self) -> dict[str, Any]:
return {"kind": self.name()}
def __eq__(self, other: object) -> bool:
if not isinstance(other, MarkerDetectionStrategy):
return NotImplemented
return type(self) is type(other)
@staticmethod
def from_json_dict(j: dict[str, Any]) -> MarkerDetectionStrategy:
match j["kind"]:
case "Function Call":
return FunctionCallDetectionStrategy()
case "Asm Comment":
return AsmCommentDetectionStrategy()
case "Asm Comment Empty Operands":
return AsmCommentEmptyOperandsDetectionStrategy()
case "Asm Comment Local Out Operand":
return AsmCommentLocalOutOperandDetectionStrategy()
case "Asm Comment Global Out Operand":
return AsmCommentGlobalOutOperandDetectionStrategy()
case "Asm Comment Volatile Global Out Operand":
return AsmCommentVolatileGlobalOutOperandDetectionStrategy()
case "Asm Comment Static Volatile Global Out Operand":
return AsmCommentStaticVolatileGlobalOutOperandDetectionStrategy()
case "Local Volatile Int":
return LocalVolatileIntDetectionStrategy()
case "Global Int":
return GlobalIntDetectionStrategy()
case "Static Volatile Global Int":
return StaticVolatileGlobalIntDetectionStrategy()
case "Global Volatile Int":
return GlobalVolatileIntDetectionStrategy()
case _:
raise ValueError(f"Unknown marker strategy {j['kind']}")
def marker_prefixes() -> tuple[str, ...]:
prefixes = []
for marker_type in MarkerTypes:
prefix = marker_type.prefix() # type: ignore
assert isinstance(prefix, str)
prefixes.append(prefix)
return tuple(prefixes)
class FunctionCallDetectionStrategy(MarkerDetectionStrategy):
@staticmethod
def name() -> str:
return "Function Call"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
return f"void {marker.name}(void);"
@staticmethod
def make_macro_definition(marker: Marker) -> str:
return f"{marker.name}();"
@staticmethod
def marker_detection_regex() -> re.Pattern[str]:
# (call|j[a-z]{1,2}) checks that the instruction either starts with
# call or j and two letters (thus, including conditional
# and uncoditional jumps)
return re.compile(
f".*(call|j[a-z]{{1,2}}).*({'|'.join(marker_prefixes())})([0-9]+)_.*"
)
@staticmethod
def regex_marker_id_group_index() -> int:
return 3
class AsmCommentDetectionStrategy(MarkerDetectionStrategy):
@staticmethod
def name() -> str:
return "Asm Comment"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
return ""
@staticmethod
def make_macro_definition(marker: Marker) -> str:
return f'asm("# {marker.name}");'
@staticmethod
def marker_detection_regex() -> Pattern[str]:
return re.compile(f".*\\#.*({'|'.join(marker_prefixes())})([0-9]+)_.*")
@staticmethod
def regex_marker_id_group_index() -> int:
return 2
class AsmCommentEmptyOperandsDetectionStrategy(AsmCommentDetectionStrategy):
@staticmethod
def name() -> str:
return "Asm Comment Empty Operands"
@staticmethod
def make_macro_definition(marker: Marker) -> str:
return f'asm("# {marker.name}" :::);'
class AsmCommentLocalOutOperandDetectionStrategy(AsmCommentDetectionStrategy):
@staticmethod
def name() -> str:
return "Asm Comment Local Out Operand"
@staticmethod
def make_macro_definition(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
return (
f"{{volatile int {variable_name};"
+ f'asm("# {marker.name}" : "=r" ({variable_name}));}}'
)
class AsmCommentGlobalOutOperandDetectionStrategy(AsmCommentDetectionStrategy):
@staticmethod
def name() -> str:
return "Asm Comment Global Out Operand"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
return f"int {variable_name};"
@staticmethod
def make_macro_definition(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
return f'asm("# {marker.name}" : "=r" ({variable_name}));'
class AsmCommentVolatileGlobalOutOperandDetectionStrategy(
AsmCommentGlobalOutOperandDetectionStrategy
):
@staticmethod
def name() -> str:
return "Asm Comment Volatile Global Out Operand"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
return f"volatile int {variable_name};"
class AsmCommentStaticVolatileGlobalOutOperandDetectionStrategy(
AsmCommentGlobalOutOperandDetectionStrategy
):
@staticmethod
def name() -> str:
return "Asm Comment Static Volatile Global Out Operand"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
return f"static volatile int {variable_name};"
class LocalVolatileIntDetectionStrategy(MarkerDetectionStrategy):
@staticmethod
def name() -> str:
return "Local Volatile Int"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
return ""
@staticmethod
def make_macro_definition(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
magic_int = f"1234123{marker.id}"
return f"volatile int {variable_name} = {magic_int};"
@staticmethod
def marker_detection_regex() -> Pattern[str]:
# need to disambiguate between marker types
return re.compile(".*movl.*\\$1234123([0-9]+),.*")
@staticmethod
def regex_marker_id_group_index() -> int:
return 1
class GlobalIntDetectionStrategy(MarkerDetectionStrategy):
@staticmethod
def name() -> str:
return "Global Int"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
return f"int {variable_name};"
@staticmethod
def make_macro_definition(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
magic_int = f"1234123{marker.id}"
return f"{variable_name} = {magic_int};"
@staticmethod
def marker_detection_regex() -> Pattern[str]:
return re.compile(".*movl.*\\$1234123([0-9]+),.*")
@staticmethod
def regex_marker_id_group_index() -> int:
return 1
class GlobalVolatileIntDetectionStrategy(GlobalIntDetectionStrategy):
@staticmethod
def name() -> str:
return "Global Volatile Int"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
return f"volatile int {variable_name};"
class StaticVolatileGlobalIntDetectionStrategy(GlobalIntDetectionStrategy):
@staticmethod
def name() -> str:
return "Static Volatile Global Int"
@staticmethod
def definitions_and_declarations(marker: Marker) -> str:
variable_name = f"{marker.prefix()}_JUNK_VAR{marker.id}_"
return f"static volatile int {variable_name};"