Sha256: 27852b9eea835a990ba873eb7dfd436884510ea84a19ba127637ea5c00f92769
Contents?: true
Size: 1.94 KB
Versions: 2
Compression:
Stored size: 1.94 KB
Contents
# encoding: utf-8 # frozen_string_literal: true require "forwardable" module Carbon module Tacky # 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 class Context extend Forwardable # The values of instructions. This is used to properly map # {Tacky::Reference} values to the proper `LLVM::Value`s. # # @return [<::LLVM::Value>] attr_reader :instructions # 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}] attr_reader :blocks # The generics that the function is being built with. # # @return [{::String => Concrete::Type}] attr_reader :generics # The parameters that are passed from the function. This is used to # convert {Tacky::Parameter} references to `LLVM::Value`s. # # @return [<::LLVM::Value>] attr_reader :params # The actual build. # # @return [Concrete::Build] attr_reader :build # (see Concrete::Build#items) attr_reader :items def_delegator :@build, :items def_delegator :@build, :fetch # Returns the function that this is being built for. # # @return [Tacky::Function] attr_reader :function # Initialize the context. # # @param function [Tacky::Function] # @param build [Concrete::Build] # @param generics [{::String => Concrete::Type}] def initialize(function, build, generics) @function = function @build = build @generics = generics @instructions = [] @blocks = {} @params = [] freeze end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
carbon-core-0.2.1 | lib/carbon/tacky/context.rb |
carbon-core-0.2.0 | lib/carbon/tacky/context.rb |