Class: LLVM::Function

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

Defined Under Namespace

Classes: BasicBlockCollection, ParameterCollection

Instance Method Summary collapse

Methods inherited from GlobalValue

#alignment, #alignment=, #declaration?, #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, type, #undefined?

Methods included from PointerIdentity

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

Instance Method Details

#add_attribute(attr) ⇒ Object

Adds the given attribute to the function.



666
667
668
# File 'lib/llvm/core/value.rb', line 666

def add_attribute(attr)
  C.add_function_attr(self, attr)
end

#basic_blocksObject

Returns an Enumerable of the BasicBlocks in this function.



676
677
678
# File 'lib/llvm/core/value.rb', line 676

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

#call_conv=(conv) ⇒ Object

Sets the function’s calling convention and returns it.



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

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

#function_typeObject



684
685
686
# File 'lib/llvm/core/value.rb', line 684

def function_type
  type.element_type
end

#gcObject



775
776
777
# File 'lib/llvm/core/value.rb', line 775

def gc
  C.get_gc(self)
end

#gc=(name) ⇒ Object



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

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

#paramsObject

Returns an Enumerable of the parameters in the function.



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

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

#remove_attribute(attr) ⇒ Object

Removes the given attribute from the function.



671
672
673
# File 'lib/llvm/core/value.rb', line 671

def remove_attribute(attr)
  C.remove_function_attr(self, attr)
end

#typeObject



680
681
682
# File 'lib/llvm/core/value.rb', line 680

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

#verifytrue, false

Verify that a function is valid.

Returns:

  • (true, false)


33
34
35
# File 'lib/llvm/analysis.rb', line 33

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)


39
40
41
# File 'lib/llvm/analysis.rb', line 39

def verify!
  do_verification(:abort_process)
end