Class: LLVM::ConstantReal

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

Direct Known Subclasses

Double, Float

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Constant

#bitcast_to, #gep, null, null_ptr, undef

Methods inherited from User

#operands

Methods inherited from Value

#==, #add_attribute, #constant?, #dump, #eql?, from_ptr, #hash, #name, #name=, #null?, to_ptr, #to_ptr, type, #type, #undefined?

Class Method Details

.from_f(n) ⇒ Object

Creates a ConstantReal from a float of Type.



432
433
434
# File 'lib/llvm/core/value.rb', line 432

def self.from_f(n)
  from_ptr(C.LLVMConstReal(type, n))
end

.parse(type, str) ⇒ Object



436
437
438
# File 'lib/llvm/core/value.rb', line 436

def self.parse(type, str)
  from_ptr(C.LLVMConstRealOfString(type, str))
end

Instance Method Details

#*(rhs) ⇒ Object

Returns the result of multiplying this ConstantReal by rhs.



451
452
453
# File 'lib/llvm/core/value.rb', line 451

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

#+(rhs) ⇒ Object

Returns the result of adding this ConstantReal to rhs.



446
447
448
# File 'lib/llvm/core/value.rb', line 446

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

#-@Object

Negation.



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

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

#/(rhs) ⇒ Object

Returns the result of dividing this ConstantReal by rhs.



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

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

#fcmp(pred, rhs) ⇒ Object

Floating point comparison using the predicate specified via the first parameter. Predicate can be any of:

:ord  - ordered
:uno  - unordered: isnan(X) | isnan(Y)
:oeq  - ordered and equal to
:oeq  - unordered and equal to
:one  - ordered and not equal to
:one  - unordered and not equal to
:ogt  - ordered and greater than
:uge  - unordered and greater than or equal to
:olt  - ordered and less than
:ule  - unordered and less than or equal to
:oge  - ordered and greater than or equal to
:sge  - unordered and greater than or equal to
:ole  - ordered and less than or equal to
:sle  - unordered and less than or equal to
:true - always true
:false- always false


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

def fcmp(pred, rhs)
  self.class.from_ptr(C.LLMVConstFCmp(pred, self, rhs))
end

#rem(rhs) ⇒ Object

Remainder.



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

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