Class: LLVM::TargetDataLayout
- Inherits:
-
Object
- Object
- LLVM::TargetDataLayout
- Defined in:
- lib/llvm/target.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#abi_alignment_of(type) ⇒ Object
Computes the ABI alignment of a type in bytes for a target.
-
#abi_size_of(type) ⇒ Object
Computes the ABI size of a type in bytes for a target.
-
#bit_size_of(type) ⇒ Object
Computes the size of a type in bits for a target.
-
#byte_order ⇒ Object
Returns the byte order of a target, either :big_endian or :little_endian.
-
#call_frame_alignment_of(type) ⇒ Object
Computes the call frame alignment of a type in bytes for a target.
-
#dispose ⇒ Object
Destroys this instance of TargetDataLayout.
-
#element_at_offset(type, offset) ⇒ Object
Computes the structure element that contains the byte offset for a target.
-
#initialize(representation) ⇒ TargetDataLayout
constructor
Creates a target data layout from a string representation.
-
#int_ptr_type(addr_space = 0) ⇒ Object
Returns the integer type that is the same size as a pointer on a target.
-
#offset_of_element(type, element) ⇒ Object
Computes the byte offset of the indexed struct element for a target.
-
#pointer_size(addr_space = 0) ⇒ Object
Returns the pointer size in bytes for a target.
-
#preferred_alignment_of(entity) ⇒ Object
Computes the preferred alignment of a type or a global variable in bytes for a target.
-
#storage_size_of(type) ⇒ Object
Computes the storage size of a type in bytes for a target.
- #to_ptr ⇒ Object
-
#to_s ⇒ String
Returns string representation of target data layout.
Constructor Details
#initialize(representation) ⇒ TargetDataLayout
Creates a target data layout from a string representation.
228 229 230 |
# File 'lib/llvm/target.rb', line 228 def initialize(representation) @ptr = C.create_target_data(representation.to_s) end |
Class Method Details
.from_ptr(ptr) ⇒ Object
233 234 235 236 237 |
# File 'lib/llvm/target.rb', line 233 def self.from_ptr(ptr) target = allocate target.instance_variable_set :@ptr, ptr target end |
Instance Method Details
#abi_alignment_of(type) ⇒ Object
Computes the ABI alignment of a type in bytes for a target.
298 299 300 |
# File 'lib/llvm/target.rb', line 298 def abi_alignment_of(type) C.abi_alignment_of_type(self, type) end |
#abi_size_of(type) ⇒ Object
Computes the ABI size of a type in bytes for a target.
293 294 295 |
# File 'lib/llvm/target.rb', line 293 def abi_size_of(type) C.abi_size_of_type(self, type) end |
#bit_size_of(type) ⇒ Object
Computes the size of a type in bits for a target.
283 284 285 |
# File 'lib/llvm/target.rb', line 283 def bit_size_of(type) C.size_of_type_in_bits(self, type) end |
#byte_order ⇒ Object
Returns the byte order of a target, either :big_endian or :little_endian.
264 265 266 |
# File 'lib/llvm/target.rb', line 264 def byte_order C.byte_order(self) end |
#call_frame_alignment_of(type) ⇒ Object
Computes the call frame alignment of a type in bytes for a target.
303 304 305 |
# File 'lib/llvm/target.rb', line 303 def call_frame_alignment_of(type) C.call_frame_alignment_of_type(self, type) end |
#dispose ⇒ Object
Destroys this instance of TargetDataLayout.
245 246 247 248 249 250 |
# File 'lib/llvm/target.rb', line 245 def dispose return if ptr.nil? C.dispose_target_data(self) @ptr = nil end |
#element_at_offset(type, offset) ⇒ Object
Computes the structure element that contains the byte offset for a target.
321 322 323 |
# File 'lib/llvm/target.rb', line 321 def element_at_offset(type, offset) C.element_at_offset(self, type, offset) end |
#int_ptr_type(addr_space = 0) ⇒ Object
Returns the integer type that is the same size as a pointer on a target.
278 279 280 |
# File 'lib/llvm/target.rb', line 278 def int_ptr_type(addr_space = 0) Type.from_ptr(C.int_ptr_type_for_as(self, addr_space), :integer) end |
#offset_of_element(type, element) ⇒ Object
Computes the byte offset of the indexed struct element for a target.
326 327 328 |
# File 'lib/llvm/target.rb', line 326 def offset_of_element(type, element) C.offset_of_element(self, type, element) end |
#pointer_size(addr_space = 0) ⇒ Object
Returns the pointer size in bytes for a target.
271 272 273 |
# File 'lib/llvm/target.rb', line 271 def pointer_size(addr_space = 0) C.pointer_size_for_as(self, addr_space) end |
#preferred_alignment_of(entity) ⇒ Object
Computes the preferred alignment of a type or a global variable in bytes for a target.
311 312 313 314 315 316 317 318 |
# File 'lib/llvm/target.rb', line 311 def preferred_alignment_of(entity) case entity when LLVM::Type C.preferred_alignment_of_type(self, entity) when LLVM::GlobalValue C.preferred_alignment_of_global(self, entity) end end |
#storage_size_of(type) ⇒ Object
Computes the storage size of a type in bytes for a target.
288 289 290 |
# File 'lib/llvm/target.rb', line 288 def storage_size_of(type) C.store_size_of_type(self, type) end |
#to_ptr ⇒ Object
240 241 242 |
# File 'lib/llvm/target.rb', line 240 def to_ptr @ptr end |
#to_s ⇒ String
Returns string representation of target data layout.
255 256 257 258 259 260 261 |
# File 'lib/llvm/target.rb', line 255 def to_s string_ptr = C.copy_string_rep_of_target_data(self) string = string_ptr.read_string C.(string_ptr) string end |