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
(also: #ext)
constant sext.
-
#to_f(type) ⇒ Object
LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);.
-
#trunc(type) ⇒ Object
constant trunc.
-
#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, #allocated_type, #constant?, #dump, from_ptr, from_ptr_kind, #global_parent, #kind, #name, #name=, #null?, #remove_attribute, to_ptr, #to_s, type, #type, #undefined?
Methods included from PointerIdentity
Class Method Details
.all_ones ⇒ Object
362 363 364 |
# File 'lib/llvm/core/value.rb', line 362 def self.all_ones from_ptr(C.const_all_ones(type)) end |
.from_i(n, signed = true) ⇒ Object
Creates a ConstantInt from an integer.
367 368 369 |
# File 'lib/llvm/core/value.rb', line 367 def self.from_i(n, signed = true) from_ptr(C.const_int(type, n, signed ? 1 : 0)) end |
.parse(str, radix = 10) ⇒ Object
371 372 373 |
# File 'lib/llvm/core/value.rb', line 371 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.
471 472 473 |
# File 'lib/llvm/core/value.rb', line 471 def &(rhs) self.class.from_ptr(C.const_and(self, rhs)) end |
#*(rhs) ⇒ Object Also known as: mul
Multiplication.
427 428 429 |
# File 'lib/llvm/core/value.rb', line 427 def *(rhs) self.class.from_ptr(C.const_mul(self, rhs)) end |
#+(rhs) ⇒ Object Also known as: add
Addition.
393 394 395 |
# File 'lib/llvm/core/value.rb', line 393 def +(rhs) self.class.from_ptr(C.const_add(self, rhs)) end |
#-(rhs) ⇒ Object Also known as: sub
Subtraction.
410 411 412 |
# File 'lib/llvm/core/value.rb', line 410 def -(rhs) self.class.from_ptr(C.const_sub(self, rhs)) end |
#-@ ⇒ Object Also known as: neg
Negation.
376 377 378 |
# File 'lib/llvm/core/value.rb', line 376 def -@ self.class.from_ptr(C.const_neg(self)) end |
#/(rhs) ⇒ Object
Signed division.
449 450 451 |
# File 'lib/llvm/core/value.rb', line 449 def /(rhs) raise "constant sdiv removed in LLVM 15" end |
#<<(bits) ⇒ Object Also known as: shl
Shift left.
492 493 494 |
# File 'lib/llvm/core/value.rb', line 492 def <<(bits) self.class.from_ptr(C.const_shl(self, bits)) end |
#>>(bits) ⇒ Object Also known as: shr
Shift right.
499 500 501 |
# File 'lib/llvm/core/value.rb', line 499 def >>(bits) self.class.from_ptr(C.const_l_shr(self, bits)) end |
#^(rhs) ⇒ Object Also known as: xor
Integer XOR.
485 486 487 |
# File 'lib/llvm/core/value.rb', line 485 def ^(rhs) self.class.from_ptr(C.const_xor(self, rhs)) end |
#ashr(bits) ⇒ Object
Arithmatic shift right.
506 507 508 |
# File 'lib/llvm/core/value.rb', line 506 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
522 523 524 |
# File 'lib/llvm/core/value.rb', line 522 def icmp(pred, rhs) self.class.from_ptr(C.const_i_cmp(pred, self, rhs)) end |
#int_to_ptr(type) ⇒ Object
Conversion to pointer.
527 528 529 |
# File 'lib/llvm/core/value.rb', line 527 def int_to_ptr(type) ConstantExpr.from_ptr(C.const_int_to_ptr(self, type)) end |
#nsw_add(rhs) ⇒ Object
“No signed wrap” addition.
400 401 402 |
# File 'lib/llvm/core/value.rb', line 400 def nsw_add(rhs) self.class.from_ptr(C.const_nsw_add(self, rhs)) end |
#nsw_mul(rhs) ⇒ Object
“No signed wrap” multiplication.
434 435 436 |
# File 'lib/llvm/core/value.rb', line 434 def nsw_mul(rhs) self.class.from_ptr(C.const_nsw_mul(self, rhs)) end |
#nsw_neg ⇒ Object
“No signed wrap” negation.
383 384 385 |
# File 'lib/llvm/core/value.rb', line 383 def nsw_neg self.class.from_ptr(C.const_nsw_neg(self)) end |
#nsw_sub(rhs) ⇒ Object
“No signed wrap” subtraction.
417 418 419 |
# File 'lib/llvm/core/value.rb', line 417 def nsw_sub(rhs) self.class.from_ptr(C.const_nsw_sub(self, rhs)) end |
#nuw_add(rhs) ⇒ Object
“No unsigned wrap” addition.
405 406 407 |
# File 'lib/llvm/core/value.rb', line 405 def nuw_add(rhs) self.class.from_ptr(C.const_nuw_add(self, rhs)) end |
#nuw_mul(rhs) ⇒ Object
“No unsigned wrap” multiplication.
439 440 441 |
# File 'lib/llvm/core/value.rb', line 439 def nuw_mul(rhs) self.class.from_ptr(C.const_nuw_mul(self, rhs)) end |
#nuw_neg ⇒ Object
“No unsigned wrap” negation.
388 389 390 |
# File 'lib/llvm/core/value.rb', line 388 def nuw_neg self.class.from_ptr(C.const_nuw_neg(self)) end |
#nuw_sub(rhs) ⇒ Object
“No unsigned wrap” subtraction.
422 423 424 |
# File 'lib/llvm/core/value.rb', line 422 def nuw_sub(rhs) self.class.from_ptr(C.const_nuw_sub(self, rhs)) end |
#rem(rhs) ⇒ Object
Signed remainder.
459 460 461 |
# File 'lib/llvm/core/value.rb', line 459 def rem(rhs) raise "constant srem removed in LLVM 15" end |
#sext(type) ⇒ Object Also known as: ext
constant sext
537 538 539 |
# File 'lib/llvm/core/value.rb', line 537 def sext(type) self.class.from_ptr(C.const_s_ext(self, type)) end |
#to_f(type) ⇒ Object
LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
548 549 550 |
# File 'lib/llvm/core/value.rb', line 548 def to_f(type) self.class.from_ptr(C.const_si_to_fp(self, type)) end |
#trunc(type) ⇒ Object
constant trunc
543 544 545 |
# File 'lib/llvm/core/value.rb', line 543 def trunc(type) self.class.from_ptr(C.const_trunc(self, type)) end |
#udiv(rhs) ⇒ Object
Unsigned division.
444 445 446 |
# File 'lib/llvm/core/value.rb', line 444 def udiv(rhs) raise "constant udiv removed in LLVM 15" end |
#urem(rhs) ⇒ Object
Unsigned remainder.
454 455 456 |
# File 'lib/llvm/core/value.rb', line 454 def urem(rhs) raise "constant urem removed in LLVM 15" end |
#zext(type) ⇒ Object
constant zext
532 533 534 |
# File 'lib/llvm/core/value.rb', line 532 def zext(type) self.class.from_ptr(C.const_z_ext(self, type)) end |