Skip to content

Commit 8a44857

Browse files
committed
Armv8-M: add support for hints (required for memory annotations)
1 parent 3c5cf04 commit 8a44857

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

slothy/targets/arm_v81m/arch_v81m.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def __repr__(self):
6868
@staticmethod
6969
def is_renamed(ty):
7070
"""Indicate if register type should be subject to renaming"""
71+
if ty == RegisterType.HINT:
72+
return False
7173
return True
7274

7375
@staticmethod
@@ -99,21 +101,21 @@ def list_registers(
99101
gprs += gprs_extra
100102
vregs += vregs_extra
101103

102-
hints = (
103-
[f"t{i}" for i in range(100)]
104-
)
105-
106104
return {
107105
RegisterType.GPR: gprs,
108106
RegisterType.StackGPR: stack_locations,
109107
RegisterType.StackMVE: qstack_locations,
110108
RegisterType.MVE: vregs,
111-
RegisterType.HINT: hints,
109+
RegisterType.HINT: [],
112110
}[reg_type]
113111

114112
@staticmethod
115113
def find_type(r):
116114
"""Find type of architectural register"""
115+
116+
if r.startswith("hint_"):
117+
return RegisterType.HINT
118+
117119
for ty in RegisterType:
118120
if r in RegisterType.list_registers(ty):
119121
return ty
@@ -126,14 +128,15 @@ def from_string(string):
126128
"stack": RegisterType.StackGPR,
127129
"mve": RegisterType.MVE,
128130
"gpr": RegisterType.GPR,
131+
"hint": RegisterType.HINT,
129132
}.get(string, None)
130133

131134
def default_aliases():
132135
return {"lr": "r14"}
133136

134137
def default_reserved():
135138
"""Return the list of registers that should be reserved by default"""
136-
return set(["r13", "r14"])
139+
return set(["r13", "r14"] + RegisterType.list_registers(RegisterType.HINT))
137140

138141

139142
class LeLoop(Loop):

0 commit comments

Comments
 (0)