Class: LLVM::ConstantInt
- Defined in:
- lib/llvm/core/value.rb
Class Method Summary collapse
- .all_ones ⇒ Object
-
.from_i(n, signed = true) ⇒ Object
Creates a ConstantInt from an integer.
- .parse(str, radix = 10) ⇒ Object
Instance Method Summary collapse
-
#&(rhs) ⇒ Object
(also: #and)
Integer AND.
-
#*(rhs) ⇒ Object
(also: #mul)
Multiplication.
-
#+(rhs) ⇒ Object
(also: #add)
Addition.
-
#-(rhs) ⇒ Object
(also: #sub)
Subtraction.
-
#-@ ⇒ Object
(also: #neg)
Negation.
-
#/(rhs) ⇒ Object
Signed division.
-
#<<(bits) ⇒ Object
(also: #shl)
Shift left.
-
#>>(bits) ⇒ Object
(also: #shr)
Shift right.
-
#^(rhs) ⇒ Object
(also: #xor)
Integer XOR.
-
#ashr(bits) ⇒ Object
Arithmatic shift right.
-
#icmp(pred, rhs) ⇒ Object
Integer comparison using the predicate specified via the first parameter.
-
#int_to_ptr(type) ⇒ Object
Conversion to pointer.
-
#nsw_add(rhs) ⇒ Object
“No signed wrap” addition.
-
#nsw_mul(rhs) ⇒ Object
“No signed wrap” multiplication.
-
#nsw_neg ⇒ Object
“No signed wrap” negation.
-
#nsw_sub(rhs) ⇒ Object
“No signed wrap” subtraction.
-
#nuw_add(rhs) ⇒ Object
“No unsigned wrap” addition.
-
#nuw_mul(rhs) ⇒ Object
“No unsigned wrap” multiplication.
-
#nuw_neg ⇒ Object
“No unsigned wrap” negation.
-
#nuw_sub(rhs) ⇒ Object
“No unsigned wrap” subtraction.
-
#rem(rhs) ⇒ Object
Signed remainder.
-
#sext(type) ⇒ Object
constant sext.
-
#udiv(rhs) ⇒ Object
Unsigned division.
-
#urem(rhs) ⇒ Object
Unsigned remainder.
-
#zext(type) ⇒ Object
constant zext.
-
#|(rhs) ⇒ Object
(also: #or)
Integer OR.
-
#~@ ⇒ Object
Boolean negation.
Methods inherited from Constant
#bitcast_to, #gep, null, null_ptr, #ptr_to_int, undef
Methods inherited from User
Methods inherited from Value
#add_attribute, #constant?, #dump, from_ptr, #name, #name=, #null?, #remove_attribute, to_ptr, #to_s, #type, type, #undefined?
Methods included from PointerIdentity
Class Method Details
.all_ones ⇒ Object
324 325 326 |
# File 'lib/llvm/core/value.rb', line 324 def self.all_ones from_ptr(C.const_all_ones(type)) end |
.from_i(n, signed = true) ⇒ Object
Creates a ConstantInt from an integer.
329 330 331 |
# File 'lib/llvm/core/value.rb', line 329 def self.from_i(n, signed = true) from_ptr(C.const_int(type, n, signed ? 1 : 0)) end |
.parse(str, radix = 10) ⇒ Object
333 334 335 |
# File 'lib/llvm/core/value.rb', line 333 def self.parse(str, radix = 10) from_ptr(C.const_int_of_string(type, str, radix)) end |
Instance Method Details
#&(rhs) ⇒ Object Also known as: and
Integer AND.
433 434 435 |
# File 'lib/llvm/core/value.rb', line 433 def &(rhs) self.class.from_ptr(C.const_and(self, rhs)) end |
#*(rhs) ⇒ Object Also known as: mul
Multiplication.
389 390 391 |
# File 'lib/llvm/core/value.rb', line 389 def *(rhs) self.class.from_ptr(C.const_mul(self, rhs)) end |
#+(rhs) ⇒ Object Also known as: add
Addition.
355 356 357 |
# File 'lib/llvm/core/value.rb', line 355 def +(rhs) self.class.from_ptr(C.const_add(self, rhs)) end |
#-(rhs) ⇒ Object Also known as: sub
Subtraction.
372 373 374 |
# File 'lib/llvm/core/value.rb', line 372 def -(rhs) self.class.from_ptr(C.const_sub(self, rhs)) end |
#-@ ⇒ Object Also known as: neg
Negation.
338 339 340 |
# File 'lib/llvm/core/value.rb', line 338 def -@ self.class.from_ptr(C.const_neg(self)) end |
#/(rhs) ⇒ Object
Signed division.
411 412 413 |
# File 'lib/llvm/core/value.rb', line 411 def /(rhs) self.class.from_ptr(C.const_s_div(self, rhs)) end |
#<<(bits) ⇒ Object Also known as: shl
Shift left.
454 455 456 |
# File 'lib/llvm/core/value.rb', line 454 def <<(bits) self.class.from_ptr(C.const_shl(self, bits)) end |
#>>(bits) ⇒ Object Also known as: shr
Shift right.
461 462 463 |
# File 'lib/llvm/core/value.rb', line 461 def >>(bits) self.class.from_ptr(C.const_l_shr(self, bits)) end |
#^(rhs) ⇒ Object Also known as: xor
Integer XOR.
447 448 449 |
# File 'lib/llvm/core/value.rb', line 447 def ^(rhs) self.class.from_ptr(C.const_xor(self, rhs)) end |
#ashr(bits) ⇒ Object
Arithmatic shift right.
468 469 470 |
# File 'lib/llvm/core/value.rb', line 468 def ashr(bits) self.class.from_ptr(C.const_a_shr(self, bits)) end |
#icmp(pred, rhs) ⇒ Object
Integer comparison using the predicate specified via the first parameter. Predicate can be any of:
:eq - equal to
:ne - not equal to
:ugt - unsigned greater than
:uge - unsigned greater than or equal to
:ult - unsigned less than
:ule - unsigned less than or equal to
:sgt - signed greater than
:sge - signed greater than or equal to
:slt - signed less than
:sle - signed less than or equal to
484 485 486 |
# File 'lib/llvm/core/value.rb', line 484 def icmp(pred, rhs) self.class.from_ptr(C.const_i_cmp(pred, self, rhs)) end |
#int_to_ptr(type) ⇒ Object
Conversion to pointer.
489 490 491 |
# File 'lib/llvm/core/value.rb', line 489 def int_to_ptr(type) ConstantExpr.from_ptr(C.const_int_to_ptr(self, type)) end |
#nsw_add(rhs) ⇒ Object
“No signed wrap” addition.
362 363 364 |
# File 'lib/llvm/core/value.rb', line 362 def nsw_add(rhs) self.class.from_ptr(C.const_nsw_add(self, rhs)) end |
#nsw_mul(rhs) ⇒ Object
“No signed wrap” multiplication.
396 397 398 |
# File 'lib/llvm/core/value.rb', line 396 def nsw_mul(rhs) self.class.from_ptr(C.const_nsw_mul(self, rhs)) end |
#nsw_neg ⇒ Object
“No signed wrap” negation.
345 346 347 |
# File 'lib/llvm/core/value.rb', line 345 def nsw_neg self.class.from_ptr(C.const_nsw_neg(self)) end |
#nsw_sub(rhs) ⇒ Object
“No signed wrap” subtraction.
379 380 381 |
# File 'lib/llvm/core/value.rb', line 379 def nsw_sub(rhs) self.class.from_ptr(C.const_nsw_sub(self, rhs)) end |
#nuw_add(rhs) ⇒ Object
“No unsigned wrap” addition.
367 368 369 |
# File 'lib/llvm/core/value.rb', line 367 def nuw_add(rhs) self.class.from_ptr(C.const_nuw_add(self, rhs)) end |
#nuw_mul(rhs) ⇒ Object
“No unsigned wrap” multiplication.
401 402 403 |
# File 'lib/llvm/core/value.rb', line 401 def nuw_mul(rhs) self.class.from_ptr(C.const_nuw_mul(self, rhs)) end |
#nuw_neg ⇒ Object
“No unsigned wrap” negation.
350 351 352 |
# File 'lib/llvm/core/value.rb', line 350 def nuw_neg self.class.from_ptr(C.const_nuw_neg(self)) end |
#nuw_sub(rhs) ⇒ Object
“No unsigned wrap” subtraction.
384 385 386 |
# File 'lib/llvm/core/value.rb', line 384 def nuw_sub(rhs) self.class.from_ptr(C.const_nuw_sub(self, rhs)) end |
#rem(rhs) ⇒ Object
Signed remainder.
421 422 423 |
# File 'lib/llvm/core/value.rb', line 421 def rem(rhs) self.class.from_ptr(C.const_s_rem(self, rhs)) end |
#sext(type) ⇒ Object
constant sext
499 500 501 |
# File 'lib/llvm/core/value.rb', line 499 def sext(type) self.class.from_ptr(C.const_s_ext(self, type)) end |
#udiv(rhs) ⇒ Object
Unsigned division.
406 407 408 |
# File 'lib/llvm/core/value.rb', line 406 def udiv(rhs) self.class.from_ptr(C.const_u_div(self, rhs)) end |
#urem(rhs) ⇒ Object
Unsigned remainder.
416 417 418 |
# File 'lib/llvm/core/value.rb', line 416 def urem(rhs) self.class.from_ptr(C.const_u_rem(self, rhs)) end |
#zext(type) ⇒ Object
constant zext
494 495 496 |
# File 'lib/llvm/core/value.rb', line 494 def zext(type) self.class.from_ptr(C.const_z_ext(self, type)) end |