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

#addr_space_cast, #bitcast_to, #get_element_ptr, #get_element_ptr_in_bounds

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)


1076
1077
1078
# File 'lib/rltk/cg/value.rb', line 1076

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

Instance Method Details

#alignmentInteger

Get the byte alignment of this value.

Returns:

  • (Integer)


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

def alignment
	Bindings.get_alignment(@ptr)
end

#alignment=(bytes) ⇒ void

This method returns an undefined value.

Set the byte alignment of this value.

Parameters:

  • bytes (Integer)


1092
1093
1094
# File 'lib/rltk/cg/value.rb', line 1092

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

#declaration?Boolean

Check if this value is a declaration.

Returns:

  • (Boolean)


1099
1100
1101
# File 'lib/rltk/cg/value.rb', line 1099

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

#externally_initialized=(bool) ⇒ void

This method returns an undefined value.

Sets the externally initialized property of a global value.

Parameters:

  • bool (Boolean)

    If the value is externally initialized



1108
1109
1110
# File 'lib/rltk/cg/value.rb', line 1108

def externally_initialized=(bool)
	Bindings.set_externally_initialized(@ptr, bool.to_i)
end

#externally_initialized?Boolean

Check if this global is initialized externally.

Returns:

  • (Boolean)


1115
1116
1117
# File 'lib/rltk/cg/value.rb', line 1115

def externally_initialized?
	Bindings.externally_initialized(@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)


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

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)


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

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

#initializerValue

Get this value’s initializer.

Returns:



1138
1139
1140
# File 'lib/rltk/cg/value.rb', line 1138

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

#initializer=(val) ⇒ void

This method returns an undefined value.

Set this value’s initializer.

Parameters:



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

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

#linkageSymbol

Get this value’s linkage type.

Returns:

  • (Symbol)

See Also:



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

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:



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

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

#sectionString

Get this value’s section string.

Returns:

  • (String)


1174
1175
1176
# File 'lib/rltk/cg/value.rb', line 1174

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)


1183
1184
1185
# File 'lib/rltk/cg/value.rb', line 1183

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

#thread_local_modeSymbol from _enum_thread_local_mode_

Returns the thread local model used by a global value.

Returns:

  • (Symbol from _enum_thread_local_mode_)


1190
1191
1192
# File 'lib/rltk/cg/value.rb', line 1190

def thread_local_mode
	Bindings.get_thread_local_mode(@ptr)
end

#thread_local_mode=(mode) ⇒ void

This method returns an undefined value.

Set the global value’s thread local mode.

Parameters:

  • mode (Symbol from _enum_thread_local_mode_)


1200
1201
1202
# File 'lib/rltk/cg/value.rb', line 1200

def thread_local_mode=(mode)
	Bindings.set_thread_local_mode(@ptr, mode)
end

#visibilityString

Get this value’s visibility.

Returns:

  • (String)

See Also:



1209
1210
1211
# File 'lib/rltk/cg/value.rb', line 1209

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:



1220
1221
1222
# File 'lib/rltk/cg/value.rb', line 1220

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