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



489
490
491
# File 'lib/llvm/core/value.rb', line 489

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

.parse(type, str) ⇒ Object



493
494
495
# File 'lib/llvm/core/value.rb', line 493

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.



508
509
510
# File 'lib/llvm/core/value.rb', line 508

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

#+(rhs) ⇒ Object

Returns the result of adding this ConstantReal to rhs.



503
504
505
# File 'lib/llvm/core/value.rb', line 503

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

#-@Object

Negation.



498
499
500
# File 'lib/llvm/core/value.rb', line 498

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

#/(rhs) ⇒ Object

Returns the result of dividing this ConstantReal by rhs.



513
514
515
# File 'lib/llvm/core/value.rb', line 513

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


540
541
542
# File 'lib/llvm/core/value.rb', line 540

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

#rem(rhs) ⇒ Object

Remainder.



518
519
520
# File 'lib/llvm/core/value.rb', line 518

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