frontend

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package frontend implements the translation of WebAssembly to SSA IR using the ssa package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FunctionIndexToFuncRef

func FunctionIndexToFuncRef(idx wasm.Index) ssa.FuncRef

func SignatureForListener

func SignatureForListener(wasmSig *wasm.FunctionType) (*ssa.Signature, *ssa.Signature)

SignatureForListener returns the signatures for the listener functions.

func SignatureForWasmFunctionType

func SignatureForWasmFunctionType(typ *wasm.FunctionType) ssa.Signature

SignatureForWasmFunctionType returns the ssa.Signature for the given wasm.FunctionType.

func WasmTypeToSSAType

func WasmTypeToSSAType(vt wasm.ValueType) ssa.Type

WasmTypeToSSAType converts wasm.ValueType to ssa.Type.

Types

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

Compiler is in charge of lowering Wasm to SSA IR, and does the optimization on top of it in architecture-independent way.

func NewFrontendCompiler

func NewFrontendCompiler(m *wasm.Module, ssaBuilder ssa.Builder, offset *wazevoapi.ModuleContextOffsetData, ensureTermination bool, listenerOn bool, sourceInfo bool) *Compiler

NewFrontendCompiler returns a frontend Compiler.

func (*Compiler) Init

func (c *Compiler) Init(idx, typIndex wasm.Index, typ *wasm.FunctionType, localTypes []wasm.ValueType, body []byte, needListener bool, bodyOffsetInCodeSection uint64)

Init initializes the state of frontendCompiler and make it ready for a next function.

func (*Compiler) LowerToSSA

func (c *Compiler) LowerToSSA()

LowerToSSA lowers the current function to SSA function which will be held by ssaBuilder. After calling this, the caller will be able to access the SSA info in *Compiler.ssaBuilder.

Note that this only does the naive lowering, and do not do any optimization, instead the caller is expected to do so.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL