Class: Carbon::Tacky::Context Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/carbon/tacky/context.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function, build, generics) ⇒ Context

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize the context.

Parameters:



60
61
62
63
64
65
66
67
68
# File 'lib/carbon/tacky/context.rb', line 60

def initialize(function, build, generics)
  @function = function
  @build = build
  @generics = generics
  @instructions = []
  @blocks = {}
  @params = []
  freeze
end

Instance Attribute Details

#blocks{Tacky::Block => ::LLVM::BasicBlock} (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

Returns:



26
27
28
# File 'lib/carbon/tacky/context.rb', line 26

def blocks
  @blocks
end

#buildConcrete::Build (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The actual build.

Returns:



42
43
44
# File 'lib/carbon/tacky/context.rb', line 42

def build
  @build
end

#functionTacky::Function (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the function that this is being built for.

Returns:



53
54
55
# File 'lib/carbon/tacky/context.rb', line 53

def function
  @function
end

#generics{::String => Concrete::Type} (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The generics that the function is being built with.

Returns:



31
32
33
# File 'lib/carbon/tacky/context.rb', line 31

def generics
  @generics
end

#instructions<::LLVM::Value> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The values of instructions. This is used to properly map Reference values to the proper LLVM::Values.

Returns:

  • (<::LLVM::Value>)


19
20
21
# File 'lib/carbon/tacky/context.rb', line 19

def instructions
  @instructions
end

#items{Concrete::Type => (Concrete::Item, ::LLVM::Value)} (readonly)

The types that have been defined. This is a mapping of the Concrete::Type to an arry of the Concrete::Item and the corresponding LLVM::Type. This is so that no information is lost when converting the item to the type.

Returns:



45
46
47
# File 'lib/carbon/tacky/context.rb', line 45

def items
  @items
end

#params<::LLVM::Value> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The parameters that are passed from the function. This is used to convert Parameter references to LLVM::Values.

Returns:

  • (<::LLVM::Value>)


37
38
39
# File 'lib/carbon/tacky/context.rb', line 37

def params
  @params
end