All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlin.backend.wasm.ir2wasm.WasmBaseCodegenContext.kt Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
/*
 * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
 * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
 */

package org.jetbrains.kotlin.backend.wasm.ir2wasm

import org.jetbrains.kotlin.backend.wasm.WasmBackendContext
import org.jetbrains.kotlin.wasm.ir.*
import org.jetbrains.kotlin.backend.wasm.lower.WasmSignature
import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.IrType

interface WasmBaseCodegenContext {
    val backendContext: WasmBackendContext

    fun referenceFunction(irFunction: IrFunctionSymbol): WasmSymbol
    fun referenceGlobal(irField: IrFieldSymbol): WasmSymbol
    fun referenceStructType(irClass: IrClassSymbol): WasmSymbol
    fun referenceFunctionType(irFunction: IrFunctionSymbol): WasmSymbol

    fun referenceClassId(irClass: IrClassSymbol): WasmSymbol
    fun referenceInterfaceId(irInterface: IrClassSymbol): WasmSymbol
    fun referenceVirtualFunctionId(irFunction: IrSimpleFunctionSymbol): WasmSymbol
    fun referenceClassRTT(irClass: IrClassSymbol): WasmSymbol

    fun referenceSignatureId(signature: WasmSignature): WasmSymbol

    fun referenceStringLiteral(string: String): WasmSymbol

    fun transformType(irType: IrType): WasmType
    fun transformBoxedType(irType: IrType): WasmType
    fun transformValueParameterType(irValueParameter: IrValueParameter): WasmType
    fun transformResultType(irType: IrType): WasmType?
    fun transformBlockResultType(irType: IrType): WasmType?


    fun getStructFieldRef(field: IrField): WasmSymbol
    fun getClassMetadata(irClass: IrClassSymbol): ClassMetadata
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy