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

Methods included from PointerIdentity

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

Class Method Details

.from_f(n) ⇒ Object

Creates a ConstantReal from a float of Type.



544
545
546
# File 'lib/llvm/core/value.rb', line 544

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

.parse(type, str) ⇒ Object



548
549
550
# File 'lib/llvm/core/value.rb', line 548

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

Instance Method Details

#*(rhs) ⇒ Object

Returns the result of multiplying this ConstantReal by rhs.



563
564
565
# File 'lib/llvm/core/value.rb', line 563

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

#+(rhs) ⇒ Object

Returns the result of adding this ConstantReal to rhs.



558
559
560
# File 'lib/llvm/core/value.rb', line 558

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

#-@Object

Negation.



553
554
555
# File 'lib/llvm/core/value.rb', line 553

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

#/(rhs) ⇒ Object

Returns the result of dividing this ConstantReal by rhs.



568
569
570
# File 'lib/llvm/core/value.rb', line 568

def /(rhs)
  self.class.from_ptr(C.const_f_div(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


595
596
597
# File 'lib/llvm/core/value.rb', line 595

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

#rem(rhs) ⇒ Object

Remainder.



573
574
575
# File 'lib/llvm/core/value.rb', line 573

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