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 Attribute Summary
Attributes included from PointerIdentity
Instance Method Summary collapse
-
#add_attribute(attr, index = -1)) ⇒ Object
Adds attr to this value’s attributes.
- #attribute_count ⇒ Object
-
#attributes ⇒ Object
-> [Attribute].
-
#basic_blocks ⇒ Object
Returns an Enumerable of the BasicBlocks in this function.
-
#call_conv ⇒ Object
gets the calling convention of the function.
-
#call_conv=(conv) ⇒ Object
Sets the function’s calling convention and returns it.
-
#function_attributes ⇒ Object
-> AttributeCollection.
-
#function_type ⇒ Object
: -> Type?.
- #gc ⇒ Object
- #gc=(name) ⇒ Object
-
#inspect ⇒ Object
: -> String.
-
#param_attributes(index) ⇒ Object
-> AttributeCollection.
-
#params ⇒ Object
Returns an Enumerable of the parameters in the function.
-
#personality_function ⇒ Object
Get personality function of function.
-
#personality_function=(personality_function) ⇒ Object
Set personality function of function : (Value) -> void.
-
#readnone? ⇒ Boolean
: -> bool.
-
#readonly? ⇒ Boolean
: -> bool.
-
#remove_attribute(attr, index = -1)) ⇒ Object
Removes the given attribute from the function.
-
#return_attributes ⇒ Object
-> AttributeCollection.
- #return_type ⇒ Object
-
#type ⇒ Object
In LLVM 15, not overriding this yields a pointer type instead of a function type : -> Type?.
-
#valid? ⇒ Boolean
: -> bool.
-
#verify ⇒ true, false
Verify that a function is valid.
-
#verify! ⇒ true, false
Verify that a function is valid, and abort the process if not.
-
#writeonly? ⇒ Boolean
: -> bool.
Methods inherited from GlobalValue
#alignment, #alignment=, #declaration?, #dll_storage_class, #dll_storage_class=, #linkage, #linkage=, #section, #section=, #unnamed_addr=, #unnamed_addr?, #visibility, #visibility=
Methods inherited from Constant
#bitcast_to, #gep, #int_to_ptr, null, null_ptr, poison, #ptr_to_int, undef
Methods inherited from User
Methods inherited from Value
#allocated_type, #allocated_type?, #constant?, #dump, from_ptr, from_ptr_kind, #gep_source_element_type, #gep_source_element_type?, #global_parent, #kind, #name, #name=, #null?, #poison?, to_ptr, #to_s, type, #undef?
Methods included from PointerIdentity
Instance Method Details
#add_attribute(attr, index = -1)) ⇒ Object
Adds attr to this value’s attributes.
968 969 970 |
# File 'lib/llvm/core/value.rb', line 968 def add_attribute(attr, index = -1) AttributeCollection.new(self, index).add(attr) end |
#attribute_count ⇒ Object
977 978 979 |
# File 'lib/llvm/core/value.rb', line 977 def attribute_count function_attributes.count end |
#attributes ⇒ Object
-> [Attribute]
982 983 984 |
# File 'lib/llvm/core/value.rb', line 982 def attributes function_attributes.to_a end |
#basic_blocks ⇒ Object
Returns an Enumerable of the BasicBlocks in this function. : -> BasicBlockCollection
948 949 950 |
# File 'lib/llvm/core/value.rb', line 948 def basic_blocks @basic_block_collection ||= BasicBlockCollection.new(self) end |
#call_conv ⇒ Object
gets the calling convention of the function
926 927 928 |
# File 'lib/llvm/core/value.rb', line 926 def call_conv C.get_function_call_conv(self) end |
#call_conv=(conv) ⇒ Object
Sets the function’s calling convention and returns it.
921 922 923 |
# File 'lib/llvm/core/value.rb', line 921 def call_conv=(conv) C.set_function_call_conv(self, conv) end |
#function_attributes ⇒ Object
-> AttributeCollection
1002 1003 1004 |
# File 'lib/llvm/core/value.rb', line 1002 def function_attributes AttributeCollection.new(self, -1) end |
#function_type ⇒ Object
: -> Type?
953 954 955 |
# File 'lib/llvm/core/value.rb', line 953 def function_type Type.from_ptr(C.get_element_type(self), kind: :function) end |
#gc ⇒ Object
1202 1203 1204 |
# File 'lib/llvm/core/value.rb', line 1202 def gc C.get_gc(self) end |
#gc=(name) ⇒ Object
1198 1199 1200 |
# File 'lib/llvm/core/value.rb', line 1198 def gc=(name) C.set_gc(self, name) end |
#inspect ⇒ Object
: -> String
1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 |
# File 'lib/llvm/core/value.rb', line 1207 def inspect { signature: to_s.lines[attribute_count.zero? ? 0 : 1], type: type.to_s, attributes: attribute_count, valid: valid?, blocks: basic_blocks.size, lines: to_s.lines.size, }.to_s end |
#param_attributes(index) ⇒ Object
-> AttributeCollection
1012 1013 1014 |
# File 'lib/llvm/core/value.rb', line 1012 def param_attributes(index) AttributeCollection.new(self, index) end |
#params ⇒ Object
Returns an Enumerable of the parameters in the function. : -> ParameterCollection
1163 1164 1165 |
# File 'lib/llvm/core/value.rb', line 1163 def params @parameter_collection ||= ParameterCollection.new(self) end |
#personality_function ⇒ Object
Experimental and unsupported
Get personality function of function
933 934 935 936 |
# File 'lib/llvm/core/value.rb', line 933 def personality_function ptr = C.get_personality_fn(self) LLVM::Function.from_ptr(ptr) end |
#personality_function=(personality_function) ⇒ Object
Experimental and unsupported
Set personality function of function : (Value) -> void
942 943 944 |
# File 'lib/llvm/core/value.rb', line 942 def personality_function=(personality_function) C.set_personality_fn(self, personality_function) end |
#readnone? ⇒ Boolean
: -> bool
987 988 989 |
# File 'lib/llvm/core/value.rb', line 987 def readnone? attributes.detect(&:readnone?) end |
#readonly? ⇒ Boolean
: -> bool
992 993 994 |
# File 'lib/llvm/core/value.rb', line 992 def readonly? attributes.detect(&:readonly?) end |
#remove_attribute(attr, index = -1)) ⇒ Object
Removes the given attribute from the function.
973 974 975 |
# File 'lib/llvm/core/value.rb', line 973 def remove_attribute(attr, index = -1) AttributeCollection.new(self, index).remove(attr) end |
#return_attributes ⇒ Object
-> AttributeCollection
1007 1008 1009 |
# File 'lib/llvm/core/value.rb', line 1007 def return_attributes AttributeCollection.new(self, 0) end |
#return_type ⇒ Object
963 964 965 |
# File 'lib/llvm/core/value.rb', line 963 def return_type type.return_type end |
#type ⇒ Object
In LLVM 15, not overriding this yields a pointer type instead of a function type : -> Type?
959 960 961 |
# File 'lib/llvm/core/value.rb', line 959 def type function_type end |
#valid? ⇒ Boolean
: -> bool
61 62 63 |
# File 'lib/llvm/analysis.rb', line 61 def valid? verify end |
#verify ⇒ true, false
Verify that a function is valid. : -> bool
47 48 49 |
# File 'lib/llvm/analysis.rb', line 47 def verify do_verification(:return_status) end |
#verify! ⇒ true, false
Verify that a function is valid, and abort the process if not. : -> bool
54 55 56 57 58 |
# File 'lib/llvm/analysis.rb', line 54 def verify! # :nocov: do_verification(:abort_process) # :nocov: end |
#writeonly? ⇒ Boolean
: -> bool
997 998 999 |
# File 'lib/llvm/core/value.rb', line 997 def writeonly? attributes.detect(&:writeonly?) end |