Short integer literal. Integer literals are treated as constant values and are generally not included in data flow analyses and such, unlike Register and Op subclasses. Integer can represent multiple types: * Short tagged integers (short_int_primitive type; the tag bit is cle
| 192 | |
| 193 | @final |
| 194 | class Integer(Value): |
| 195 | """Short integer literal. |
| 196 | |
| 197 | Integer literals are treated as constant values and are generally |
| 198 | not included in data flow analyses and such, unlike Register and |
| 199 | Op subclasses. |
| 200 | |
| 201 | Integer can represent multiple types: |
| 202 | |
| 203 | * Short tagged integers (short_int_primitive type; the tag bit is clear) |
| 204 | * Ordinary fixed-width integers (e.g., int32_rprimitive) |
| 205 | * Values of other unboxed primitive types that are represented as integers |
| 206 | (none_rprimitive, bool_rprimitive) |
| 207 | * Null pointers (value 0) of various types, including object_rprimitive |
| 208 | """ |
| 209 | |
| 210 | def __init__(self, value: int, rtype: RType = short_int_rprimitive, line: int = -1) -> None: |
| 211 | if is_short_int_rprimitive(rtype) or is_int_rprimitive(rtype): |
| 212 | self.value = value * 2 |
| 213 | else: |
| 214 | self.value = value |
| 215 | self.type = rtype |
| 216 | self.line = line |
| 217 | |
| 218 | def numeric_value(self) -> int: |
| 219 | if is_short_int_rprimitive(self.type) or is_int_rprimitive(self.type): |
| 220 | return self.value // 2 |
| 221 | return self.value |
| 222 | |
| 223 | |
| 224 | @final |
no outgoing calls
searching dependent graphs…