Class: LLVM::ConstantInt
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/llvm/core/value.rb
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.
-
#^(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 = LLVM.Pointer) ⇒ Object
Conversion to pointer.
-
#lshr(bits) ⇒ Object
(also: #shr, #>>)
Shift right.
-
#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 deprecated Deprecated.
-
#nuw_sub(rhs) ⇒ Object
“No unsigned wrap” subtraction.
-
#rem(rhs) ⇒ Object
Signed remainder.
-
#sext(type) ⇒ Object
(also: #ext)
constant sext was: self.class.from_ptr(C.const_s_ext(self, type)).
-
#to_f(type) ⇒ Object
LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType); was: self.class.from_ptr(C.const_si_to_fp(self, type)).
- #to_i(signed = true) ⇒ Object
- #to_si ⇒ Object
- #to_ui ⇒ Object
-
#trunc(type) ⇒ Object
constant trunc was: self.class.from_ptr(C.const_trunc(self, type)).
-
#udiv(rhs) ⇒ Object
Unsigned division.
-
#urem(rhs) ⇒ Object
Unsigned remainder.
-
#zext(type) ⇒ Object
constant zext was: self.class.from_ptr(C.const_z_ext(self, type)).
-
#|(rhs) ⇒ Object
(also: #or)
Integer OR.
-
#~@ ⇒ Object
Boolean negation.
Methods inherited from Constant
#bitcast_to, #gep, null, null_ptr, poison, #ptr_to_int, undef
Methods inherited from User
Methods inherited from Value
#add_attribute, #allocated_type, #allocated_type?, #constant?, #dump, from_ptr, from_ptr_kind, #gep_source_element_type, #gep_source_element_type?, #global_parent, #kind, #name, #name=, #null?, #poison?, #remove_attribute, to_ptr, #to_s, type, #type, #undef?
Methods included from PointerIdentity
Instance Method Details
#&(rhs) ⇒ Object Also known as: and
Integer AND. was: self.class.from_ptr(C.const_and(self, rhs))
531 532 533 534 |
# File 'lib/llvm/core/value.rb', line 531 def &(rhs) width = [type.width, rhs.type.width].max LLVM::Type.integer(width).from_i(to_i & rhs.to_i) end |
#*(rhs) ⇒ Object Also known as: mul
Multiplication.
482 483 484 |
# File 'lib/llvm/core/value.rb', line 482 def *(rhs) self.class.from_ptr(C.const_mul(self, rhs)) end |
#+(rhs) ⇒ Object Also known as: add
Addition.
448 449 450 |
# File 'lib/llvm/core/value.rb', line 448 def +(rhs) self.class.from_ptr(C.const_add(self, rhs)) end |
#-(rhs) ⇒ Object Also known as: sub
Subtraction.
465 466 467 |
# File 'lib/llvm/core/value.rb', line 465 def -(rhs) self.class.from_ptr(C.const_sub(self, rhs)) end |
#-@ ⇒ Object Also known as: neg
Negation.
427 428 429 |
# File 'lib/llvm/core/value.rb', line 427 def -@ self.class.from_ptr(C.const_neg(self)) end |
#/(rhs) ⇒ Object
Signed division.
505 506 507 508 |
# File 'lib/llvm/core/value.rb', line 505 def /(rhs) width = [type.width, rhs.type.width].max LLVM::Type.integer(width).from_i(to_si / rhs.to_si, true) end |
#<<(bits) ⇒ Object Also known as: shl
Shift left.
554 555 556 557 |
# File 'lib/llvm/core/value.rb', line 554 def <<(bits) width = [type.width, bits.type.width].max LLVM::Type.integer(width).from_i(to_i << bits.to_i) end |
#^(rhs) ⇒ Object Also known as: xor
Integer XOR.
547 548 549 |
# File 'lib/llvm/core/value.rb', line 547 def ^(rhs) self.class.from_ptr(C.const_xor(self, rhs)) end |
#ashr(bits) ⇒ Object
Arithmatic shift right.
571 572 573 574 |
# File 'lib/llvm/core/value.rb', line 571 def ashr(bits) width = [type.width, bits.type.width].max LLVM::Type.integer(width).from_i(to_i >> bits.to_i) 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
588 589 590 |
# File 'lib/llvm/core/value.rb', line 588 def icmp(_pred, _rhs) raise DeprecationError end |
#int_to_ptr(type = LLVM.Pointer) ⇒ Object
Conversion to pointer.
593 594 595 |
# File 'lib/llvm/core/value.rb', line 593 def int_to_ptr(type = LLVM.Pointer) ConstantExpr.from_ptr(C.const_int_to_ptr(self, type)) end |
#lshr(bits) ⇒ Object Also known as: shr, >>
Shift right.
562 563 564 565 |
# File 'lib/llvm/core/value.rb', line 562 def lshr(bits) width = [type.width, bits.type.width].max LLVM::Type.integer(width).from_i(to_ui >> bits.to_i) end |
#nsw_add(rhs) ⇒ Object
“No signed wrap” addition.
455 456 457 |
# File 'lib/llvm/core/value.rb', line 455 def nsw_add(rhs) self.class.from_ptr(C.const_nsw_add(self, rhs)) end |
#nsw_mul(rhs) ⇒ Object
“No signed wrap” multiplication.
489 490 491 |
# File 'lib/llvm/core/value.rb', line 489 def nsw_mul(rhs) self.class.from_ptr(C.const_nsw_mul(self, rhs)) end |
#nsw_neg ⇒ Object
“No signed wrap” negation.
434 435 436 |
# File 'lib/llvm/core/value.rb', line 434 def nsw_neg self.class.from_ptr(C.const_nsw_neg(self)) end |
#nsw_sub(rhs) ⇒ Object
“No signed wrap” subtraction.
472 473 474 |
# File 'lib/llvm/core/value.rb', line 472 def nsw_sub(rhs) self.class.from_ptr(C.const_nsw_sub(self, rhs)) end |
#nuw_add(rhs) ⇒ Object
“No unsigned wrap” addition.
460 461 462 |
# File 'lib/llvm/core/value.rb', line 460 def nuw_add(rhs) self.class.from_ptr(C.const_nuw_add(self, rhs)) end |
#nuw_mul(rhs) ⇒ Object
“No unsigned wrap” multiplication.
494 495 496 |
# File 'lib/llvm/core/value.rb', line 494 def nuw_mul(rhs) self.class.from_ptr(C.const_nuw_mul(self, rhs)) end |
#nuw_neg ⇒ Object
“No unsigned wrap” negation.
440 441 442 443 444 |
# File 'lib/llvm/core/value.rb', line 440 def nuw_neg # :nocov: self.class.from_ptr(C.const_nuw_neg(self)) # :nocov: end |
#nuw_sub(rhs) ⇒ Object
“No unsigned wrap” subtraction.
477 478 479 |
# File 'lib/llvm/core/value.rb', line 477 def nuw_sub(rhs) self.class.from_ptr(C.const_nuw_sub(self, rhs)) end |
#rem(rhs) ⇒ Object
Signed remainder.
517 518 519 520 |
# File 'lib/llvm/core/value.rb', line 517 def rem(rhs) width = [type.width, rhs.type.width].max LLVM::Type.integer(width).from_i(to_si % rhs.to_si, true) end |
#sext(type) ⇒ Object Also known as: ext
constant sext was: self.class.from_ptr(C.const_s_ext(self, type))
613 614 615 |
# File 'lib/llvm/core/value.rb', line 613 def sext(type) type.from_i(to_si) end |
#to_f(type) ⇒ Object
LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType); was: self.class.from_ptr(C.const_si_to_fp(self, type))
626 627 628 |
# File 'lib/llvm/core/value.rb', line 626 def to_f(type) type.from_f(to_i.to_f) end |
#to_i(signed = true) ⇒ Object
630 631 632 633 634 635 636 |
# File 'lib/llvm/core/value.rb', line 630 def to_i(signed = true) if signed C.const_int_get_sext_value(self) else C.const_int_get_zext_value(self) end end |
#to_si ⇒ Object
601 602 603 |
# File 'lib/llvm/core/value.rb', line 601 def to_si to_i(true) end |
#to_ui ⇒ Object
597 598 599 |
# File 'lib/llvm/core/value.rb', line 597 def to_ui to_i(false) end |
#trunc(type) ⇒ Object
constant trunc was: self.class.from_ptr(C.const_trunc(self, type))
620 621 622 |
# File 'lib/llvm/core/value.rb', line 620 def trunc(type) type.from_i(to_i) end |
#udiv(rhs) ⇒ Object
Unsigned division.
499 500 501 502 |
# File 'lib/llvm/core/value.rb', line 499 def udiv(rhs) width = [type.width, rhs.type.width].max LLVM::Type.integer(width).from_i(to_ui / rhs.to_ui, false) end |
#urem(rhs) ⇒ Object
Unsigned remainder.
511 512 513 514 |
# File 'lib/llvm/core/value.rb', line 511 def urem(rhs) width = [type.width, rhs.type.width].max LLVM::Type.integer(width).from_i(to_ui % rhs.to_ui, false) end |
#zext(type) ⇒ Object
constant zext was: self.class.from_ptr(C.const_z_ext(self, type))
607 608 609 |
# File 'lib/llvm/core/value.rb', line 607 def zext(type) type.from_i(to_ui) end |