Class: LLVM::ConstantInt

Inherits:
Constant show all
Defined in:
lib/llvm/core/value.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Constant

#bitcast_to, #gep, null, null_ptr, #ptr_to_int, undef

Methods inherited from User

#operands

Methods inherited from Value

#add_attribute, #allocated_type, #constant?, #dump, from_ptr, #name, #name=, #null?, #remove_attribute, to_ptr, #to_s, #type, type, #undefined?

Methods included from PointerIdentity

#==, #eql?, #hash, #to_ptr

Class Method Details

.all_onesObject



332
333
334
# File 'lib/llvm/core/value.rb', line 332

def self.all_ones
  from_ptr(C.const_all_ones(type))
end

.from_i(n, signed = true) ⇒ Object

Creates a ConstantInt from an integer.



337
338
339
# File 'lib/llvm/core/value.rb', line 337

def self.from_i(n, signed = true)
  from_ptr(C.const_int(type, n, signed ? 1 : 0))
end

.parse(str, radix = 10) ⇒ Object



341
342
343
# File 'lib/llvm/core/value.rb', line 341

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.



441
442
443
# File 'lib/llvm/core/value.rb', line 441

def &(rhs)
  self.class.from_ptr(C.const_and(self, rhs))
end

#*(rhs) ⇒ Object Also known as: mul

Multiplication.



397
398
399
# File 'lib/llvm/core/value.rb', line 397

def *(rhs)
  self.class.from_ptr(C.const_mul(self, rhs))
end

#+(rhs) ⇒ Object Also known as: add

Addition.



363
364
365
# File 'lib/llvm/core/value.rb', line 363

def +(rhs)
  self.class.from_ptr(C.const_add(self, rhs))
end

#-(rhs) ⇒ Object Also known as: sub

Subtraction.



380
381
382
# File 'lib/llvm/core/value.rb', line 380

def -(rhs)
  self.class.from_ptr(C.const_sub(self, rhs))
end

#-@Object Also known as: neg

Negation.



346
347
348
# File 'lib/llvm/core/value.rb', line 346

def -@
  self.class.from_ptr(C.const_neg(self))
end

#/(rhs) ⇒ Object

Signed division.



419
420
421
# File 'lib/llvm/core/value.rb', line 419

def /(rhs)
  self.class.from_ptr(C.const_s_div(self, rhs))
end

#<<(bits) ⇒ Object Also known as: shl

Shift left.



462
463
464
# File 'lib/llvm/core/value.rb', line 462

def <<(bits)
  self.class.from_ptr(C.const_shl(self, bits))
end

#>>(bits) ⇒ Object Also known as: shr

Shift right.



469
470
471
# File 'lib/llvm/core/value.rb', line 469

def >>(bits)
  self.class.from_ptr(C.const_l_shr(self, bits))
end

#^(rhs) ⇒ Object Also known as: xor

Integer XOR.



455
456
457
# File 'lib/llvm/core/value.rb', line 455

def ^(rhs)
  self.class.from_ptr(C.const_xor(self, rhs))
end

#ashr(bits) ⇒ Object

Arithmatic shift right.



476
477
478
# File 'lib/llvm/core/value.rb', line 476

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


492
493
494
# File 'lib/llvm/core/value.rb', line 492

def icmp(pred, rhs)
  self.class.from_ptr(C.const_i_cmp(pred, self, rhs))
end

#int_to_ptr(type) ⇒ Object

Conversion to pointer.



497
498
499
# File 'lib/llvm/core/value.rb', line 497

def int_to_ptr(type)
  ConstantExpr.from_ptr(C.const_int_to_ptr(self, type))
end

#nsw_add(rhs) ⇒ Object

“No signed wrap” addition.



370
371
372
# File 'lib/llvm/core/value.rb', line 370

def nsw_add(rhs)
  self.class.from_ptr(C.const_nsw_add(self, rhs))
end

#nsw_mul(rhs) ⇒ Object

“No signed wrap” multiplication.



404
405
406
# File 'lib/llvm/core/value.rb', line 404

def nsw_mul(rhs)
  self.class.from_ptr(C.const_nsw_mul(self, rhs))
end

#nsw_negObject

“No signed wrap” negation.



353
354
355
# File 'lib/llvm/core/value.rb', line 353

def nsw_neg
  self.class.from_ptr(C.const_nsw_neg(self))
end

#nsw_sub(rhs) ⇒ Object

“No signed wrap” subtraction.



387
388
389
# File 'lib/llvm/core/value.rb', line 387

def nsw_sub(rhs)
  self.class.from_ptr(C.const_nsw_sub(self, rhs))
end

#nuw_add(rhs) ⇒ Object

“No unsigned wrap” addition.



375
376
377
# File 'lib/llvm/core/value.rb', line 375

def nuw_add(rhs)
  self.class.from_ptr(C.const_nuw_add(self, rhs))
end

#nuw_mul(rhs) ⇒ Object

“No unsigned wrap” multiplication.



409
410
411
# File 'lib/llvm/core/value.rb', line 409

def nuw_mul(rhs)
  self.class.from_ptr(C.const_nuw_mul(self, rhs))
end

#nuw_negObject

“No unsigned wrap” negation.



358
359
360
# File 'lib/llvm/core/value.rb', line 358

def nuw_neg
  self.class.from_ptr(C.const_nuw_neg(self))
end

#nuw_sub(rhs) ⇒ Object

“No unsigned wrap” subtraction.



392
393
394
# File 'lib/llvm/core/value.rb', line 392

def nuw_sub(rhs)
  self.class.from_ptr(C.const_nuw_sub(self, rhs))
end

#rem(rhs) ⇒ Object

Signed remainder.



429
430
431
# File 'lib/llvm/core/value.rb', line 429

def rem(rhs)
  self.class.from_ptr(C.const_s_rem(self, rhs))
end

#sext(type) ⇒ Object

constant sext



507
508
509
# File 'lib/llvm/core/value.rb', line 507

def sext(type)
  self.class.from_ptr(C.const_s_ext(self, type))
end

#udiv(rhs) ⇒ Object

Unsigned division.



414
415
416
# File 'lib/llvm/core/value.rb', line 414

def udiv(rhs)
  self.class.from_ptr(C.const_u_div(self, rhs))
end

#urem(rhs) ⇒ Object

Unsigned remainder.



424
425
426
# File 'lib/llvm/core/value.rb', line 424

def urem(rhs)
  self.class.from_ptr(C.const_u_rem(self, rhs))
end

#zext(type) ⇒ Object

constant zext



502
503
504
# File 'lib/llvm/core/value.rb', line 502

def zext(type)
  self.class.from_ptr(C.const_z_ext(self, type))
end

#|(rhs) ⇒ Object Also known as: or

Integer OR.



448
449
450
# File 'lib/llvm/core/value.rb', line 448

def |(rhs)
  self.class.from_ptr(C.const_or(self, rhs))
end

#~@Object

Boolean negation.



434
435
436
# File 'lib/llvm/core/value.rb', line 434

def ~@
  self.class.from_ptr(C.const_not(self))
end