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?, to_ptr, #type, type, #undefined?

Methods included from PointerIdentity

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

Class Method Details

.all_onesObject



279
280
281
# File 'lib/llvm/core/value.rb', line 279

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

.from_i(n, signed = true) ⇒ Object

Creates a ConstantInt from an integer.



284
285
286
# File 'lib/llvm/core/value.rb', line 284

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

.parse(str, radix = 10) ⇒ Object



288
289
290
# File 'lib/llvm/core/value.rb', line 288

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.



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

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

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

Multiplication.



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

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

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

Addition.



310
311
312
# File 'lib/llvm/core/value.rb', line 310

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

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

Subtraction.



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

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

#-@Object Also known as: neg

Negation.



293
294
295
# File 'lib/llvm/core/value.rb', line 293

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

#/(rhs) ⇒ Object

Signed division.



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

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

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

Shift left.



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

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

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

Shift right.



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

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

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

Integer XOR.



402
403
404
# File 'lib/llvm/core/value.rb', line 402

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

#ashr(bits) ⇒ Object

Arithmatic shift right.



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

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


439
440
441
# File 'lib/llvm/core/value.rb', line 439

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

#int_to_ptr(type) ⇒ Object

Conversion to pointer.



444
445
446
# File 'lib/llvm/core/value.rb', line 444

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

#nsw_add(rhs) ⇒ Object

“No signed wrap” addition.



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

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

#nsw_mul(rhs) ⇒ Object

“No signed wrap” multiplication.



351
352
353
# File 'lib/llvm/core/value.rb', line 351

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

#nsw_negObject

“No signed wrap” negation.



300
301
302
# File 'lib/llvm/core/value.rb', line 300

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

#nsw_sub(rhs) ⇒ Object

“No signed wrap” subtraction.



334
335
336
# File 'lib/llvm/core/value.rb', line 334

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

#nuw_add(rhs) ⇒ Object

“No unsigned wrap” addition.



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

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

#nuw_mul(rhs) ⇒ Object

“No unsigned wrap” multiplication.



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

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

#nuw_negObject

“No unsigned wrap” negation.



305
306
307
# File 'lib/llvm/core/value.rb', line 305

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

#nuw_sub(rhs) ⇒ Object

“No unsigned wrap” subtraction.



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

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

#rem(rhs) ⇒ Object

Signed remainder.



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

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

#udiv(rhs) ⇒ Object

Unsigned division.



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

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

#urem(rhs) ⇒ Object

Unsigned remainder.



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

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

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

Integer OR.



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

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

#~@Object

Boolean negation.



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

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