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, #allocated_type, #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.



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

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

.parse(type, str) ⇒ Object



556
557
558
# File 'lib/llvm/core/value.rb', line 556

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.



571
572
573
# File 'lib/llvm/core/value.rb', line 571

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

#+(rhs) ⇒ Object

Returns the result of adding this ConstantReal to rhs.



566
567
568
# File 'lib/llvm/core/value.rb', line 566

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

#-@Object

Negation.



561
562
563
# File 'lib/llvm/core/value.rb', line 561

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

#/(rhs) ⇒ Object

Returns the result of dividing this ConstantReal by rhs.



576
577
578
# File 'lib/llvm/core/value.rb', line 576

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


603
604
605
# File 'lib/llvm/core/value.rb', line 603

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

#rem(rhs) ⇒ Object

Remainder.



581
582
583
# File 'lib/llvm/core/value.rb', line 581

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