Variable expression (access to local/global variables or parameters)
| 244 | |
| 245 | |
| 246 | class Var(Expr): |
| 247 | """Variable expression (access to local/global variables or parameters)""" |
| 248 | |
| 249 | def __init__(self, name: str, expr_type: LLType, defining_stmt=None, is_shared: bool = False, |
| 250 | is_global: bool = False): |
| 251 | super().__init__(expr_type) |
| 252 | self.name = name # Variable name |
| 253 | self.defining_stmt = defining_stmt |
| 254 | self.is_shared = is_shared # Whether it's a __shared__ variable |
| 255 | self.is_global = is_global # Whether it's a __device__ global variable |
| 256 | |
| 257 | def __repr__(self) -> str: |
| 258 | return f"Var(name={self.name}, type={self.type}, shared={self.is_shared}, global={self.is_global})" |
| 259 | |
| 260 | def __str__(self) -> str: |
| 261 | return f"Var(name={self.name}, type={self.type}, shared={self.is_shared}, global={self.is_global})" |
| 262 | |
| 263 | |
| 264 | # Unary |
no outgoing calls