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=, #visibility, #visibility=

Methods inherited from Constant

#bitcast_to, #gep, null, null_ptr, undef

Methods inherited from User

#operands

Methods inherited from Value

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

Instance Method Details

#add_attribute(attr) ⇒ Object

Adds the given attribute to the function.



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

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

#basic_blocksObject

Returns an Enumerable of the BasicBlocks in this function.



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

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

#call_conv=(conv) ⇒ Object

Sets the function’s calling convention and returns it.



586
587
588
589
# File 'lib/llvm/core/value.rb', line 586

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

#paramsObject

Returns an Enumerable of the parameters in the function.



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

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

#remove_attribute(attr) ⇒ Object

Removes the given attribute from the function.



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

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

#typeObject



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

def type
  FunctionType.from_ptr(C.LLVMTypeOf(self))
end

#verifytrue, false

Verify that a function is valid.

Returns:

  • (true, false)


46
47
48
# File 'lib/llvm/analysis.rb', line 46

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)


52
53
54
# File 'lib/llvm/analysis.rb', line 52

def verify!
  do_verification(:abort_process)
end