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, from_ptr_kind, #global_parent, #kind, #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.



593
594
595
# File 'lib/llvm/core/value.rb', line 593

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

.parse(type, str) ⇒ Object



597
598
599
# File 'lib/llvm/core/value.rb', line 597

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.



612
613
614
# File 'lib/llvm/core/value.rb', line 612

def *(rhs)
  raise "constant fmul removed in LLVM 15"
end

#+(rhs) ⇒ Object

Returns the result of adding this ConstantReal to rhs.



607
608
609
# File 'lib/llvm/core/value.rb', line 607

def +(rhs)
  raise "constant fadd removed in LLVM 15"
end

#-@Object

Negation.



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

def -@
  raise "constant fneg removed in LLVM 16"
end

#/(rhs) ⇒ Object

Returns the result of dividing this ConstantReal by rhs.



617
618
619
# File 'lib/llvm/core/value.rb', line 617

def /(rhs)
  raise "constant fdiv removed in LLVM 15"
end

#ext(type) ⇒ Object Also known as: sext

Constant FPExt this is a signed extension



656
657
658
# File 'lib/llvm/core/value.rb', line 656

def ext(type)
  self.class.from_ptr(C.const_fp_ext(self, type))
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


644
645
646
# File 'lib/llvm/core/value.rb', line 644

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

#rem(rhs) ⇒ Object

Remainder.



622
623
624
# File 'lib/llvm/core/value.rb', line 622

def rem(rhs)
  raise "constant frem removed in LLVM 15"
end

#to_i(type) ⇒ Object

constant FPToSI LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);



650
651
652
# File 'lib/llvm/core/value.rb', line 650

def to_i(type)
  self.class.from_ptr(C.const_fp_to_si(self, type))
end

#trunc(type) ⇒ Object



661
662
663
# File 'lib/llvm/core/value.rb', line 661

def trunc(type)
  self.class.from_ptr(C.const_fp_trunc(self, type))
end