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



528
529
530
# File 'lib/llvm/core/value.rb', line 528

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

.parse(type, str) ⇒ Object



532
533
534
# File 'lib/llvm/core/value.rb', line 532

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.



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

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

#+(rhs) ⇒ Object

Returns the result of adding this ConstantReal to rhs.



542
543
544
# File 'lib/llvm/core/value.rb', line 542

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

#-@Object

Negation.



537
538
539
# File 'lib/llvm/core/value.rb', line 537

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

#/(rhs) ⇒ Object

Returns the result of dividing this ConstantReal by rhs.



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

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


579
580
581
# File 'lib/llvm/core/value.rb', line 579

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

#rem(rhs) ⇒ Object

Remainder.



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

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