Class: LLVM::Function
- Inherits:
-
GlobalValue
- Object
- Value
- User
- Constant
- GlobalValue
- LLVM::Function
- Defined in:
- lib/llvm/analysis.rb,
lib/llvm/core/value.rb
Defined Under Namespace
Classes: AttributeCollection, BasicBlockCollection, ParameterCollection
Instance Method Summary collapse
-
#add_attribute(attr, index = -1)) ⇒ Object
Adds attr to this value’s attributes.
- #attribute_count ⇒ Object
- #attributes ⇒ Object
-
#basic_blocks ⇒ Object
Returns an Enumerable of the BasicBlocks in this function.
-
#call_conv=(conv) ⇒ Object
Sets the function’s calling convention and returns it.
- #function_attributes ⇒ Object
- #function_type ⇒ Object
- #gc ⇒ Object
- #gc=(name) ⇒ Object
- #param_attributes(index) ⇒ Object
-
#params ⇒ Object
Returns an Enumerable of the parameters in the function.
-
#remove_attribute(attr, index = -1)) ⇒ Object
Removes the given attribute from the function.
- #return_attributes ⇒ Object
- #return_type ⇒ Object
-
#type ⇒ Object
In LLVM 15, not overriding this yields a pointer type instead of a function type.
-
#verify ⇒ true, false
Verify that a function is valid.
-
#verify! ⇒ true, false
Verify that a function is valid, and abort the process if not.
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
Methods inherited from Value
#allocated_type, #constant?, #dump, from_ptr, #name, #name=, #null?, to_ptr, #to_s, type, #undefined?
Methods included from PointerIdentity
Instance Method Details
#add_attribute(attr, index = -1)) ⇒ Object
Adds attr to this value’s attributes.
768 769 770 |
# File 'lib/llvm/core/value.rb', line 768 def add_attribute(attr, index = -1) AttributeCollection.new(self, index).add(attr) end |
#attribute_count ⇒ Object
777 778 779 |
# File 'lib/llvm/core/value.rb', line 777 def attribute_count function_attributes.count end |
#attributes ⇒ Object
781 782 783 |
# File 'lib/llvm/core/value.rb', line 781 def attributes function_attributes.to_a end |
#basic_blocks ⇒ Object
Returns an Enumerable of the BasicBlocks in this function.
750 751 752 |
# File 'lib/llvm/core/value.rb', line 750 def basic_blocks @basic_block_collection ||= BasicBlockCollection.new(self) end |
#call_conv=(conv) ⇒ Object
Sets the function’s calling convention and returns it.
744 745 746 747 |
# File 'lib/llvm/core/value.rb', line 744 def call_conv=(conv) C.set_function_call_conv(self, conv) conv end |
#function_attributes ⇒ Object
785 786 787 |
# File 'lib/llvm/core/value.rb', line 785 def function_attributes AttributeCollection.new(self, -1) end |
#function_type ⇒ Object
754 755 756 |
# File 'lib/llvm/core/value.rb', line 754 def function_type Type.from_ptr(C.get_element_type(self), :function) end |
#gc=(name) ⇒ Object
935 936 937 |
# File 'lib/llvm/core/value.rb', line 935 def gc=(name) C.set_gc(self, name) end |
#param_attributes(index) ⇒ Object
793 794 795 |
# File 'lib/llvm/core/value.rb', line 793 def param_attributes(index) AttributeCollection.new(self, index) end |
#params ⇒ Object
Returns an Enumerable of the parameters in the function.
902 903 904 |
# File 'lib/llvm/core/value.rb', line 902 def params @parameter_collection ||= ParameterCollection.new(self) end |
#remove_attribute(attr, index = -1)) ⇒ Object
Removes the given attribute from the function.
773 774 775 |
# File 'lib/llvm/core/value.rb', line 773 def remove_attribute(attr, index = -1) AttributeCollection.new(self, index).remove(attr) end |
#return_attributes ⇒ Object
789 790 791 |
# File 'lib/llvm/core/value.rb', line 789 def return_attributes AttributeCollection.new(self, 0) end |
#return_type ⇒ Object
763 764 765 |
# File 'lib/llvm/core/value.rb', line 763 def return_type type.return_type end |
#type ⇒ Object
In LLVM 15, not overriding this yields a pointer type instead of a function type
759 760 761 |
# File 'lib/llvm/core/value.rb', line 759 def type function_type end |
#verify ⇒ true, false
Verify that a function is valid.
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.
41 42 43 |
# File 'lib/llvm/analysis.rb', line 41 def verify! do_verification(:abort_process) end |