Class: Rubycc::IR::AbiPiece

Inherits:
Data
  • Object
show all
Defined in:
lib/rubycc/ir/call_convention.rb

Overview

One piece of a by-value aggregate as its convention moves it: the byte offset within the aggregate the piece is read from (and written back to at the far end), the size of that access, and the kind of place it travels in (:gp an integer register, :sse4/:sse8 a vector one, :mem a stack eightbyte).

An aggregate is never moved as a whole — the generator takes it apart into these pieces, loads each into a virtual register and hands the backend one ABI slot per piece — so the piece list is the classification, and it is exactly where the two conventions part ways. System V AMD64 always cuts on eightbyte boundaries (offset 8i, size 8, the eightbyte's class), while AAPCS64 cuts a homogeneous floating aggregate along its members instead (offset 4i, size 4 for a struct of floats, each member its own vector register). That is why a piece carries an offset and a width rather than just an index: struct { float a, b; } is one eightbyte on x86-64 and two single-precision registers on aarch64.

Instance Attribute Summary collapse

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



23
24
25
# File 'lib/rubycc/ir/call_convention.rb', line 23

def kind
  @kind
end

#offsetObject (readonly)

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



23
24
25
# File 'lib/rubycc/ir/call_convention.rb', line 23

def offset
  @offset
end

#sizeObject (readonly)

Returns the value of attribute size

Returns:

  • (Object)

    the current value of size



23
24
25
# File 'lib/rubycc/ir/call_convention.rb', line 23

def size
  @size
end