Class: Rubycc::IR::Program

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

Overview

A whole translation unit lowered to IR: its functions (an array of Function), the shared read-only string pool strings (an array of ASCII-8BIT byte strings, without their NUL terminators, indexed by the id a :string_addr instruction carries), its globals (an array of Global in source order) and its array_entries (an array of ArrayEntry, empty for a unit with no constructor/destructor). Identical string contents are pooled once, so the compiler can lay them out in .rodata in this order and resolve each :string_addr to an offset.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(functions:, strings:, globals:, array_entries: [], visibility: {}) ⇒ Program

Returns a new instance of Program.



412
413
414
# File 'lib/rubycc/ir/ir.rb', line 412

def initialize(functions:, strings:, globals:, array_entries: [], visibility: {})
  super
end

Instance Attribute Details

#array_entriesObject (readonly)

Returns the value of attribute array_entries

Returns:

  • (Object)

    the current value of array_entries



411
412
413
# File 'lib/rubycc/ir/ir.rb', line 411

def array_entries
  @array_entries
end

#functionsObject (readonly)

Returns the value of attribute functions

Returns:

  • (Object)

    the current value of functions



411
412
413
# File 'lib/rubycc/ir/ir.rb', line 411

def functions
  @functions
end

#globalsObject (readonly)

Returns the value of attribute globals

Returns:

  • (Object)

    the current value of globals



411
412
413
# File 'lib/rubycc/ir/ir.rb', line 411

def globals
  @globals
end

#stringsObject (readonly)

Returns the value of attribute strings

Returns:

  • (Object)

    the current value of strings



411
412
413
# File 'lib/rubycc/ir/ir.rb', line 411

def strings
  @strings
end

#visibilityObject (readonly)

Returns the value of attribute visibility

Returns:

  • (Object)

    the current value of visibility



411
412
413
# File 'lib/rubycc/ir/ir.rb', line 411

def visibility
  @visibility
end