Class: RLTK::CG::GlobalValue

Inherits:
Constant show all
Defined in:
lib/rltk/cg/value.rb

Overview

This class represents global constants, variables, and functions.

Direct Known Subclasses

Function, GlobalAlias, GlobalVariable

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Instance Method Summary collapse

Methods inherited from Constant

#bitcast_to, #get_element_ptr, #get_element_ptr_in_bounds

Methods included from AbstractClass

included

Methods inherited from User

#operands

Methods inherited from Value

#==, #attributes, #bitcast, #constant?, #dump, #hash, #name, #name=, #null?, #print, #trunc, #trunc_or_bitcast, #type, #undefined?, #zextend, #zextend_or_bitcast

Methods included from BindingClass

#==

Constructor Details

#initialize(ptr) ⇒ GlobalValue

Global values can only be instantiated using a pointer, and as such should not be created directly by library users.

Parameters:

  • ptr (FFI::Pointer)


1066
1067
1068
# File 'lib/rltk/cg/value.rb', line 1066

def initialize(ptr)
	@ptr = check_type(ptr, FFI::Pointer, 'ptr')
end

Instance Method Details

#alignmentInteger

Get the byte alignment of this value.

Returns:



1073
1074
1075
# File 'lib/rltk/cg/value.rb', line 1073

def alignment
	Bindings.get_alignment(@ptr)
end

#alignment=(bytes) ⇒ void

This method returns an undefined value.

Set the byte alignment of this value.

Parameters:



1082
1083
1084
# File 'lib/rltk/cg/value.rb', line 1082

def alignment=(bytes)
	Bindings.set_alignment(@ptr, bytes)
end

#declaration?Boolean

Check if this value is a declaration.

Returns:

  • (Boolean)


1089
1090
1091
# File 'lib/rltk/cg/value.rb', line 1089

def declaration?
	Bindings.is_declaration(@ptr).to_bool
end

#global_constant=(flag) ⇒ void

This method returns an undefined value.

Set this value as a global constant or not.

Parameters:

  • flag (Boolean)


1105
1106
1107
# File 'lib/rltk/cg/value.rb', line 1105

def global_constant=(flag)
	Bindings.set_global_constant(@ptr, flag.to_i)
end

#global_constant?Boolean

Check if this value is a global constant.

Returns:

  • (Boolean)


1096
1097
1098
# File 'lib/rltk/cg/value.rb', line 1096

def global_constant?
	Bindings.is_global_constant(@ptr).to_bool
end

#initializerValue

Get this value’s initializer.

Returns:



1112
1113
1114
# File 'lib/rltk/cg/value.rb', line 1112

def initializer
	Value.new(Bindings.get_initializer(@ptr))
end

#initializer=(val) ⇒ void

This method returns an undefined value.

Set this value’s initializer.

Parameters:



1121
1122
1123
# File 'lib/rltk/cg/value.rb', line 1121

def initializer=(val)
	Bindings.set_initializer(@ptr, check_type(val, Value, 'val'))
end

#linkageSymbol

Get this value’s linkage type.

Returns:

  • (Symbol)

See Also:



1130
1131
1132
# File 'lib/rltk/cg/value.rb', line 1130

def linkage
	Bindings.get_linkage(@ptr)
end

#linkage=(linkage) ⇒ void

This method returns an undefined value.

Set this value’s linkage type.

Parameters:

  • linkage (Symbol)

See Also:



1141
1142
1143
# File 'lib/rltk/cg/value.rb', line 1141

def linkage=(linkage)
	Bindings.set_linkage(@ptr, linkage)
end

#sectionString

Get this value’s section string.

Returns:

  • (String)


1148
1149
1150
# File 'lib/rltk/cg/value.rb', line 1148

def section
	Bindings.get_section(@ptr)
end

#section=(section) ⇒ void

This method returns an undefined value.

Set this value’s section string.

Parameters:

  • section (String)


1157
1158
1159
# File 'lib/rltk/cg/value.rb', line 1157

def section=(section)
	Bindings.set_section(@ptr, section)
end

#visibilityString

Get this value’s visibility.

Returns:

  • (String)

See Also:



1166
1167
1168
# File 'lib/rltk/cg/value.rb', line 1166

def visibility
	Bindings.get_visibility(@ptr)
end

#visibility=(vis) ⇒ void

This method returns an undefined value.

Set this value’s visibility.

Parameters:

  • vis (Symbol)

See Also:



1177
1178
1179
# File 'lib/rltk/cg/value.rb', line 1177

def visibility=(vis)
	Bindings.set_visibility(@ptr, vis)
end