Class: LLVM::Function

Inherits:
GlobalValue show all
Defined in:
lib/llvm/analysis.rb,
lib/llvm/core/value.rb

Defined Under Namespace

Classes: AttributeCollection, BasicBlockCollection, ParameterCollection

Instance Method Summary collapse

Methods inherited from GlobalValue

#alignment, #alignment=, #declaration?, #dll_storage_class, #dll_storage_class=, #global_constant=, #global_constant?, #initializer, #initializer=, #linkage, #linkage=, #section, #section=, #unnamed_addr=, #unnamed_addr?, #visibility, #visibility=

Methods inherited from Constant

#bitcast_to, #gep, null, null_ptr, #ptr_to_int, undef

Methods inherited from User

#operands

Methods inherited from Value

#constant?, #dump, from_ptr, #name, #name=, #null?, to_ptr, #to_s, type, #undefined?

Methods included from PointerIdentity

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

Instance Method Details

#add_attribute(attr, index = -1)) ⇒ Object

Adds attr to this value’s attributes.



747
748
749
# File 'lib/llvm/core/value.rb', line 747

def add_attribute(attr, index = -1)
  AttributeCollection.new(self, index).add(attr)
end

#attribute_countObject



756
757
758
# File 'lib/llvm/core/value.rb', line 756

def attribute_count
  function_attributes.count
end

#attributesObject



760
761
762
# File 'lib/llvm/core/value.rb', line 760

def attributes
  function_attributes.to_a
end

#basic_blocksObject

Returns an Enumerable of the BasicBlocks in this function.



734
735
736
# File 'lib/llvm/core/value.rb', line 734

def basic_blocks
  @basic_block_collection ||= BasicBlockCollection.new(self)
end

#call_conv=(conv) ⇒ Object

Sets the function’s calling convention and returns it.



728
729
730
731
# File 'lib/llvm/core/value.rb', line 728

def call_conv=(conv)
  C.set_function_call_conv(self, conv)
  conv
end

#function_attributesObject



764
765
766
# File 'lib/llvm/core/value.rb', line 764

def function_attributes
  AttributeCollection.new(self, -1)
end

#function_typeObject



742
743
744
# File 'lib/llvm/core/value.rb', line 742

def function_type
  type.element_type
end

#gcObject



918
919
920
# File 'lib/llvm/core/value.rb', line 918

def gc
  C.get_gc(self)
end

#gc=(name) ⇒ Object



914
915
916
# File 'lib/llvm/core/value.rb', line 914

def gc=(name)
  C.set_gc(self, name)
end

#param_attributes(index) ⇒ Object



772
773
774
# File 'lib/llvm/core/value.rb', line 772

def param_attributes(index)
  AttributeCollection.new(self, index)
end

#paramsObject

Returns an Enumerable of the parameters in the function.



881
882
883
# File 'lib/llvm/core/value.rb', line 881

def params
  @parameter_collection ||= ParameterCollection.new(self)
end

#remove_attribute(attr, index = -1)) ⇒ Object

Removes the given attribute from the function.



752
753
754
# File 'lib/llvm/core/value.rb', line 752

def remove_attribute(attr, index = -1)
  AttributeCollection.new(self, index).remove(attr)
end

#return_attributesObject



768
769
770
# File 'lib/llvm/core/value.rb', line 768

def return_attributes
  AttributeCollection.new(self, 0)
end

#typeObject



738
739
740
# File 'lib/llvm/core/value.rb', line 738

def type
  Type.from_ptr(C.type_of(self), :pointer)
end

#verifytrue, false

Verify that a function is valid.

Returns:

  • (true, false)


35
36
37
# File 'lib/llvm/analysis.rb', line 35

def verify
  do_verification(:return_status)
end

#verify!true, false

Verify that a function is valid, and abort the process if not.

Returns:

  • (true, false)


41
42
43
# File 'lib/llvm/analysis.rb', line 41

def verify!
  do_verification(:abort_process)
end