Bigint
bigint
Dialect for unlimited precision integers with Python int semantics.
bigint = BigIntegerType()
module-attribute
BigInt = Dialect('bigint', [ConstantOp, TruncateToIntOp, AddOp, SubOp, MulOp, FloorDivOp, ModOp, PowOp, LShiftOp, RShiftOp, BitOrOp, BitXorOp, BitAndOp, DivOp, EqOp, NeqOp, GtOp, GteOp, LtOp, LteOp], [BigIntegerType])
module-attribute
BigIntegerType
dataclass
Bases: ParametrizedAttribute, TypeAttribute
Type for unlimited precision integers, with Python int semantics.
Source code in xdsl/dialects/bigint.py
35 36 37 38 39 | |
name = 'bigint.bigint'
class-attribute
instance-attribute
BinaryOperation
Bases: IRDLOperation, ABC
Binary operation where all operands and results are bigints.
Source code in xdsl/dialects/bigint.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
lhs = operand_def(bigint)
class-attribute
instance-attribute
rhs = operand_def(bigint)
class-attribute
instance-attribute
result = result_def(bigint)
class-attribute
instance-attribute
assembly_format = '$lhs `,` $rhs attr-dict `:` type($result)'
class-attribute
instance-attribute
__init__(operand1: Operation | SSAValue, operand2: Operation | SSAValue)
Source code in xdsl/dialects/bigint.py
54 55 56 57 58 59 | |
ConstantOp
Bases: IRDLOperation
Source code in xdsl/dialects/bigint.py
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 | |
name = 'bigint.constant'
class-attribute
instance-attribute
result = result_def(bigint)
class-attribute
instance-attribute
value = prop_def(IntAttr)
class-attribute
instance-attribute
traits = traits_def(ConstantLike(), HasFolder(), Pure())
class-attribute
instance-attribute
parse(parser: Parser)
classmethod
Source code in xdsl/dialects/bigint.py
70 71 72 73 74 | |
print(printer: Printer)
Source code in xdsl/dialects/bigint.py
76 77 78 79 80 81 | |
__init__(value: IntAttr | int, attrs: dict[str, Attribute] | None = None)
Source code in xdsl/dialects/bigint.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
fold() -> Sequence[SSAValue | Attribute] | None
Source code in xdsl/dialects/bigint.py
98 99 | |
TruncateToIntOp
Bases: IRDLOperation
Source code in xdsl/dialects/bigint.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
name = 'bigint.truncate_to_int'
class-attribute
instance-attribute
result = result_def(IntegerType)
class-attribute
instance-attribute
value = operand_def(bigint)
class-attribute
instance-attribute
traits = traits_def(Pure())
class-attribute
instance-attribute
assembly_format = '$value attr-dict `:` type($result)'
class-attribute
instance-attribute
__init__(value: Operation | SSAValue, type: IntegerType = IntegerType(64))
Source code in xdsl/dialects/bigint.py
112 113 114 115 116 117 | |
AddOp
dataclass
Bases: BinaryOperation
Add two bigints.
Source code in xdsl/dialects/bigint.py
120 121 122 123 124 125 126 127 128 129 130 | |
name = 'bigint.add'
class-attribute
instance-attribute
traits = traits_def(Pure(), Commutative(), SameOperandsAndResultType())
class-attribute
instance-attribute
SubOp
dataclass
Bases: BinaryOperation
Subtract two bigints.
Source code in xdsl/dialects/bigint.py
133 134 135 136 137 138 139 140 141 142 143 | |
name = 'bigint.sub'
class-attribute
instance-attribute
traits = traits_def(Pure(), Commutative(), SameOperandsAndResultType())
class-attribute
instance-attribute
MulOp
dataclass
Bases: BinaryOperation
Multiply two bigints.
Source code in xdsl/dialects/bigint.py
146 147 148 149 150 151 152 153 154 155 156 | |
name = 'bigint.mul'
class-attribute
instance-attribute
traits = traits_def(Pure(), Commutative(), SameOperandsAndResultType())
class-attribute
instance-attribute
FloorDivOp
dataclass
Bases: BinaryOperation
Floor divide two bigints, rounding down to the nearest integer.
Source code in xdsl/dialects/bigint.py
159 160 161 162 163 164 165 166 167 168 | |
name = 'bigint.floordiv'
class-attribute
instance-attribute
traits = traits_def(Pure(), SameOperandsAndResultType())
class-attribute
instance-attribute
ModOp
dataclass
Bases: BinaryOperation
Modulo two bigints, taking the sign of the divisor.
Source code in xdsl/dialects/bigint.py
171 172 173 174 175 176 177 178 179 180 | |
name = 'bigint.mod'
class-attribute
instance-attribute
traits = traits_def(Pure(), SameOperandsAndResultType())
class-attribute
instance-attribute
PowOp
dataclass
Bases: BinaryOperation
Exponentiate a bigint by another.
Source code in xdsl/dialects/bigint.py
183 184 185 186 187 188 189 190 191 192 | |
name = 'bigint.pow'
class-attribute
instance-attribute
traits = traits_def(Pure(), SameOperandsAndResultType())
class-attribute
instance-attribute
LShiftOp
dataclass
Bases: BinaryOperation
Left shift a bigint by another.
Source code in xdsl/dialects/bigint.py
195 196 197 198 199 200 201 202 203 204 | |
name = 'bigint.lshift'
class-attribute
instance-attribute
traits = traits_def(Pure(), SameOperandsAndResultType())
class-attribute
instance-attribute
RShiftOp
dataclass
Bases: BinaryOperation
Right shift a bigint by another.
Source code in xdsl/dialects/bigint.py
207 208 209 210 211 212 213 214 215 216 | |
name = 'bigint.rshift'
class-attribute
instance-attribute
traits = traits_def(Pure(), SameOperandsAndResultType())
class-attribute
instance-attribute
BitOrOp
dataclass
Bases: BinaryOperation
Bitwise OR a bigint with another.
Source code in xdsl/dialects/bigint.py
219 220 221 222 223 224 225 226 227 228 229 | |
name = 'bigint.bitor'
class-attribute
instance-attribute
traits = traits_def(Pure(), Commutative(), SameOperandsAndResultType())
class-attribute
instance-attribute
BitXorOp
dataclass
Bases: BinaryOperation
Bitwise XOR a bigint with another.
Source code in xdsl/dialects/bigint.py
232 233 234 235 236 237 238 239 240 241 242 | |
name = 'bigint.bitxor'
class-attribute
instance-attribute
traits = traits_def(Pure(), Commutative(), SameOperandsAndResultType())
class-attribute
instance-attribute
BitAndOp
dataclass
Bases: BinaryOperation
Bitwise AND a bigint with another.
Source code in xdsl/dialects/bigint.py
245 246 247 248 249 250 251 252 253 254 255 | |
name = 'bigint.bitand'
class-attribute
instance-attribute
traits = traits_def(Pure(), Commutative(), SameOperandsAndResultType())
class-attribute
instance-attribute
DivOp
Bases: IRDLOperation
Divide two bigints, yielding a 64-bit floating point type.
Note that this operation follows Python semantics, for example by rounding to minus infinity.
Source code in xdsl/dialects/bigint.py
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 | |
name = 'bigint.div'
class-attribute
instance-attribute
lhs = operand_def(bigint)
class-attribute
instance-attribute
rhs = operand_def(bigint)
class-attribute
instance-attribute
result = result_def(f64)
class-attribute
instance-attribute
assembly_format = '$lhs `,` $rhs attr-dict `:` type($result)'
class-attribute
instance-attribute
traits = traits_def(Pure())
class-attribute
instance-attribute
__init__(operand1: Operation | SSAValue, operand2: Operation | SSAValue)
Source code in xdsl/dialects/bigint.py
278 279 280 281 282 283 | |
ComparisonOperation
Bases: IRDLOperation, ABC
Binary operation comparing two bigints and returning a boolean.
Source code in xdsl/dialects/bigint.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
lhs = operand_def(bigint)
class-attribute
instance-attribute
rhs = operand_def(bigint)
class-attribute
instance-attribute
result = result_def(i1)
class-attribute
instance-attribute
assembly_format = '$lhs `,` $rhs attr-dict `:` type($result)'
class-attribute
instance-attribute
__init__(operand1: Operation | SSAValue, operand2: Operation | SSAValue)
Source code in xdsl/dialects/bigint.py
295 296 297 298 299 300 | |
EqOp
dataclass
Bases: ComparisonOperation
Check equality of two bigints.
Source code in xdsl/dialects/bigint.py
303 304 305 306 307 308 309 310 311 312 | |
name = 'bigint.eq'
class-attribute
instance-attribute
traits = traits_def(Pure(), Commutative())
class-attribute
instance-attribute
NeqOp
dataclass
Bases: ComparisonOperation
Check inequality of two bigints.
Source code in xdsl/dialects/bigint.py
315 316 317 318 319 320 321 322 323 324 | |
name = 'bigint.neq'
class-attribute
instance-attribute
traits = traits_def(Pure(), Commutative())
class-attribute
instance-attribute
GtOp
dataclass
Bases: ComparisonOperation
Check if one bigint is greater than another.
Source code in xdsl/dialects/bigint.py
327 328 329 330 331 332 333 334 335 | |
name = 'bigint.gt'
class-attribute
instance-attribute
traits = traits_def(Pure())
class-attribute
instance-attribute
GteOp
dataclass
Bases: ComparisonOperation
Check if one bigint is greater than or equal to another.
Source code in xdsl/dialects/bigint.py
338 339 340 341 342 343 344 345 346 | |
name = 'bigint.gte'
class-attribute
instance-attribute
traits = traits_def(Pure())
class-attribute
instance-attribute
LtOp
dataclass
Bases: ComparisonOperation
Check if one bigint is less than another.
Source code in xdsl/dialects/bigint.py
349 350 351 352 353 354 355 356 357 | |
name = 'bigint.lt'
class-attribute
instance-attribute
traits = traits_def(Pure())
class-attribute
instance-attribute
LteOp
dataclass
Bases: ComparisonOperation
Check if one bigint is less than or equal to another.
Source code in xdsl/dialects/bigint.py
360 361 362 363 364 365 366 367 368 | |