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, #constant?, #dump, from_ptr, #name, #name=, #null?, #remove_attribute, to_ptr, #type, type, #undefined?

Methods included from PointerIdentity

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

Class Method Details

.all_onesObject



318
319
320
# File 'lib/llvm/core/value.rb', line 318

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

.from_i(n, signed = true) ⇒ Object

Creates a ConstantInt from an integer.



323
324
325
# File 'lib/llvm/core/value.rb', line 323

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

.parse(str, radix = 10) ⇒ Object



327
328
329
# File 'lib/llvm/core/value.rb', line 327

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.



427
428
429
# File 'lib/llvm/core/value.rb', line 427

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

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

Multiplication.



383
384
385
# File 'lib/llvm/core/value.rb', line 383

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

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

Addition.



349
350
351
# File 'lib/llvm/core/value.rb', line 349

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

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

Subtraction.



366
367
368
# File 'lib/llvm/core/value.rb', line 366

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

#-@Object Also known as: neg

Negation.



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

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

#/(rhs) ⇒ Object

Signed division.



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

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

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

Shift left.



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

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

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

Shift right.



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

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

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

Integer XOR.



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

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

#ashr(bits) ⇒ Object

Arithmatic shift right.



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

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


478
479
480
# File 'lib/llvm/core/value.rb', line 478

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

#int_to_ptr(type) ⇒ Object

Conversion to pointer.



483
484
485
# File 'lib/llvm/core/value.rb', line 483

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

#nsw_add(rhs) ⇒ Object

“No signed wrap” addition.



356
357
358
# File 'lib/llvm/core/value.rb', line 356

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

#nsw_mul(rhs) ⇒ Object

“No signed wrap” multiplication.



390
391
392
# File 'lib/llvm/core/value.rb', line 390

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

#nsw_negObject

“No signed wrap” negation.



339
340
341
# File 'lib/llvm/core/value.rb', line 339

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

#nsw_sub(rhs) ⇒ Object

“No signed wrap” subtraction.



373
374
375
# File 'lib/llvm/core/value.rb', line 373

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

#nuw_add(rhs) ⇒ Object

“No unsigned wrap” addition.



361
362
363
# File 'lib/llvm/core/value.rb', line 361

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

#nuw_mul(rhs) ⇒ Object

“No unsigned wrap” multiplication.



395
396
397
# File 'lib/llvm/core/value.rb', line 395

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

#nuw_negObject

“No unsigned wrap” negation.



344
345
346
# File 'lib/llvm/core/value.rb', line 344

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

#nuw_sub(rhs) ⇒ Object

“No unsigned wrap” subtraction.



378
379
380
# File 'lib/llvm/core/value.rb', line 378

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

#rem(rhs) ⇒ Object

Signed remainder.



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

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

#udiv(rhs) ⇒ Object

Unsigned division.



400
401
402
# File 'lib/llvm/core/value.rb', line 400

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

#urem(rhs) ⇒ Object

Unsigned remainder.



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

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

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

Integer OR.



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

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

#~@Object

Boolean negation.



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

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