A Register holds a value of a specific type, and it can be read and mutated. A Register is always local to a function. Each local variable maps to a Register, and they are also used for some (but not all) temporary values. Note that the term 'register' is overloaded and is sometime
| 165 | |
| 166 | @final |
| 167 | class Register(Value): |
| 168 | """A Register holds a value of a specific type, and it can be read and mutated. |
| 169 | |
| 170 | A Register is always local to a function. Each local variable maps |
| 171 | to a Register, and they are also used for some (but not all) |
| 172 | temporary values. |
| 173 | |
| 174 | Note that the term 'register' is overloaded and is sometimes used |
| 175 | to refer to arbitrary Values (for example, in RegisterOp). |
| 176 | """ |
| 177 | |
| 178 | def __init__(self, type: RType, name: str = "", is_arg: bool = False, line: int = -1) -> None: |
| 179 | self.type = type |
| 180 | self.name = name |
| 181 | self.is_arg = is_arg |
| 182 | self.is_borrowed = is_arg |
| 183 | self.line = line |
| 184 | |
| 185 | @property |
| 186 | def is_void(self) -> bool: |
| 187 | return False |
| 188 | |
| 189 | def __repr__(self) -> str: |
| 190 | return f"<Register {self.name!r} at {hex(id(self))}>" |
| 191 | |
| 192 | |
| 193 | @final |
no outgoing calls
searching dependent graphs…