class Carbon::Tacky::Context

A “context.” This contains all of the information needed to build a function, such as instruction values (From LLVM), block mapping, parameters, and the build ({Concrete::Build}).

@api private

Attributes

blocks[R]

The mapping for blocks. This is used by instructions to map a {Tacky::Block} to the proper `LLVM::BasicBlock`, since many llvm instructions take basic blocks as parameters.

@return [{Tacky::Block => ::LLVM::BasicBlock}]

build[R]

The actual build.

@return [Concrete::Build]

function[R]

Returns the function that this is being built for.

@return [Tacky::Function]

generics[R]

The generics that the function is being built with.

@return [{::String => Concrete::Type}]

instructions[R]

The values of instructions. This is used to properly map {Tacky::Reference} values to the proper `LLVM::Value`s.

@return [<::LLVM::Value>]

items[R]
params[R]

The parameters that are passed from the function. This is used to convert {Tacky::Parameter} references to `LLVM::Value`s.

@return [<::LLVM::Value>]

Public Class Methods

new(function, build, generics) click to toggle source

Initialize the context.

@param function [Tacky::Function] @param build [Concrete::Build] @param generics [{::String => Concrete::Type}]

# File lib/carbon/tacky/context.rb, line 60
def initialize(function, build, generics)
  @function = function
  @build = build
  @generics = generics
  @instructions = []
  @blocks = {}
  @params = []
  freeze
end