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
Multiplication.
-
#+(rhs) ⇒ Object
Addition.
-
#-@ ⇒ Object
Negation.
-
#/(rhs) ⇒ Object
Signed division.
-
#<<(bits) ⇒ Object
Shift left.
-
#>>(bits) ⇒ Object
Shift right.
-
#and(rhs) ⇒ Object
Integer AND.
-
#ashr(bits) ⇒ Object
Arithmatic shift right.
-
#icmp(pred, rhs) ⇒ Object
Integer comparison using the predicate specified via the first parameter.
-
#not ⇒ Object
Boolean negation.
-
#nsw_add(rhs) ⇒ Object
“No signed wrap” addition.
-
#or(rhs) ⇒ Object
Integer OR.
-
#rem(rhs) ⇒ Object
Signed remainder.
-
#udiv(rhs) ⇒ Object
Unsigned division.
-
#urem(rhs) ⇒ Object
Unsigned remainder.
-
#xor(rhs) ⇒ Object
Integer XOR.
Methods inherited from Constant
#bitcast_to, #gep, null, null_ptr, undef
Methods inherited from User
Methods inherited from Value
#==, #add_attribute, #constant?, #dump, #eql?, from_ptr, #initialize, #name, #name=, #null?, to_ptr, #to_ptr, type, #type, #undefined?
Constructor Details
This class inherits a constructor from LLVM::Value
Class Method Details
.all_ones ⇒ Object
290 291 292 |
# File 'lib/llvm/core/value.rb', line 290 def self.all_ones from_ptr(C.LLVMConstAllOnes(type)) end |
.from_i(n, signed = true) ⇒ Object
Creates a ConstantInt from an integer.
295 296 297 |
# File 'lib/llvm/core/value.rb', line 295 def self.from_i(n, signed = true) from_ptr(C.LLVMConstInt(type, n, signed ? 1 : 0)) end |
.parse(str, radix = 10) ⇒ Object
299 300 301 |
# File 'lib/llvm/core/value.rb', line 299 def self.parse(str, radix = 10) from_ptr(C.LLVMConstIntOfString(type, str, radix)) end |
Instance Method Details
#*(rhs) ⇒ Object
Multiplication.
325 326 327 |
# File 'lib/llvm/core/value.rb', line 325 def *(rhs) self.class.from_ptr(C.LLVMConstMul(self, rhs)) end |
#+(rhs) ⇒ Object
Addition.
314 315 316 |
# File 'lib/llvm/core/value.rb', line 314 def +(rhs) self.class.from_ptr(C.LLVMConstAdd(self, rhs)) end |
#-@ ⇒ Object
Negation.
304 305 306 |
# File 'lib/llvm/core/value.rb', line 304 def -@ self.class.from_ptr(C.LLVMConstNeg(self)) end |
#/(rhs) ⇒ Object
Signed division.
335 336 337 |
# File 'lib/llvm/core/value.rb', line 335 def /(rhs) self.class.from_ptr(C.LLVMConstSDiv(self, rhs)) end |
#<<(bits) ⇒ Object
Shift left.
381 382 383 |
# File 'lib/llvm/core/value.rb', line 381 def <<(bits) self.class.from_ptr(C.LLVMConstShl(self, bits)) end |
#>>(bits) ⇒ Object
Shift right.
386 387 388 |
# File 'lib/llvm/core/value.rb', line 386 def >>(bits) self.class.from_ptr(C.LLVMConstLShr(self, bits)) end |
#and(rhs) ⇒ Object
Integer AND.
350 351 352 |
# File 'lib/llvm/core/value.rb', line 350 def and(rhs) self.class.from_ptr(C.LLVMConstAnd(self, rhs)) end |
#ashr(bits) ⇒ Object
Arithmatic shift right.
391 392 393 |
# File 'lib/llvm/core/value.rb', line 391 def ashr(bits) self.class.from_ptr(C.LLVMConstAShr(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
376 377 378 |
# File 'lib/llvm/core/value.rb', line 376 def icmp(pred, rhs) self.class.from_ptr(C.LLVMConstICmp(pred, self, rhs)) end |
#not ⇒ Object
Boolean negation.
309 310 311 |
# File 'lib/llvm/core/value.rb', line 309 def not self.class.from_ptr(C.LLVMConstNot(self)) end |
#nsw_add(rhs) ⇒ Object
“No signed wrap” addition. See llvm.org/docs/LangRef.html#i_add for discusison.
320 321 322 |
# File 'lib/llvm/core/value.rb', line 320 def nsw_add(rhs) self.class.from_ptr(C.LLVMConstNSWAdd(self, rhs)) end |
#or(rhs) ⇒ Object
Integer OR.
355 356 357 |
# File 'lib/llvm/core/value.rb', line 355 def or(rhs) self.class.from_ptr(C.LLVMConstOr(self, rhs)) end |
#rem(rhs) ⇒ Object
Signed remainder.
345 346 347 |
# File 'lib/llvm/core/value.rb', line 345 def rem(rhs) self.class.from_ptr(C.LLVMConstSRem(self, rhs)) end |
#udiv(rhs) ⇒ Object
Unsigned division.
330 331 332 |
# File 'lib/llvm/core/value.rb', line 330 def udiv(rhs) self.class.from_ptr(C.LLVMConstUDiv(self, rhs)) end |
#urem(rhs) ⇒ Object
Unsigned remainder.
340 341 342 |
# File 'lib/llvm/core/value.rb', line 340 def urem(rhs) self.class.from_ptr(C.LLVMConstURem(self, rhs)) end |
#xor(rhs) ⇒ Object
Integer XOR.
360 361 362 |
# File 'lib/llvm/core/value.rb', line 360 def xor(rhs) self.class.from_ptr(C.LLVMConstXor(self, rhs)) end |